我正在使用bash 4.3.11(1)并安装了以下历史记录插件(通过.bash_it):
# enter a few characters and press UpArrow/DownArrow
# to search backwards/forwards through the history
bind '"^[[A":history-search-backward'
bind '"^[[B":history-search-forward'
当我登录到交互式会话时,一切都很好,但是当我通过ssh host 'ls -als'
例如运行远程命令时,会看到以下输出:
: ssh host 'ls -als'
/home/ubuntu/.bash_it/plugins/enabled/history.plugin.bash: line 3: bind: warning: line editing not enabled
/home/ubuntu/.bash_it/plugins/enabled/history.plugin.bash: line 4: bind: warning: line editing not enabled
当我echo -e '\0033\0143'
在每次绑定调用之后用修改历史记录插件时,不再收到警告,但控制台已清除。这不是一个很大的缺点,但是很高兴知道一种更清晰的方法来抑制远程命令。
# Works, but annoyingly clears console
# enter a few characters and press UpArrow/DownArrow
# to search backwards/forwards through the history
bind '"^[[A":history-search-backward'
echo -e '\0033\0143'
bind '"^[[B":history-search-forward'
echo -e '\0033\0143'