Is this a bug in sh?

Paul Hudson paul at moncam.co.uk
Wed Jul 5 00:58:56 AEST 1989


Am I just showing my ignorance of sh?
Consider the two (executable) shell scripts..

script1 is		and  	script2 is

echo $0				echo $0
name=`basename $0`		name= `basename $0`
				     ^
			Note the space here.

executing script1 prints "script1" as you would expect.  Executing
script2 prints "script2" "script2" ...... and spawns shells at an
enormous rate.

This is sunos4.0 on a sun3/50.

Go on, tell me I haven't RTFM .... ;-) Then tell me why it's this way.


--
Paul Hudson	 MAIL: Monotype ADG, Science Park, Cambridge, CB4 4FQ, UK.
		PHONE: +44 (223) 420018	  EMAIL: paul at moncam.co.uk,
	;"	  FAX: +44 (223) 420911		 ...!ukc!acorn!moncam!paul
 `"";";"        "/dev/null full: please empty the bit bucket"



More information about the Comp.unix.questions mailing list