Documentation issue: Increments in brace expansion

2009-10-30 Thread Jan Schampera
Good morning,

http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion

The brace expansion increment syntax is shown wrong.

OLD:

A sequence expression takes the form {x..y[incr]}, where x and y are
either integers or single characters, and incr, an optional increment,
is an integer.


PROPOSED NEW:

A sequence expression takes the form {x..y[..incr]}, where x and y are
either integers or single characters, and incr, an optional increment,
is an integer separated by `..'.




Sorry if this already is fixed in the base documents, I didn't have time
to check deeply.

Jan




Re: Documentation issue: Increments in brace expansion

2009-10-30 Thread Chet Ramey
Jan Schampera wrote:
 Good morning,
 
 http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion
 
 The brace expansion increment syntax is shown wrong.
 
 OLD:
 
 A sequence expression takes the form {x..y[incr]}, where x and y are
 either integers or single characters, and incr, an optional increment,
 is an integer.
 
 
 PROPOSED NEW:
 
 A sequence expression takes the form {x..y[..incr]}, where x and y are
 either integers or single characters, and incr, an optional increment,
 is an integer separated by `..'.
 
 
 
 
 Sorry if this already is fixed in the base documents, I didn't have time
 to check deeply.

It is already fixed.  Thanks for the catch.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: Issues with set -e and subshell

2009-10-30 Thread Chet Ramey
Mario TRENTINI wrote:

 Bash Version: 3.2
 Patch Level: 39
 Release Status: release
 
 Description: Using set -e with subshell gives unexpected results
 
 Repeat-By:
 
 Hello,
 
 First issue :
 
 # The following works fine : end is displayed
 ( set -e ; echo Start ; false ; echo end )
 
 # The following works in a different way : end is not displayed
 ( set -e ; echo Start ; false ; echo end ) || echo ERROR
 
 # note that Bash 4 has the same behavior
 # (GNU bash, version 4.0.28(1)-release)
 
 Is it a bug or the expected behavior, if it is a bug, is there a workaround ?

It is expected behavior.  The presence of || cancels set -e for the
command preceding the ||.

There are always workarounds.  You don't have to rely on set -e; you can
structure your code so that you manually check the exit status.

 Second issue :
 
 # I expect the following to not display status but to exit the shell :
 set -e ; ( exit 1 ) ; echo status $?
 
 # I observed the expected behavior on Bash 4.
 
 Is there a way for Bash 3 to have the same behavior as Bash 4 ?

Not using `set -e'.  That's the essential substance of the bash-3.x-
bash-4.x change: the commands whose failure cause the shell to exit
were expanded from simple commands to nearly every command, including
pipelines and compound commands.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/