Re: failed grep should cause subshell to exit

2013-08-26 Thread Bob Proulx
David Lehmann wrote: > > Subject: Re: failed grep should cause subshell to exit > > set -ex Insert much previous discussion, search the archives, about why set -e is really a terrible paradigm for the shell. Here is a reference. http://mywiki.wooledge.org/BashFAQ/105 If you want the shell to

Re: i++ cause bad return code when result is 1

2013-08-26 Thread Chris Down
On 2013-08-26 22:06, Chris F.A. Johnson wrote: > Rather, that it is != 0 Er, yes. That's what I get for writing messages at 4am! pgp7Icwgcq_MV.pgp Description: PGP signature

Re: i++ cause bad return code when result is 1

2013-08-26 Thread Chris F.A. Johnson
On Tue, 27 Aug 2013, Chris Down wrote: On 2013-08-26 21:36, David Lehmann wrote: My issue is that the resulting behavior in Exercise 1 does not make sense. The resulting value of i should have no bearing on the exit code. If the addition succeeded, the expression should return 0 (success). I

Re: failed grep should cause subshell to exit

2013-08-26 Thread Chris Down
On 2013-08-27 03:48, Chris Down wrote: > It does -- like Andreas said, it just makes it immune to `set -e'. > > $ set -e > $ > file > $ ! grep foo file > $ echo $? > 0 Or, perhaps more closely matching your case: $ set -e $ echo foo > file $ ! grep foo file fo

Re: failed grep should cause subshell to exit

2013-08-26 Thread Chris Down
On 2013-08-26 21:41, David Lehmann wrote: > I expected the '!' to reverse the exit code, such that if the grep return 0 > (success), the expression would return 1 (failure); if the grep returned > non-zero (failure), the expression would return 0 (success). i.e. I > expected the '!' to behave lik

Re: i++ cause bad return code when result is 1

2013-08-26 Thread Chris Down
On 2013-08-26 21:36, David Lehmann wrote: > My issue is that the resulting behavior in Exercise 1 does not make sense. > > The resulting value of i should have no bearing on the exit code. If the > addition succeeded, the expression should return 0 (success). If i was not > an integer (e.g. i=he

Re: failed grep should cause subshell to exit

2013-08-26 Thread David Lehmann
Andreas, I expected the '!' to reverse the exit code, such that if the grep return 0 (success), the expression would return 1 (failure); if the grep returned non-zero (failure), the expression would return 0 (success). i.e. I expected the '!' to behave like it does in C. -David On Mon, Aug

Re: i++ cause bad return code when result is 1

2013-08-26 Thread David Lehmann
My issue is that the resulting behavior in Exercise 1 does not make sense. The resulting value of i should have no bearing on the exit code. If the addition succeeded, the expression should return 0 (success). If i was not an integer (e.g. i=hello), then I expect (( i++ )) to return a non-zero e

Re: Bash-4.3-beta: compgen -f

2013-08-26 Thread Chet Ramey
On 8/26/13 2:07 PM, Andreas Schwab wrote: > $ bash -c 'compgen -f' > Segmentation fault Thanks for the report and fix. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://c

Bash-4.3-beta: compgen -f

2013-08-26 Thread Andreas Schwab
$ bash -c 'compgen -f' Segmentation fault diff --git a/pcomplete.c b/pcomplete.c index 6b4e033..a3327ed 100644 --- a/pcomplete.c +++ b/pcomplete.c @@ -744,7 +744,8 @@ pcomp_filename_completion_function (text, state) (rl_completion_found_quote == 0). */ iscompgen = this_shell_builti