I wanted to write a small C program to append or remove directories
to/from variables such as PATH or MANPATH, in such a way that a dir-
ectory only appears in the variable once. I remember from my Solaris
days that there was a command (CkPath, or something similar), so it
should be possible to do (it was an ELF binary, not a shell script).
The problem is that when the C program returns the variables are
unchanged. I think that this is because the program is run in a
private shell rather than the calling shell, so all changes only
apply to the private shell and are discarded on exit.
Does anyone know the best way to change the environment variables of
the calling shell from a C program (if there is one)? Otherwise, is
it possible to do with a shell script?