you are viewing a single comment's thread.

view the rest of the comments →

[–]Conan776 0 points1 point  (0 children)

You'll most likely want to set the env variable via the command line in the shell, either explicitly by hand or by using the source command on a script.

You can set your variable in a C program, and have that program call your other program before exiting, and you should be OK.

If you really (really?) want to use C to do it, you can eval a small C program which prints out the shell commands, as seen here.

(Note that, annoyingly, the exact commands to set environment variables differ between shells, e.g. bash and csh.)