# trap 'echo cmd=$BASH_COMMAND' DEBUG
# trap 'echo Ctrl-C pressed' SIGINT
cmd=trap 'echo Ctrl-C pressed' SIGINT
# while [ 1 ]; do
> true
done
cmd=[ 1 ]
cmd=true
cmd=[ 1 ]
cmd=true
...
cmd=[ 1 ]
cmd=true
cmd=[ 1 ]
cmd=true
^CCtrl-C pressed
# whoami
root
# echo $BASH_COMMAND
true
# trap 'echo cmd=$BASH_COMMAND' DEBUG
# whoami
root
# echo $BASH_COMMAND
true
As you can see, it prints out everything I type on the console
before the "while [ 1 ]" thing. After running the infinite loop and
press Ctrl-C, trap DEBUG doesn't work anymore, and echo $BASH_COMMAND
always prints out true. Is it a bash bug? Thanks.