Methyl -- and anyone else:
It's been a while since I've been here, but I've got something else.
I fooled around with some other scripts and got it to print a message -- are you getting it to display the message?
Here's a script that I did today:
Quote:
trap "echo 'You interrupted me.' " SIGINT
let x=0
while true; do
echo $x
let x=x+1
done
It works fine -- the numbers zip by and get larger and larger. If I hit control - c I can see the message -- it's only a flash. If I put sleep 10 in the script after the echo command,and hit control-c, all I get is ^C displayed on the screen, but no message. I'm wondering if the message is displayed briefly, but so quickly that I can't see it. Am I not typing the command correctly and not noticing it, maybe?
If i try this script
Quote:
trap "echo 'You interrupted me.' " SIGINT
while true; do
echo enter a number
read x
echo $x
done
It works fine. The message is displayed:
Quote:
enter a number
ths
ths
enter a number
^CYou interrupted me.
I think it has something to do with the sleep command, but I can't figure out why. Do you have any ideas?