วันจันทร์ที่ 17 มีนาคม พ.ศ. 2557

How to make korn shell call privious command line by Up Arrow

If you have used Ubuntu's Terminal, we can use Up Arrow to call previous command and then edit the command to execute again.

Today, I working on remote session with ksh and I have a problem to call previous command, I don't want to use command "history" and select history command by copy & paste to execute again.

How to use Up Arrow on keyboard to call previous command line and make editable?

After googling

I found how to solve it!!!

Step 1: Open Configuration files for your shell.
vi .profile
 Step 2: Add following commands at the button of the file.
set -o emacs
alias __A=$(print '\0020') # ^P = up = previous command
alias __B=$(print '\0016') # ^N = down = next command
alias __C=$(print '\0006') # ^F = right = forward a character
alias __D=$(print '\0002') # ^B = left = back a character
alias __H=$(print '\0001') # ^A = home = beginning of line
Step 3: reloading configuration file
 . .profile
Thanks unix.com