UNIX / Configure the KSH Shell

Home | UNIX | Practical

Configure the KSH Shell

KSH common : pbraun.nethence.com/doc/shells/ksh.html
KSH93 : pbraun.nethence.com/doc/shells/ksh93.html
KSH88 : pbraun.nethence.com/doc/shells/ksh88.html
PDKSH : pbraun.nethence.com/doc/shells/pdksh.html
KSH programming : pbraun.nethence.com/doc/devel/ksh.html


Which KSH version
KSH is a POSIX-compliant shell (IEEE POSIX 1003.2). Different versions are used,
- HP/UX : KSH88 in base system
- AIX : KSH88 (/bin/ksh) and ksh93 (/bin/ksh93). KSH88 recommended
- NetBSD : PDKSH in base system
- OpenBSD : PDKSH in base system
- FreeBSD : PDKSH in ports
- Solaris 10 : modified KSH93, it seems
- Mac OS X : ksh93 in darwinports

Define your ksh version,
set -o emacs
^V
on the ksh prompt, you should get in example,
- Redhat RHEL5 : Version M 1993-12-28 r
- Redhat RHEL4 : PD KSH v5.2.14 99/07/13.2
- HP/UX 11.00 : Version 11/16/88
- HP/UX 11.23 : Version M-11/16/88f


Emacs mode
In emacs mode, directory and filename completion works already,
ESC ESC
but we will see how to configure the TAB keyboard binding.
Some other common keybindings,
^E  # End of line
^A  # Beginning of line. Use ^Aa inside screen
^U  # Clear line
^H  # Backspace
^B  # Character back
^F  # Character forward
Note. when you got a freaked up shell you can always reset it by doing,
reset


Configuration
Note ~/.profile is read first, before ~/.kshrc
You can define an alternate kshrc by setting this inside your profile,
ENV=~/altkshrc; export ENV


References
gilb's EXINIT : pagesperso-orange.fr/bsdcow/netbsd/profile
dir management : blogs.sun.com/nico/entry/ksh_functions_galore
any file exists in dir ? : www.generation-nt.com/reponses/savoir-si-un-repertoire-contient-au-moins-un-fichier-ksh-sun-entraide-172896.html
solaris & backups examples : home.comcast.net/~dwm042/scripts.htm (syncit, root, solaris TCP tweak)
Oreilly : www.unix.com.ua/orelly/unix/ksh/ch01_04.htm



Sat Nov 8 12:19:48 CET 2008
       © 2008 Pierre-Philipp Braun