argv[0] manipulation

P_spam_ at draigBrady.com P_spam_ at draigBrady.com
Thu Dec 12 05:40:39 EST 2002


Donn Cave wrote:
> Quoth P_spam_ at draigBrady.com:
> ...
> | I had assumed that the shell passes what you type for executables
> | in the $PATH directly in argv[0]. This is silly of course and
> | it just passes appropriate_path_entry+'/'+what_you_type so you can't
> | distinguish from argv[0] whether a program was found in the $PATH
> | or explicitly specified by the user.
> 
> Depends on the shell.  Bash and rc do one thing, ksh does another.

Well I'll be darn diddley arned. tcsh does the same as ksh.
I.E. if the prog is found in $PATH then the appropriate dir
is not prepended to argv[0].

> Python does what it should with argv, copies it directly into sys.argv.

Definitely agreed.

Pádraig.




More information about the Python-list mailing list