AIX - 默认shell - 箭头键

时间:2016-08-12 09:23:43

标签: linux terminal aix

我正在使用AIX机器。我有一个担忧。我使用MobaXterm访问AIX服务器。我期望向上箭头键给我先前发出的命令。相反,它只是在某些编辑器中上升。使用向下箭头键可以观察到相同的行为。我怎样才能摆脱这种行为?

shell是ksh。

感谢。

2 个答案:

答案 0 :(得分:1)

终端发送普通模式光标键时,您会看到这种行为。 ksh可能正在寻找应用程序模式密钥,或者(更有可能)没有被告知如何处理这个问题。你可以使用

让它工作
set -o emacs

但可能还需要建立密钥绑定(在第一个链接中找到):

#
# The ksh has an undocumented way of binding the arrow keys to the emacs
# line editing commands. In your .kshrc or in your .profile, add:

alias __A=`echo "\020"` # up arrow = ^p = back a command
alias __B=`echo "\016"` # down arrow = ^n = down a command
alias __C=`echo "\006"` # right arrow = ^f = forward a character
alias __D=`echo "\002"` # left arrow = ^b = back a character
alias __H=`echo "\001"` # home = ^a = start of line

# Type "set -o emacs" or put this line in your .profile.
set -o emacs

在快速检查中,这适用于我,使用普通模式键。

进一步阅读:

答案 1 :(得分:0)

  1. $SHELL是检查您正在运行的shell类型的正确变量。 shell脚本中使用$1来检索传递给该脚本的第一个参数。我不知道为什么打印sh是诚实的。