I am wondering if there's a way to detect what shell my C program is
running on from within the C program?
I know that I can call getenv("SHELL"). However, this doesn't reflect
what shell I am currently running my program on.(For example, I may
switch to another shell after I logon...)
Ummm, you don't like SHELL environment variable? What do you need this
knowledge for? Usually you are supposed to use $SHELL if you want to run a
subshell or something. Can you define what you mean? If you hope your
program was invoked from shell prompt, you might use getppid() and analize
who is your parent, but this is highly platform dependent---on systems that
support accounting it is easier.
PGP key fingerprint = 62367EA3D4D01D88E021F40A0D938E12 | public key on www page
Opinions that might have been represented here are just mine, not anyone else's