Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a process in bash that I can call to stop using Ctrl+C. As far as I can see, this equals to sending an exit(1) signal. I would like to loop through these processes for a list of different input files by typing the Escape key instead of Ctrl+C over and over. Here I am using ping on a list of URLs just as an example:

cat /tmp/file

How can I loop over the list and skip to the next by typing Escape instead of Ctrl+C?

cat /tmp/file | while read i; do ping $i; done
share|improve this question
up vote 2 down vote accepted

You can use stty to set the interrupt character.

stty intr q

Will set the interrupt character to your 'q' key. (I'm sorry, I'm not sure about the ESC code at this time). To set it back to CTRL+C, do:

stty intr ^C
share|improve this answer
Thx. I've asked for the Esc code in another question.… – 719016 Jul 14 '11 at 9:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.