ksh93s - Shell, the standard command language interpreter


ksh93s [ options ] [arg ...]


ksh93s is a command language interpreter that executes commands read from a command line string, the standard input, or a specified file.

If the -i option is present, or there are no args and the standard input and standard error are attached to a terminal, the shell is considered to be interactive.

The -s and -c options are mutually exclusive. If the -c option is specified, the first arg is the command-line string and must be specified. Any remaining args will be used to initialize $0 and positional parameters.

If the neither -s nor -c is specified, then the first arg will be the pathname of the file containing commands and $0 will be set to this value. If there is no file with this pathname, and this pathame does not contain a /, then the PATH will be searched for an executable with this name. Any remaining args will be used to initialize the positional parmaeters.

Any option can use a + instead of a - to disable the corresponding option.


Read the commands from the first arg.
Specifies that the shell is interactive.
Invoke the shell as a login shell; /etc/profile and $HOME/.profile, if they exist, are read before the first command.
Invoke the shell in a restricted mode. A restricted shell does not permit any of the following:
Changing the working directory.
Setting values or attributes of the variables SHELL, ENV, FPATH, or PATH.
Executing any command whose name as a / in it.
Redirecting output of a command with >, >|, <>, or >>.
Adding or deleting built-in commands or libraries with builtin.
Executing command -p ... .
Read the commands from standard input. The positional parameters will be initialized from arg.
Do not execute the script, but output the set of double quoted strings preceded by a $. These strings are needed for localization of the script to different locales.
Reads the file ${ENV-$HOME/.kshrc}, if it exists, as a profile. On by default for interactive shells; use +E to disable.
-R file

Do not execute the script, but create a cross reference database in file that can be used a separate shell script browser. The -R option requires a script to be specified as the first operand.
Set the export attribute for each variable whose name does not contain a . that you assign a value in the current shell environment.
The shell writes a message to standard error as soon it detects that a background job completes rather than waiting until the next prompt.
A simple command that has an non-zero exit status will cause the shell to exit unless the simple command is:
contained in an && or || list.
the command immediately following if, while, or until.
contained in the pipeline following !.
Pathname expansion is disabled.
Obsolete. Causes each command whose name has the syntax of an alias to become a tracked aliase when it is first encountered.
This is obsolete. All arguments of the form name=value are removed and placed in the variable assignment list for the command. Ordinarily, variable assignments must precede command arguments.
When enabled, the shell runs background jobs in a separate process group and displays a line upon completion. This mode is enabled by default for interactive shells on systems that support job control.
The shell reads commands and checks for syntax errors, but does not execute the command. Usually specified on command invocation.

If option is not specified, the list of options and their current settings will be written to standard output. When invoked with a + the options will be written in a format that can be reinput to the shell to restore the settings. This option can be repeated to enable/disable multiple options. The value of option must be one of the following:

Equivalent to -a.

Runs background jobs at lower priorities.

Equivalent to -B.

Enables/disables emacs editing mode.

Equivalent to -e.

Equivalent to -G.

Enables/disables gmacs editing mode. gmacs editing mode is the same as emacs editing mode except for the handling of ^T.

Equivalent to -H.

Prevents an interactive shell from exiting on reading an end-of-file.

Equivalent to -k.

A trailing / is appended to directories resulting from pathname expansion.

Equivalent to -m.

Use multiple lines when editing lines that are longer than the window width.

Equivalent to -C.

Equivalent to -n.

Equivalent to -f.

This has no effect. It is provided for backward compatibility.

Equivalent to -b.

Equivalent to -u.

A pipeline will not complete until all components of the pipeline have completed, and the exit status of the pipeline will be the value of the last command to exit with non-zero exit status, or will be zero if all commands return zero exit status.

Equivalent to -p.

Simple commands preceded by a ; will be traced as if -x were enabled but not executed.

Equivalent to -h.

Equivalent to -v.
Enables/disables vi editing mode.

Does not use canonical input mode when using vi edit mode.

Equivalent to -x.
The option value may be omitted.
Privileged mode. Disabling -p sets the effective user id to the real user id, and the effective group id to the real group id. Enabling -p restores the effective user and group ids to their values when the shell was invoked. The -p option is on whenever the real and effective user id is not equal or the real and effective group id is not equal. User profiles are not processed when -p is enabled.
restricted. Enables restricted shell. This option cannot be unset once enabled.
Obsolete. The shell reads one command and then exits.
If enabled, the shell displays an error message when it tries to expand a variable that is unset.
Verbose. The shell displays its input onto standard error as it reads it.
Execution trace. The shell will display each command after all expansion and before execution preceded by the expanded value of the PS4 parameter.
Enable {...} group expansion. On by default.
Prevents existing regular files from being overwritten using the > redirection operator. The >| redirection overrides this noclobber option.
Causes ** by itself to also match all sub-directories during pathname expansion.
Enable !-style history expansion similar to csh.
-T mask

Enable implementation specific test code defined by mask.


If ksh93s executes command, the exit status will be that of the last command executed. Otherwise, it will be one of the following:
The script or command line to be executed consists entirely of zero or more blank lines or comments.

A noninteractive shell detected a syntax error, a variable assignment error, or an error in a special built-in.
-c and -s were not specified and the command script was found on PATH but was not executable.
-c and -s were not specified and the command script corresponding to arg could not be found.


set(1), builtin(1)



sh (AT&T Research) 93s1 2008-05-07

David Korn <dgkorn@gmail.com>

Copyright © 1982-2012 AT&T Intellectual Property