On Wed, Jul 02, 2008 at 04:23:05PM +0530, Amarendra Godbole wrote: > The ksh man page reads: "The name of the shell (i.e. the contents of > $0) is de-termined as follows: if the -c option is used and there is a > non-option argument, it is used as the name; if commands are being > read from a file, the file is used as the name; otherwise, the > basename the shell was called with (i.e. argv[0]) is used. > > The observed behavior is: > [EMAIL PROTECTED] ~ $] ksh -c "echo $0" > ksh > [EMAIL PROTECTED] ~ $] > > Now, according to the above snippet from the man-page, shouldn't the > output be "echo", and not "ksh"? (echo is the non-option argument, and > -c is also being used). Or am I messing things up in my mind? Thanks > in advance for setting my train of thought straight. >
# ksh -c 'echo 0:$0 1:$1' hi you 0:hi 1:you It seems to be the command line arguments (non-option) that apply. Furthermore "echo $0" gets expanded before ksh invocation. > -Amarendra -- / Raimo Niskanen, Erlang/OTP, Ericsson AB