Re: nullglob breaks unset of arrays

2008-09-25 Thread Mario TRENTINI

Hi Chet

thanks for your answer, I understand then that
unset "my_array[0]"
works and therefore quoting the argument is the proper way for using
unset.

Regards

Mario


On Wed, Sep 24, 2008 at 11:41:56PM -0400, Chet Ramey wrote:
> [EMAIL PROTECTED] wrote:
> 
> > Bash Version: 3.2
> > Patch Level: 39
> > Release Status: release
> > 
> > Description:
> > When nullglob option is enable (shopt -s nullglob), unset of an array
> > does not work.
> 
> You're right; it does.  `unset' is a builtin, so all of the shell's word
> expansions are performed before it is run, including globbing.  If you
> don't protect the argument by quoting it, the nullglob extension will
> remove it when there are no matching filenames.  Running the script with
> `bash -x' will show what's happening.
> 
> There's no `fix' -- everything is working as it's supposed to.  You've
> just combined things in a way that produces unexpected results.
> 
> Chet
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> 
> Chet Ramey, ITS, CWRU[EMAIL PROTECTED]
> http://cnswww.cns.cwru.edu/~chet/




Issues with set -e and subshell

2009-10-29 Thread Mario TRENTINI

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -  
DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -  
DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -
DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux touchndie 2.6.18v1 #1 SMP Thu Sep 21 10:01:41 CEST 2006 
i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

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 ?

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 ?

Thanks in advance.

Best regards

Mario