This is a discussion on Re: bug in ksh ? within the lucky.openbsd.misc forums, part of the OpenBSD category; --> On Mon, Aug 28, 2006 at 01:33:59AM +0200, Ingo Schwarze wrote: | > Please now try `if ! false; ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Mon, Aug 28, 2006 at 01:33:59AM +0200, Ingo Schwarze wrote: | > Please now try `if ! false; then echo true; fi`. | > Why does my shell eat muchos CPU & RAM after such a short pipeline? | | schwarze@idefix $ uname -a | OpenBSD idefix 3.9 GENERIC#617 i386 | schwarze@idefix $ /bin/ksh | $ date | Mon Aug 28 01:28:07 CEST 2006 | $ if ! false; then echo true; fi | true | $ date | Mon Aug 28 01:28:12 CEST 2006 | $ date; ( if ! false; then echo true; fi ); date | Mon Aug 28 01:28:20 CEST 2006 | true | Mon Aug 28 01:28:20 CEST 2006 | $ time ( if ! false; then echo true; fi ) | true | 0m0.01s real 0m0.00s user 0m0.01s system | $ time ( echo `if ! false; then echo true; fi` ) | true | 0m0.04s real 0m0.00s user 0m0.02s system | $ exit | | Sorry, cannot reproduce. | Works for me (on OpenBSD 3.9-release). Now it takes quite a bit of time before it actually reaches this. Searching the manpage a bit more, I found another reference to '!'. $ set +o csh-history $ time ( if ! false; then echo true; fi ) true 0m0.00s real 0m0.00s user 0m0.01s system $ set -o csh-history $ time ( if ! false; then echo true; fi ) /bin/ksh: internal error: unable to allocate memory Since I set csh-history in my .kshrc, this option is set in all my shells. I don't think this is intended behaviour, but if it is, it probably should be documented in the manpage. Cheers, Paul 'WEiRD' de Weerd -- >++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+ +++++++++++>-]<.>++[<------------>-]<+.--------------.[-] http://www.weirdnet.nl/ |