0

如果我有一个变量 cmd 我想将一个键与该变量的内容绑定

例如:

bind '"\C-h":"$cmd"'

但它不起作用。我能怎么做?

4

1 回答 1

0

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!

于 2012-04-01T23:11:56.063 回答