How to make HP-UX Korn shell similar to Linux Bash
Working as Oracle DBA on HP-UX and Linux both I prefer Bash shell which is available on Linux compared to Korn shell which is default shell on HP-UX. It’s more convenient to work on Linux Bash using handy key combinations, etc. Unfortunately Bash is not installed on HP-UX by default and also not officially supported there – you will not get help from HP support if problems with it arise.
Nevertheless, I could find a way of improving environment settings on HP-UX to make the backspace and some other keys work similar to Linux and Bash shell. See below my usual .profile file on HP-UX.
If somebody has more useful tips on environment settings or key combinations on HP-UX, feel free to comment.
stty kill "^U" intr "^C" erase "^?" eof "^D" susp "^Z" dsusp "^Y" \
hupcl ixon ixoff cs8 -istrip
EDITOR=vi ; export EDITOR
# Enable usage of arrow keys in command line
# If not set, use (Esc-K/Esc-J for command repeat)
set -o emacs
alias __A=`echo "\020"` # up arrow = back a command
alias __B=`echo "\016"` # down arrow = down a command
alias __C=`echo "\006"` # right arrow = forward a character
alias __D=`echo "\002"` # left arrow = back a character
alias __H=`echo "\001"` # home = start of line; work with Putty -> Function Keys=SCO
alias __Q=`echo "\005"` # end = end of line - does not work for me
# Some sets for vi & avoid exit on Ctrl-d
set -o ignoreeof
Some other key combinations I use:
- Esc-H – Remove a line