how can I redefine the interrupt signal to Escape or Delete key?

1

I've googled for it but failed to found an answer. I would like to remap my interrupt signal key from ^C to or Delete, what would be the code for it? For example:

stty intr "ESC code"

And back:

stty intr ^C

719016

Posted 2011-07-14T09:02:57.713

Reputation: 2 899

1maybe Delete would be better than Escape? – 719016 – 2011-07-14T09:48:06.457

Indeed avilella – A Dwarf – 2011-07-14T10:33:16.003

See this SuperUser question for the questioner's real problem, which is to do with using the ping command against multiple hosts.

– JdeBP – 2011-07-15T14:48:12.393

Answers

2

You don't want to do this. The character sequence generated by Esc is also used by the extended keys on the keyboard, so each keypress will be like pressing CtrlC followed by some random characters.

Ignacio Vazquez-Abrams

Posted 2011-07-14T09:02:57.713

Reputation: 100 516

2

stty intr \033

This works somewhat, but since \033/Escape is used as, well, escape character, it'll break other stuff.

Daniel Beck

Posted 2011-07-14T09:02:57.713

Reputation: 98 421

maybe Delete would be better than Escape? – 719016 – 2011-07-14T09:48:18.703

Maybe not. It would drive you nuts editing the command line! – Andy Lee Robinson – 2011-07-27T15:37:04.587