Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!purdue!bu-cs!att!cbnews!mveao From: mveao@cbnews.ATT.COM (eric.a.olson) Newsgroups: comp.unix.questions Subject: Re: Is this a bug in sh? Message-ID: <7931@cbnews.ATT.COM> Date: 5 Jul 89 01:50:14 GMT References: Reply-To: mveao@cbnews.ATT.COM (eric.a.olson) Distribution: all Organization: AT&T Bell Laboratories Lines: 18 In article paul@moncam.co.uk (Paul Hudson) writes: > >Consider the two (executable) shell scripts.. >script1 is and script2 is > echo $0 echo $0 > name=`basename $0` name= `basename $0` >Go on, tell me I haven't RTFM .... ;-) Then tell me why it's this way. They both evaluate the basename of their shell -- script1 and script2, respectively. The first assigns this to the variable $name; the second, however runs it as yet another command, in an environment where the variable $name is set to null. This causes recursion and the spawned shells you mentioned. fodder fodder fodder