bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trap DEBUG failure after Ctrl-C pressed


From: Chih-Chieh Chou
Subject: trap DEBUG failure after Ctrl-C pressed
Date: Thu, 29 Jan 2015 22:51:37 -0800

# 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]