[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with option -e, compound commands, and pipelines
From: |
Jan Beulich |
Subject: |
problem with option -e, compound commands, and pipelines |
Date: |
Fri, 03 Jun 2005 06:41:46 -0600 |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I/home/jbeulich/cpp/bash/3.0.16
-I/home/jbeulich/cpp/bash/3.0.16/include -I/home/jbeulich/cpp/bash/3.0.16/lib
-g -O2
uname output: Linux dus-dev-sl90 2.6.5-7.179-mpdbg #131 SMP Wed Jun 1 10:26:21
CEST 2005 i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Description:
With the below script, I would expect that either none or all of the cases allow
reaching the end of the script (i.e. the final echo statement); cases 1, 2, and
4
fall through (with $? being 1), while cases 0 and 3 don't (as I expected).
Whether execution should fall through depends, as I understand it, in how one
reads that specification: If, like the specification says, indeed only simple
commands are influenced by -e, then all cases should reach the end. This
however doesn't seem to make much sense, and hence I'd rather interpret
the spec text a little less strict (allowing -e to apply to all commands),
resulting
in the need for all cases to terminate early (as btw. ash and zsh do).
Repeat-By:
*****script begin*****
#!/bin/bash -ex
case "$1" in
0)
true | false
;;
1)
true | { false; }
;;
2)
true | ( false )
;;
3)
while true
do
false
done
;;
4)
true | while true
do
false
done
;;
esac
echo "Result=$?"
*****script end*****
Jan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- problem with option -e, compound commands, and pipelines,
Jan Beulich <=