Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] sh bug
- Date: Thu, 20 Feb 2003 18:31:06 +0000
- From: Tim Hurman <kano-tlug@example.com>
- Subject: Re: [tlug] sh bug
- References: <20030219182145.RLM4278.fep04-mail.bloor.is.net.cable.rogers.com@[127.0.0.1]> <Pine.LNX.4.44.0302201027450.1463-100000@example.com> <15956.17107.132935.631052@example.com>
- User-agent: Mutt/1.4i
On Wed, Feb 19, 2003 at 09:52:03PM -0500, Viktor Pavlenko wrote: > >>>>> "JDB" == J David Beutel <jdb@example.com> writes: > > >> $ sh -c 'while read a; do if [ $a = "b" ]; then exit 1; fi; echo $a; done < a; echo done' > >> a > >> done > >> $ ksh -c 'while read a; do if [ $a = "b" ]; then exit 1; fi; echo $a; done < a; echo done' > >> a > > JDB> What is the bug? The exit only ends the while loop? Or the > JDB> parser is susceptible to obfuscation? > > I was afraid I would have to explain :( But I though it'd be JC :) > > sh interprets exit inside the while loop (only if it's fed from stdin) > as break. This contradicts the man page. Re. obfuscation, I always do > such things on command line, so that I don't have to save a file and > make it executable. No intentional obfuscation was intended. Come on, > it's just one line of code. > Are you sure this is not to do with the way sh on Solaris actually executes the code? ie it will actually sh the if statment. Thus an exit 1 will cause the sub sh to exit. That or the main while loop is executed in a sub sh, either could cause this. I know this seems silly, but sh on Solaris is very small and simple in comparison to bash. </poorexplanation> Tim. -- "ergo it is easier to drag sheep downhill" - Applied Ergonomics Magasine Tim Hurman - Email: kano at kano.org.uk - Phone: Yeah right.
- References:
- [tlug] sh bug
- From: Viktor Pavlenko
- Re: [tlug] sh bug
- From: J. David Beutel
- Re: [tlug] sh bug
- From: Viktor Pavlenko
Home | Main Index | Thread Index
- Prev by Date: [tlug] Linux bay
- Next by Date: [tlug] How to start egg server?
- Previous by thread: Re: [tlug] sh bug
- Next by thread: [tlug] Training Classes
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links