?
Solved

Environment Variable from C program

Posted on 1997-11-19
2
Medium Priority
?
207 Views
Last Modified: 2010-04-21
I would like to export a shell variables from a C program but
when program exits variable is not set. Is somebody has an idea ?
0
Comment
Question by:pla
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
xilef earned 150 total points
ID: 2007900
This does not work, because every process has its own environment. As soon as your process exits, its environment is gone.

More information can be found in the UNIX Programming FAQ: http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC7

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007901
It's not easy, but it's not impossible.
exec program :-)
(of course you need additional hacking in your C code to get
work, even as one would expect it working)
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question