ksh93 Command

Purpose

Invokes the Enhanced Korn shell.

Syntax

ksh93 [ + | - a b c C e f h i k m n o p r s t u v x BDP ] [+-R file] [ +-o Option ] [arg...].

Note: Preceding a flag with + (plus) rather than - (minus) turns off the flag.

Description

The ksh93 command invokes the Enhanced Korn shell, which is an interactive command interpreter and a command programming language. The shell carries out commands either interactively from a terminal keyboard or from a file.

The Enhanced Korn shell has additional features that are not available in the default Korn shell.

Note: The ksh93 built-in wait behaves in a manner similar to the parent wait subroutine.

Flags

Item Description
-B Enables brace pattern field generation, and brace group expansion. This is set by default.
-D Does not execute the script, but results in the set of output strings in double quotation marks preceded by $. These strings are needed for localization of the script in different languages.
-P If the -P or -o profiles are present, the shell is called a profile shell.
-a Exports automatically all subsequent parameters that are defined.
-b Job completion messages are printed as soon as a background job changes state rather than waiting for the next prompt.
-c Causes commands to be read from the first argument. The remaining arguments become positional parameters starting from 0.
-C Prevents existing files from getting truncated when redirection > is used. O_EXCL mode is used to create files. Requires >| to truncate a file when -C option is used.
-e If not contained within a || or && command, or following an if while or until command, or in the pipeline following !, executes the ERR trap, if set, and exits if a command has a nonzero exit status. This mode is disabled while reading profiles.
-f Disables file name generation.
-h Designates each command as a tracked alias when first encountered.
Note: The tracked alias feature is now obsolete.
-i Indicates that the shell is interactive. An interactive shell is also indicated if shell input and output are attached to a terminal (as determined by the ioctl subroutine). In this case, the TERM environment variable is ignored (so that the kill 0 command does not kill an interactive shell) and the INTR signal is caught and ignored (so that a wait state can be interrupted). In all cases, the QUIT signal is ignored by the shell.
-k (obsolete) Places all parameter assignment arguments in the environment for a command, not just those arguments that precede the command name.
-m Runs background jobs in a separate process and prints a line upon completion. The exit status of background jobs is reported in a completion message. On systems with job control, this flag is turned on automatically for interactive shells.
-n Reads commands and checks them for syntax errors, but does not execute them. This flag is ignored for interactive shells.
Note: ksh93 -n outputs a warning message for certain syntax. These messages are warnings. Even though these warnings are issued, the execution of the scripts is unaltered. The following are known warning messages:
              `...` obsolete, use $(...).
              -a obsolete, use -e.
              '=' obsolete, use '=='.
              %s within [[...]] obsolete, use ((...)).
              set %s obsolete.
              `{' instead of `in' is obsolete.
              "obsolete -j must be 1 or 2.
-o Option Prints the current option settings and an error message if you do not specify an argument. You can use this flag to enable any of the following options:
allexport
Same as the -a flag.
errexit
Same as the -e flag.
bgnice
Runs all background jobs at a lower priority. This is the default mode.
Braceexpand
Same as the -B flag.
emacs
Enters an emacs-style inline editor for command entry.
gmacs
Enters a gmacs-style inline editor for command entry.
ignoreeof
Does not exit the shell when it encounters an end-of-file character. You must use the exit command, or override the flag and exit the shell by pressing the Ctrl-D key sequence more than 11 times.
interactive
Same as the -i flag.
keyword
Same as the -k flag.
markdirs
Appends a / (slash) to all directory names that are a result of filename substitution.
 
monitor
Same as the -m flag.
multiline
The built-in editor will use multiple lines of the screen that are longer than the width of the screen. This might not work on all terminals.
noclobber
Same as the -C flag.
noexec
Same as the -n flag.
noglob
Same as the -f flag.
nolog
Prevents function definitions from being saved in the history file.
 
notify
Same as the -b flag.
nounset
Same as the -u flag.
pipefail
A pipeline will not complete until all the components of the pipeline are complete. The return value will be that of the last non-zero return value of the last command to fail, or 0 if all return values are 0.
showme
Single commands or pipelines preceded by a ; (semicolon) will be displayed as if the xtrace option were enabled but will not be executed. Otherwise the leading ; (semicolon) will be ignored.
privileged
Same as the -p flag.
 
verbose
Same as the -v flag.
trackall
Same as the -h flag.
vi
Enters the insert mode of a vi-style inline editor for command entry. Entering escape character 033 puts the editor into the move mode. A return sends the line.
viraw
Processes each character as it is typed in vi mode.
xtrace
Same as the -x flag.
You can set more than one option on a single ksh93 command line.
-p Disables processing of the $HOME/.profile file and uses the /etc/suid_profile file instead of the ENV file. This mode is on whenever the effective uid (gid) is not equal to the real uid (gid). Turning this off causes the effective uid and gid to be set to the real uid and gid.
-r Runs a restricted shell. With a restricted shell you cannot:
  • Change the current working directory.
  • Set the value of the SHELL, ENV, or PATH variable.
  • Specify the path name of a command that contains a / (slash).
  • Redirect output of a command with > (right caret), >| (right caret, pipe symbol), <> (left caret, right caret), or >> (two right carets).
Item Description
-R File A cross reference database is generated when the -R File option is used. This can be used to find definitions and references for variables and commands by a separate utility.
-s Causes the ksh93 command to read commands from the standard input. Shell output, except for the output of the special commands, is written to file descriptor 2. This parameter cannot be used with the -c flag or with the File[Parameter] parameter.
-t Exits after reading and executing one command.
-u Treats unset parameters as errors when substituting.
-v Prints shell input lines as they are read.
-x Prints executed commands and their arguments.

Exit Status

Item Description
0 Successful completion.
>0 An error occurred.

Location

/usr/bin/ksh93