libreadline - Bash and readline: how to bind key to a "silent command" of my own in bash? -
what want simple: add keybinding 1 of program using readline startup file inputrc but, in addition, program not produce output, not want command name appear on stdout.
what problem is:
.inputrc content:
"\e[1;5a":'pipe_send\n'
when hit ctrl+uparrow, on command line appears "pipe_send":
[ alexkag@$$$$$:: / ] $ pipe_send
what i'd not having pipe_send
appear on command line, commands provided readline such history-search-backward, history-search-forward, etc. know way that? maybe shoudn't use readline? note: keybinding must visible in bash, not whole system.
as mentioned in comments gniourf_gniourf solution is:
bind -x '"\e[1;5a":pipe_send'
bind -x
tell bash execute command whenever key pressed:
-x keyseq:shell-command
cause shell-command executed whenever keyseq entered. when shell-command executed, shell sets readline_line variable contents of readline line buffer , readline_point variable current location of insertion point. if executed command changes value of readline_line or readline_point, new values reflected in editing state.
\e[1;5a
terminal code sent ctrlup
Comments
Post a Comment