Make Arrow and delete keys work in KornShell command line

前端 未结 5 2087
猫巷女王i
猫巷女王i 2020-12-13 07:10

I am new to Unix and am using sun solaris (v10 I think). I have my shell set as KornShell (ksh).

I am wondering how to make the arrow keys and delete key work in th

5条回答
  •  盖世英雄少女心
    2020-12-13 07:51

    Since it took me forever to figure out the delete key on my Mac, to get the delete key to work you can add stty erase ^? to your .kshrc file. Instead of typing the actual characters for ^? you can just hit the delete key and it will output ^?. So in combination with Tim's answer my .kshrc file looks like

    set -o emacs
    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
    alias __Y=`echo "\005"`     # end = ^e = end of line
    stty erase                  # prevent command from being echoed
    stty erase ^?               # allow for delete key to work
    

提交回复
热议问题