0

How to run a using trap function foo () when you press the "ESC" and function foo2 () when pressing "F5" ? Advise anyone? Thank you very much.

Charlie
  • 2,061
  • 4
  • 21
  • 21

1 Answers1

0

Try look:

man bash | less +'/  bind '

EDIT here an interesting link: In bash, how do I bind a function key to a command?

But ESC key should not be bind because it's used as key escape char; to remove ESC bind :

bind -r '\e'

After trying it, it seems there is a bug: http://osdir.com/ml/bug-bash-gnu/2010-07/msg00008.html

Community
  • 1
  • 1
Nahuel Fouilleul
  • 18,726
  • 2
  • 31
  • 36