.bashrc file I'm trying to bind a custom escape-sequence key to a control-sequence.
What I have is:
bind -x '"\eJD0C": "^C"'
And it does not execute the shell control-sequence
^C which cancels the execution of a process.
So is there a way to do this?
Or is it not possible?
If not possible, what alternatives should I look into?
That is not a shell control sequence.
It is a special character, recognized by the line discipline when it is in canonical input mode.
Three things militate against you:
- The line discipline is not in canonical mode when the Bourne Again shell is using the GNU Readline library to read lines of input interactively. It is in non-canonical mode, and all special character recognition by the line discipline is turned off.
- The GNU Readline library is not responsible for input when the Bourne Again shell is doing something other than reading a line of input interactively, and mappings set up for the Readline library are irrelevant at those points. When you enter the special character whilst the shell is waiting for a child process to terminate, this is handled by the line discipline.
- The line discipline can only recognize single characters as special, not sequences of multiple characters that terminals use for encoding editing and function keys. The terminal API for setting special characters only works in terms of single characters.