Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个变量 cmd 我想将一个键与该变量的内容绑定
例如:
bind '"\C-h":"$cmd"'
但它不起作用。我能怎么做?
Here you go:
bind -x '"\C-h":READLINE_LINE="$READLINE_LINE""$cmd"; ((READLINE_POINT += ${#cmd}));'
Tested on 4.2, works like a charm. Doesn't work on 3.x though. Hope you enjoy!