Reputation: 715
How can I read input within the command bound to a key?
I've tried:
bind -x '"\C-b":read x'
After Control-b hitted, bash hangs.
Upvotes: 0
Views: 63
Reputation: 531095
bind -x
isn't designed to run interactive commands; it should only be used to run commands that produce output, then exit back to the shell. Also, read x
would be executed in a subshell invoked by readline
, so whatever value you input to set x
would be lost when the subshell exits.
Upvotes: 1