next up previous contents
Next: Korn shell variables Up: Shell Programming Previous: C shell definitions

Korn shell

Korn shell is a higher level shell. Korn shell is Bourne compatible with C shell features. The following notes are derived from The Korn Shell User and Programming Manual by Anatole Olczak published by Addison-Wesley. Korn shell will be denoted in the following sections also either as ksh or Ksh.

A ksh command is a sequence of words separated by spaces, the first word is the command name, the following ones are the command arguments. The command value is its exit status that is 200 + signal (octal) in case of abnormal termination. The exist status of a pipeline is the value of the last command.

Ksh enables tilde substitution as described in C shell. Note that a tilde ~ followed by + is replaced by $PWD and followed by - is replaced by $OLDPWD

In ksh, as well as in any other shell, the system needs a set of global informations in the form of name-value lists. System required names or identifiers are set at login and are known globally via the export mechanism. Exported identifiers form the working environment of the shell. Example of required identifiers are PATH that defines the command search path and TERM that defines the terminal type for correct processing of characters such as special keys. Environment identifiers are usually divided into 2 different groups depending on login level setting. The basic identifiers have usually uppercase names and are inquired by the env command. The user may assign and reassign any identifiers using the export or typeset -x commands. When the value of an exported identifier is changed, ksh exports it automatically. This feature is not supported by Bourne shell.

Ksh stores commands in a history file or buffer up to HISTSIZE commands. If the HISTFILE variable is not set, file $HOME/.sh_history is used. The history file is manipulated by the fc command. The editor is used according to variable FCEDIT, default /usr/bin/ed. Editing may be handled by vi or emacs depending on user customization. For more informations on ksh editing check man ksh.



 
next up previous contents
Next: Korn shell variables Up: Shell Programming Previous: C shell definitions
Marisa Luvisetto
2001-02-05