0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.