Inconsistent output in terminal emulator

2009-08-21 Thread nico raffo
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

'set -e' and 'trap 0' togheter does not work as expected on syntax errors

2009-08-21 Thread Stefano Lattarini
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 won't let me bind \C-w

2009-08-21 Thread Dieter Holkenpolk
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.

bug with 'set -e' + 'trap 0' + syntax error

2009-08-21 Thread Stefano Lattarini
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

Re: bug with 'set -e' + 'trap 0' + syntax error

2009-08-21 Thread Marc Herbert
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

Re: bug with 'set -e' + 'trap 0' + syntax error

2009-08-21 Thread Stefano Lattarini
> 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

Re: bash won't let me bind \C-w

2009-08-21 Thread Chet Ramey
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

Re: 'set -e' and 'trap 0' togheter does not work as expected on syntax errors

2009-08-21 Thread Chet Ramey
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