Mail Archives: djgpp/1994/03/28/16:29:43
>>Also, I think UNIX C runtime libraries DON'T put the full path name in
>>argv[0]. Argv[0] contains whatever the program that called exec()
>>puts in it. On UNIX, ksh seems to put whatever the user typed, not
>>the fully qualified path. I don't know about other shells.
>
>Some other Unix shells:
> bash: full path name (e.g. /usr/jon/bin/hello)
> csh: full path name
> sh: what the user types (e.g. hello)
>
>This is the result of one test, so I wouldn't swear to it in court;
>but I think it's correct.
>
Test result from SGI IRIX 4.0.5:
tcsh, csh, and sh all show whatever the user types.
However on shell scripts, if the script is in your search path but differ
from your current working directory, argv[0] will contain the full path
for all three shells when you just type the script name.(hello -> /path/hello)
If you type either relative path or absolute path name, result will be
what every you type(./hello -> ./hello, $HOME/bin/hello ->
/usr/people/guest/bin/hello).
If you type 'hello' in the same directory as 'hello' script, both csh and
tcsh show 'hello' but sh shows './hello'.
I don't know whether my setup in .cshrc/.tcshrc/.profile will affect the
result or not.
-Frank
====================================================================
Chih-Hung Chen(Frank), GSC/SAIC <frank AT manua DOT gsfc DOT nasa DOT gov>
SeaWiFS Data System <http://seawifs.gsfc.nasa.gov/SEAWIFS.html>
NASA/GSFC Code 970.2 (301) 286-9531, fax:(301) 286-1775
Greenbelt, Maryland 20771
- Raw text -