Hi,
I'm writing a simple terminal emulator (on linux using standard pty
libraries) and have run across some behavior in bash that I cannot
explain after several weeks of reading documentation.
When I run a different shell, say zsh, it behaves the way I expect an
interactive shell would. As charac
I have the following scripts:
$ cat nobug.sh
trap 'e=$?; [ $e -gt 0 ] && echo "OK" || echo "BAD"; exit $e' 0
# syntax error here
&& true
$ cat bug.sh
set -e
trap 'e=$?; [ $e -gt 0 ] && echo "OK" || echo "BAD"; exit $e' 0
# syntax error here
&& true
I thought that when bash detect a syn
bash-4.0$ a () { bind '"\C-w": unix-filename-rubout'; }
bash-4.0$ b () { bind -p | grep 'unix.*rubout'; }
bash-4.0$ a; b
"\C-w": unix-filename-rubout
# unix-word-rubout (not bound)
bash-4.0$ b
# unix-filename-rubout (not bound)
"\C-w": unix-word-rubout
bash-4.0$
Same in bash-3.2.
I have the following scripts:
$ cat nobug.sh
trap 'e=$?; [ $e -gt 0 ] && echo "OK" || echo "BAD"; exit $e' 0
# syntax error here
&& true
$ cat bug.sh
set -e
trap 'e=$?; [ $e -gt 0 ] && echo "OK" || echo "BAD"; exit $e' 0
# syntax error here
&& true
I thought that when bash detect a syn
Stefano Lattarini a écrit :
> I thought that when bash detect a syntax errors in a script,
> it would pass a $? != 0 to the code in the exit trap, regardless
> of whether `set -e' is active or not.
>
> I think this can be classified as a bug in bash (in some
> situations, a very nasty one). Plea
> Stefano Lattarini a écrit :
> > I thought that when bash detect a syntax errors in a script,
> > it would pass a $? != 0 to the code in the exit trap, regardless
> > of whether `set -e' is active or not.
> >
> > [CUT]
> >
> > I think this can be classified as a bug in bash (in some
> > situations
Dieter Holkenpolk wrote:
> bash-4.0$ a () { bind '"\C-w": unix-filename-rubout'; }
> bash-4.0$ b () { bind -p | grep 'unix.*rubout'; }
> bash-4.0$ a; b
> "\C-w": unix-filename-rubout
> # unix-word-rubout (not bound)
> bash-4.0$ b
> # unix-filename-rubout (not bound)
> "\C-w": unix-word-rubout
> bas
Stefano Lattarini wrote:
> I have the following scripts:
>
> $ cat nobug.sh
> trap 'e=$?; [ $e -gt 0 ] && echo "OK" || echo "BAD"; exit $e' 0
> # syntax error here
> && true
>
> $ cat bug.sh
> set -e
> trap 'e=$?; [ $e -gt 0 ] && echo "OK" || echo "BAD"; exit $e' 0
> # syntax error here