Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #813
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end |
|---|---|
| From | Barry Margolin <barmar@alum.mit.edu> |
| Newsgroups | comp.compilers, comp.unix.shell, comp.os.linux.misc |
| Subject | Re: magic/absurd bash interpreter/compiler ? |
| Date | Fri, 28 Dec 2012 10:25:33 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 38 |
| Sender | johnl@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <12-12-029@comp.compilers> (permalink) |
| References | <12-12-014@comp.compilers> <12-12-018@comp.compilers> <12-12-020@comp.compilers> <12-12-021@comp.compilers> <12-12-025@comp.compilers> |
| NNTP-Posting-Host | news.iecc.com |
| X-Trace | leila.iecc.com 1356817759 93644 64.57.183.58 (29 Dec 2012 21:49:19 GMT) |
| X-Complaints-To | abuse@iecc.com |
| NNTP-Posting-Date | Sat, 29 Dec 2012 21:49:19 +0000 (UTC) |
| Keywords | design, history, comment |
| Posted-Date | 29 Dec 2012 16:49:19 EST |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Xref | csiph.com comp.compilers:813 comp.unix.shell:6271 comp.os.linux.misc:6918 |
Cross-posted to 3 groups.
Show key headers only | View raw
glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote: > In comp.compilers Eric <eric@deptj.eu> wrote: > > (snip, I wrote) > >> One problem with many unix shells is that redirection is done too early. > >> Specifically, before an if test is done. > > > I am tempted to think that this is a conceptual misunderstanding, so an > > example would be useful. > > From the man page for csh: > > "The single-command form of if does output redirection even if the > expression is false and the command is not executed." > > echo false > file > if( 1 > 2 ) echo true > file > > The if statement will open (and truncate) file before > testing the condition. At least for csh, I didn't try others. > > -- glen > [That's one of the many, many bugs in csh. In posix shells such as > sh and bash, they do what you'd expect: > > if [ 1 \> 2 ]; then echo true > file; fi # doesn't create the file > if [ 1 \> 2 ]; then echo true; fi > file # does create it > > -John] csh is so broken, it's best ignored when talking about "Unix shells" in general. Even more so when someone says "many Unix shells", since one exception hardly counts as "many". -- Barry Margolin, barmar@alum.mit.edu Arlington, MA [Several other people wrote to agree that csh is bad news. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread
magic/absurd bash interpreter/compiler ? Avoid9Pdf@gmail.com - 2012-12-23 11:04 +0000
Re: magic/absurd bash interpreter/compiler ? J G Miller <miller@yoyo.ORG> - 2012-12-24 00:28 +0000
Re: magic/absurd bash interpreter/compiler ? "Jonathan Thornburg" <jthorn@astro.indiana.edu> - 2012-12-24 03:57 +0000
Re: magic/absurd bash interpreter/compiler ? Eric <eric@deptj.eu> - 2012-12-24 19:13 +0000
Re: magic/absurd bash interpreter/compiler ? Barry Margolin <barmar@alum.mit.edu> - 2012-12-24 20:48 -0500
Re: magic/absurd bash interpreter/compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-25 03:25 +0000
Re: magic/absurd bash interpreter/compiler ? Eric <eric@deptj.eu> - 2012-12-26 12:51 +0000
Re: magic/absurd bash interpreter/compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-28 03:17 +0000
Re: magic/absurd bash interpreter/compiler ? Barry Margolin <barmar@alum.mit.edu> - 2012-12-28 10:25 -0500
csiph-web