Is this a bug in sh?
Doug Gwyn
gwyn at smoke.BRL.MIL
Fri Jul 7 06:50:19 AEST 1989
In article <PAUL.89Jul4155856 at marvin.moncam.co.uk> paul at moncam.co.uk (Paul Hudson) writes:
>script1 is and script2 is
>echo $0 echo $0
>name=`basename $0` name= `basename $0`
> ^
> Note the space here.
The space separates "words", so in script2 you're running a command
that is obtained as the output from the `` quoted command, prefixed
by a word that sets the environment variable "name" to an empty
string just for that one command.
It's not a bug; it's the way the shell is documented as working.
Change some other syntax and you'll get yet other variations in
behavior.
More information about the Comp.unix.questions
mailing list