Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Linda Walsh
Maarten Billemont wrote: On 08 Apr 2012, at 21:30, Chet Ramey wrote: On 4/8/12 3:02 PM, Maarten Billemont wrote: Any particular reason for not removing old undocumented functionality, or is that mostly the nature of this beast - dragging along and maintaining ancient code for the sake of

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Aharon Robbins
In article , Linda Walsh wrote: >>> Because, as Linda discovered, there is still working code out there using >>> it. Maybe we'll get to a point where it's all gone, but we're not there >>> yet. >> >> IMO, the working code out there that relies on $[...] either runs on >>older versions of bash.

Exit status of "if" statement?

2012-04-09 Thread Dan Stromberg
What should be the behavior of the following? if cmd1 then cmd2 fi && if cmd3 then cmd4 fi I've not joined two if's with a short-circuit boolean before, but I'm suddenly working on a script where someone else has. Playing around, it appears that cmd1 and cmd3 have no direct impact on the

Re: Exit status of "if" statement?

2012-04-09 Thread Pierre Gaston
On Mon, Apr 9, 2012 at 8:31 PM, Dan Stromberg wrote: > > What should be the behavior of the following? > > if cmd1 > then >    cmd2 > fi && if cmd3 > then >   cmd4 > fi > > I've not joined two if's with a short-circuit boolean before, but I'm > suddenly working on a script where someone else has.

Re: Exit status of "if" statement?

2012-04-09 Thread DJ Mills
On Mon, Apr 9, 2012 at 1:40 PM, Pierre Gaston wrote: > On Mon, Apr 9, 2012 at 8:31 PM, Dan Stromberg wrote: >> >> What should be the behavior of the following? >> >> if cmd1 >> then >>    cmd2 >> fi && if cmd3 >> then >>   cmd4 >> fi >> >> I've not joined two if's with a short-circuit boolean bef

Re: Exit status of "if" statement?

2012-04-09 Thread DJ Mills
On Mon, Apr 9, 2012 at 1:31 PM, Dan Stromberg wrote: > > What should be the behavior of the following? > > if cmd1 > then >    cmd2 > fi && if cmd3 > then >   cmd4 > fi > > I've not joined two if's with a short-circuit boolean before, but I'm > suddenly working on a script where someone else has.

Re: Exit status of "if" statement?

2012-04-09 Thread Janis Papanagnou
On 09.04.2012 19:31, Dan Stromberg wrote: > > What should be the behavior of the following? > > if cmd1 > then > cmd2 > fi && if cmd3 > then >cmd4 > fi If cmd1 is true then execute cmd2; cmd2 defines the exit code for the first if depending on cmd2 return value, if true then the subs

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Linda Walsh
Maarten Billemont wrote: Any particular reason for not removing old undocumented functionality, or is that mostly the nature of this beast - dragging along and maintaining ancient code for the sake of compatibility? So 'yesturday' is "ancient" for you?... that's really means somet

Re: Exit status of "if" statement?

2012-04-09 Thread bsh
Janis Papanagnou wrote: > Dan Stromberg wrote: > > What should be the behavior of the following? > > if cmd1 > > then > >     cmd2 > > fi && if cmd3 > > then > >    cmd4 > > fi Hello Daniel and Janis! > If cmd1 is true then execute cmd2; >   cmd2 defines the exit code for the first if > dependin

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Chet Ramey
On 4/9/12 9:07 PM, Linda Walsh wrote: > > > Maarten Billemont wrote: > >> Any particular reason for not removing old undocumented functionality, >> or is that mostly the nature of this beast - dragging along and maintaining >> ancient code for the sake of compatibility? > > So 'yesturday' is "

Re: Exit status of "if" statement?

2012-04-09 Thread dethrophes
If false; then echo jj fi always has to return 0 otherwise a lot of code using ERREXIT/ERRTRACE would break. if you want to handle an error case you should use elif or else your example could be written like this if cmd1 then cmd2 elif cmd3 then cmd4 fi or possibly like this if cmd1

Re: semicolon at beginning of line

2012-04-09 Thread Elliott Forney
Sure, a comment can be used to place a line in your history but that doesn't really address the examples I had. Just seems to me like a lone semicolon could be treated as a newline/noop. I can't seem to think of anything that this would break but, of course, that doesn't mean it wouldn't. The en

Re: semicolon at beginning of line

2012-04-09 Thread Elliott Forney
Here is another example that appears to defy my expectations. In this case, the semicolon is allowed: sine:~$ hello='echo hello' sine:~$ world='echo world' sine:~$ ${hello};${world} hello world sine:~$ unset hello sine:~$ ${hello};${world} world sine:~$ unset world sine:~$ ${hello};${world} Than

Thanks!

2012-04-09 Thread Elliott Forney
Also, I just wanted to send out a thanks to Chet Ramey and everyone else that has contributed to bash. I am a bash junkie and use it every day. Not only is bash my primary interactive shell, it is also the scripting language that I write many of my programs in... and it glues together many of the

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Elliott Forney
My two cents, would be to add a bit to the man page that says something like: --- For historical reasons, the following format is also supported for arithmetic evaluation: $[expression] Note, however, that this format is non-standard and that $((expression)) is preferred. --- At least t

Re: Exit status of "if" statement?

2012-04-09 Thread Barry Margolin
In article , bsh wrote: > Janis Papanagnou wrote: > > Dan Stromberg wrote: > > > What should be the behavior of the following? > > > if cmd1 > > > then > > >     cmd2 > > > fi && if cmd3 > > > then > > >    cmd4 > > > fi > > Hello Daniel and Janis! > > > If cmd1 is true then execute cmd2; >