SH(1)                      POSIX Programmer's Manual                     SH(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       sh -- shell, the standard command language interpreter

SSYYNNOOPPSSIISS
       sh [[-abCefhimnuvx]] [[-o _o_p_t_i_o_n]]... [[+abCefhimnuvx]] [[+o _o_p_t_i_o_n]]...
           [[_c_o_m_m_a_n_d___f_i_l_e [[_a_r_g_u_m_e_n_t...]]]]

       sh -c [[-abCefhimnuvx]] [[-o _o_p_t_i_o_n]]... [[+abCefhimnuvx]] [[+o _o_p_t_i_o_n]]...
           _c_o_m_m_a_n_d___s_t_r_i_n_g [[_c_o_m_m_a_n_d___n_a_m_e [[_a_r_g_u_m_e_n_t...]]]]

       sh -s [[-abCefhimnuvx]] [[-o _o_p_t_i_o_n]]... [[+abCefhimnuvx]] [[+o _o_p_t_i_o_n]]...
           [[_a_r_g_u_m_e_n_t...]]

DDEESSCCRRIIPPTTIIOONN
       The _s_h utility is a command language interpreter that shall execute
       commands read from a command line string, the standard input, or a
       specified file. The application shall ensure that the commands to be
       executed are expressed in the language described in _C_h_a_p_t_e_r _2, _S_h_e_l_l
       _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e.

       Pathname expansion shall not fail due to the size of a file.

       Shell input and output redirections have an implementation-defined
       offset maximum that is established in the open file description.

OOPPTTIIOONNSS
       The _s_h utility shall conform to the Base Definitions volume of
       POSIX.1-2008, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, with an
       extension for support of a leading <plus-sign> (''++'') as noted below.

       The --aa, --bb, --CC, --ee, --ff, --mm, --nn, --oo _o_p_t_i_o_n, --uu, --vv, and --xx options are
       described as part of the _s_e_t utility in _S_e_c_t_i_o_n _2_._1_4, _S_p_e_c_i_a_l _B_u_i_l_t_-_I_n
       _U_t_i_l_i_t_i_e_s.  The option letters derived from the _s_e_t special built-in
       shall also be accepted with a leading <plus-sign> (''++'') instead of a
       leading <hyphen> (meaning the reverse case of the option as described
       in this volume of POSIX.1-2008).

       The following additional options shall be supported:

       --cc        Read commands from the _c_o_m_m_a_n_d___s_t_r_i_n_g operand. Set the value
                 of special parameter 0 (see _S_e_c_t_i_o_n _2_._5_._2, _S_p_e_c_i_a_l
                 _P_a_r_a_m_e_t_e_r_s) from the value of the _c_o_m_m_a_n_d___n_a_m_e operand and
                 the positional parameters ($1, $2, and so on) in sequence
                 from the remaining _a_r_g_u_m_e_n_t operands. No commands shall be
                 read from the standard input.

       --ii        Specify that the shell is _i_n_t_e_r_a_c_t_i_v_e; see below. An
                 implementation may treat specifying the --ii option as an error
                 if the real user ID of the calling process does not equal the
                 effective user ID or if the real group ID does not equal the
                 effective group ID.

       --ss        Read commands from the standard input.

       If there are no operands and the --cc option is not specified, the --ss
       option shall be assumed.

       If the --ii option is present, or if there are no operands and the
       shell's standard input and standard error are attached to a terminal,
       the shell is considered to be _i_n_t_e_r_a_c_t_i_v_e.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       -         A single <hyphen> shall be treated as the first operand and
                 then ignored. If both ''--'' and ""----"" are given as arguments, or
                 if other operands precede the single <hyphen>, the results
                 are undefined.

       _a_r_g_u_m_e_n_t  The positional parameters ($1, $2, and so on) shall be set to
                 _a_r_g_u_m_e_n_t_s, if any.

       _c_o_m_m_a_n_d___f_i_l_e
                 The pathname of a file containing commands. If the pathname
                 contains one or more <slash> characters, the implementation
                 attempts to read that file; the file need not be executable.
                 If the pathname does not contain a <slash> character:

                  *  The implementation shall attempt to read that file from
                     the current working directory; the file need not be
                     executable.

                  *  If the file is not in the current working directory, the
                     implementation may perform a search for an executable
                     file using the value of _P_A_T_H, as described in _S_e_c_t_i_o_n
                     _2_._9_._1_._1, _C_o_m_m_a_n_d _S_e_a_r_c_h _a_n_d _E_x_e_c_u_t_i_o_n.

                 Special parameter 0 (see _S_e_c_t_i_o_n _2_._5_._2, _S_p_e_c_i_a_l _P_a_r_a_m_e_t_e_r_s)
                 shall be set to the value of _c_o_m_m_a_n_d___f_i_l_e.  If _s_h is called
                 using a synopsis form that omits _c_o_m_m_a_n_d___f_i_l_e, special
                 parameter 0 shall be set to the value of the first argument
                 passed to _s_h from its parent (for example, _a_r_g_v[0] for a C
                 program), which is normally a pathname used to execute the _s_h
                 utility.

       _c_o_m_m_a_n_d___n_a_m_e
                 A string assigned to special parameter 0 when executing the
                 commands in _c_o_m_m_a_n_d___s_t_r_i_n_g.  If _c_o_m_m_a_n_d___n_a_m_e is not
                 specified, special parameter 0 shall be set to the value of
                 the first argument passed to _s_h from its parent (for example,
                 _a_r_g_v[0] for a C program), which is normally a pathname used
                 to execute the _s_h utility.

       _c_o_m_m_a_n_d___s_t_r_i_n_g
                 A string that shall be interpreted by the shell as one or
                 more commands, as if the string were the argument to the
                 _s_y_s_t_e_m() function defined in the System Interfaces volume of
                 POSIX.1-2008. If the _c_o_m_m_a_n_d___s_t_r_i_n_g operand is an empty
                 string, _s_h shall exit with a zero exit status.

SSTTDDIINN
       The standard input shall be used only if one of the following is true:

        *  The --ss option is specified.

        *  The --cc option is not specified and no operands are specified.

        *  The script executes one or more commands that require input from
           standard input (such as a _r_e_a_d command that does not redirect its
           input).

       See the INPUT FILES section.

       When the shell is using standard input and it invokes a command that
       also uses standard input, the shell shall ensure that the standard
       input file pointer points directly after the command it has read when
       the command begins execution. It shall not read ahead in such a manner
       that any characters intended to be read by the invoked command are
       consumed by the shell (whether interpreted by the shell or not) or that
       characters that are not read by the invoked command are not seen by the
       shell. When the command expecting to read standard input is started
       asynchronously by an interactive shell, it is unspecified whether
       characters are read by the command or interpreted by the shell.

       If the standard input to _s_h is a FIFO or terminal device and is set to
       non-blocking reads, then _s_h shall enable blocking reads on standard
       input. This shall remain in effect when the command completes.

IINNPPUUTT FFIILLEESS
       The input file shall be a text file, except that line lengths shall be
       unlimited. If the input file is empty or consists solely of blank lines
       or comments, or both, _s_h shall exit with a zero exit status.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _s_h:

       _E_N_V       This variable, when and only when an interactive shell is
                 invoked, shall be subjected to parameter expansion (see
                 _S_e_c_t_i_o_n _2_._6_._2, _P_a_r_a_m_e_t_e_r _E_x_p_a_n_s_i_o_n) by the shell, and the
                 resulting value shall be used as a pathname of a file
                 containing shell commands to execute in the current
                 environment.  The file need not be executable. If the
                 expanded value of _E_N_V is not an absolute pathname, the
                 results are unspecified.  _E_N_V shall be ignored if the real
                 and effective user IDs or real and effective group IDs of the
                 process are different.

       _F_C_E_D_I_T    This variable, when expanded by the shell, shall determine
                 the default value for the --ee _e_d_i_t_o_r option's _e_d_i_t_o_r option-
                 argument. If _F_C_E_D_I_T is null or unset, _e_d shall be used as the
                 editor.

       _H_I_S_T_F_I_L_E  Determine a pathname naming a command history file. If the
                 _H_I_S_T_F_I_L_E variable is not set, the shell may attempt to access
                 or create a file ..sshh__hhiissttoorryy in the directory referred to by
                 the _H_O_M_E environment variable. If the shell cannot obtain
                 both read and write access to, or create, the history file,
                 it shall use an unspecified mechanism that allows the history
                 to operate properly.  (References to history ``file'' in this
                 section shall be understood to mean this unspecified
                 mechanism in such cases.) An implementation may choose to
                 access this variable only when initializing the history file;
                 this initialization shall occur when _f_c or _s_h first attempt
                 to retrieve entries from, or add entries to, the file, as the
                 result of commands issued by the user, the file named by the
                 _E_N_V variable, or implementation-defined system start-up
                 files.  Implementations may choose to disable the history
                 list mechanism for users with appropriate privileges who do
                 not set _H_I_S_T_F_I_L_E; the specific circumstances under which this
                 occurs are implementation-defined. If more than one instance
                 of the shell is using the same history file, it is
                 unspecified how updates to the history file from those shells
                 interact. As entries are deleted from the history file, they
                 shall be deleted oldest first. It is unspecified when history
                 file entries are physically removed from the history file.

       _H_I_S_T_S_I_Z_E  Determine a decimal number representing the limit to the
                 number of previous commands that are accessible. If this
                 variable is unset, an unspecified default greater than or
                 equal to 128 shall be used. The maximum number of commands in
                 the history list is unspecified, but shall be at least 128.
                 An implementation may choose to access this variable only
                 when initializing the history file, as described under
                 _H_I_S_T_F_I_L_E.  Therefore, it is unspecified whether changes made
                 to _H_I_S_T_S_I_Z_E after the history file has been initialized are
                 effective.

       _H_O_M_E      Determine the pathname of the user's home directory. The
                 contents of _H_O_M_E are used in tilde expansion as described in
                 _S_e_c_t_i_o_n _2_._6_._1, _T_i_l_d_e _E_x_p_a_n_s_i_o_n.

       _I_F_S       A string treated as a list of characters that is used for
                 field splitting and to split lines into fields with the _r_e_a_d
                 command.

                 If _I_F_S is not set, it shall behave as normal for an unset
                 variable, except that field splitting by the shell and line
                 splitting by the _r_e_a_d command shall be performed as if the
                 value of _I_F_S is <space><tab><newline>; see _S_e_c_t_i_o_n _2_._6_._5,
                 _F_i_e_l_d _S_p_l_i_t_t_i_n_g.

                 Implementations may ignore the value of _I_F_S in the
                 environment, or the absence of _I_F_S from the environment, at
                 the time the shell is invoked, in which case the shell shall
                 set _I_F_S to <space><tab><newline> when it is invoked.

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2008, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_O_L_L_A_T_E
                 Determine the behavior of range expressions, equivalence
                 classes, and multi-character collating elements within
                 pattern matching.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments and input
                 files), which characters are defined as letters (character
                 class aallpphhaa), and the behavior of character classes within
                 pattern matching.

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _M_A_I_L      Determine a pathname of the user's mailbox file for purposes
                 of incoming mail notification. If this variable is set, the
                 shell shall inform the user if the file named by the variable
                 is created or if its modification time has changed. Informing
                 the user shall be accomplished by writing a string of
                 unspecified format to standard error prior to the writing of
                 the next primary prompt string. Such check shall be performed
                 only after the completion of the interval defined by the
                 _M_A_I_L_C_H_E_C_K variable after the last such check. The user shall
                 be informed only if _M_A_I_L is set and _M_A_I_L_P_A_T_H is not set.

       _M_A_I_L_C_H_E_C_K
                 Establish a decimal integer value that specifies how often
                 (in seconds) the shell shall check for the arrival of mail in
                 the files specified by the _M_A_I_L_P_A_T_H or _M_A_I_L variables. The
                 default value shall be 600 seconds. If set to zero, the shell
                 shall check before issuing each primary prompt.

       _M_A_I_L_P_A_T_H  Provide a list of pathnames and optional messages separated
                 by <colon> characters. If this variable is set, the shell
                 shall inform the user if any of the files named by the
                 variable are created or if any of their modification times
                 change. (See the preceding entry for _M_A_I_L for descriptions of
                 mail arrival and user informing.) Each pathname can be
                 followed by ''%%'' and a string that shall be subjected to
                 parameter expansion and written to standard error when the
                 modification time changes. If a ''%%'' character in the pathname
                 is preceded by a <backslash>, it shall be treated as a
                 literal ''%%'' in the pathname. The default message is
                 unspecified.

                 The _M_A_I_L_P_A_T_H environment variable takes precedence over the
                 _M_A_I_L variable.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

       _P_A_T_H      Establish a string formatted as described in the Base
                 Definitions volume of POSIX.1-2008, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
                 _V_a_r_i_a_b_l_e_s, used to effect command interpretation; see _S_e_c_t_i_o_n
                 _2_._9_._1_._1, _C_o_m_m_a_n_d _S_e_a_r_c_h _a_n_d _E_x_e_c_u_t_i_o_n.

       _P_W_D       This variable shall represent an absolute pathname of the
                 current working directory. Assignments to this variable may
                 be ignored.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       The _s_h utility shall take the standard action for all signals (see
       _S_e_c_t_i_o_n _1_._4, _U_t_i_l_i_t_y _D_e_s_c_r_i_p_t_i_o_n _D_e_f_a_u_l_t_s) with the following
       exceptions.

       If the shell is interactive, SIGINT signals received during command
       line editing shall be handled as described in the EXTENDED DESCRIPTION,
       and SIGINT signals received at other times shall be caught but no
       action performed.

       If the shell is interactive:

        *  SIGQUIT and SIGTERM signals shall be ignored.

        *  If the --mm option is in effect, SIGTTIN, SIGTTOU, and SIGTSTP
           signals shall be ignored.

        *  If the --mm option is not in effect, it is unspecified whether
           SIGTTIN, SIGTTOU, and SIGTSTP signals are ignored, set to the
           default action, or caught.  If they are caught, the shell shall, in
           the signal-catching function, set the signal to the default action
           and raise the signal (after taking any appropriate steps, such as
           restoring terminal settings).

       The standard actions, and the actions described above for interactive
       shells, can be overridden by use of the _t_r_a_p special built-in utility
       (see _t_r_a_p and _S_e_c_t_i_o_n _2_._1_1, _S_i_g_n_a_l_s _a_n_d _E_r_r_o_r _H_a_n_d_l_i_n_g).

SSTTDDOOUUTT
       See the STDERR section.

SSTTDDEERRRR
       Except as otherwise stated (by the descriptions of any invoked
       utilities or in interactive mode), standard error shall be used only
       for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       See _C_h_a_p_t_e_r _2, _S_h_e_l_l _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e.  The functionality described in
       the rest of the EXTENDED DESCRIPTION section shall be provided on
       implementations that support the User Portability Utilities option (and
       the rest of this section is not further shaded for this option).

   CCoommmmaanndd HHiissttoorryy LLiisstt
       When the _s_h utility is being used interactively, it shall maintain a
       list of commands previously entered from the terminal in the file named
       by the _H_I_S_T_F_I_L_E environment variable. The type, size, and internal
       format of this file are unspecified. Multiple _s_h processes can share
       access to the file for a user, if file access permissions allow this;
       see the description of the _H_I_S_T_F_I_L_E environment variable.

   CCoommmmaanndd LLiinnee EEddiittiinngg
       When _s_h is being used interactively from a terminal, the current
       command and the command history (see _f_c) can be edited using _v_i-mode
       command line editing. This mode uses commands, described below, similar
       to a subset of those described in the _v_i utility. Implementations may
       offer other command line editing modes corresponding to other editing
       utilities.

       The command _s_e_t --oo _v_i shall enable _v_i-mode editing and place _s_h into _v_i
       insert mode (see _C_o_m_m_a_n_d _L_i_n_e _E_d_i_t_i_n_g _(_v_i_-_m_o_d_e_)).  This command also
       shall disable any other editing mode that the implementation may
       provide. The command _s_e_t ++oo _v_i disables _v_i-mode editing.

       Certain block-mode terminals may be unable to support shell command
       line editing. If a terminal is unable to provide either edit mode, it
       need not be possible to _s_e_t --oo _v_i when using the shell on this
       terminal.

       In the following sections, the characters _e_r_a_s_e, _i_n_t_e_r_r_u_p_t, _k_i_l_l, and
       _e_n_d_-_o_f_-_f_i_l_e are those set by the _s_t_t_y utility.

   CCoommmmaanndd LLiinnee EEddiittiinngg ((vvii--mmooddee))
       In _v_i editing mode, there shall be a distinguished line, the edit line.
       All the editing operations which modify a line affect the edit line.
       The edit line is always the newest line in the command history buffer.

       With _v_i-mode enabled, _s_h can be switched between insert mode and
       command mode.

       When in insert mode, an entered character shall be inserted into the
       command line, except as noted in _v_i _L_i_n_e _E_d_i_t_i_n_g _I_n_s_e_r_t _M_o_d_e.  Upon
       entering _s_h and after termination of the previous command, _s_h shall be
       in insert mode.

       Typing an escape character shall switch _s_h into command mode (see _v_i
       _L_i_n_e _E_d_i_t_i_n_g _C_o_m_m_a_n_d _M_o_d_e).  In command mode, an entered character
       shall either invoke a defined operation, be used as part of a multi-
       character operation, or be treated as an error. A character that is not
       recognized as part of an editing command shall terminate any specific
       editing command and shall alert the terminal. If _s_h receives a SIGINT
       signal in command mode (whether generated by typing the _i_n_t_e_r_r_u_p_t
       character or by other means), it shall terminate command line editing
       on the current command line, reissue the prompt on the next line of the
       terminal, and reset the command history (see _f_c) so that the most
       recently executed command is the previous command (that is, the command
       that was being edited when it was interrupted is not re-entered into
       the history).

       In the following sections, the phrase ``move the cursor to the
       beginning of the word'' shall mean ``move the cursor to the first
       character of the current word'' and the phrase ``move the cursor to the
       end of the word'' shall mean ``move the cursor to the last character of
       the current word''. The phrase ``beginning of the command line''
       indicates the point between the end of the prompt string issued by the
       shell (or the beginning of the terminal line, if there is no prompt
       string) and the first character of the command text.

   vvii LLiinnee EEddiittiinngg IInnsseerrtt MMooddee
       While in insert mode, any character typed shall be inserted in the
       current command line, unless it is from the following set.

       <newline> Execute the current command line. If the current command line
                 is not empty, this line shall be entered into the command
                 history (see _f_c).

       _e_r_a_s_e     Delete the character previous to the current cursor position
                 and move the current cursor position back one character. In
                 insert mode, characters shall be erased from both the screen
                 and the buffer when backspacing.

       _i_n_t_e_r_r_u_p_t If _s_h receives a SIGINT signal in insert mode (whether
                 generated by typing the _i_n_t_e_r_r_u_p_t character or by other
                 means), it shall terminate command line editing with the same
                 effects as described for interrupting command mode; see
                 _C_o_m_m_a_n_d _L_i_n_e _E_d_i_t_i_n_g _(_v_i_-_m_o_d_e_).

       _k_i_l_l      Clear all the characters from the input line.

       <control>-V
                 Insert the next character input, even if the character is
                 otherwise a special insert mode character.

       <control>-W
                 Delete the characters from the one preceding the cursor to
                 the preceding word boundary. The word boundary in this case
                 is the closer to the cursor of either the beginning of the
                 line or a character that is in neither the bbllaannkk nor ppuunncctt
                 character classification of the current locale.

       _e_n_d_-_o_f_-_f_i_l_e
                 Interpreted as the end of input in _s_h.  This interpretation
                 shall occur only at the beginning of an input line. If _e_n_d_-
                 _o_f_-_f_i_l_e is entered other than at the beginning of the line,
                 the results are unspecified.

       <ESC>     Place _s_h into command mode.

   vvii LLiinnee EEddiittiinngg CCoommmmaanndd MMooddee
       In command mode for the command line editing feature, decimal digits
       not beginning with 0 that precede a command letter shall be remembered.
       Some commands use these decimal digits as a count number that affects
       the operation.

       The term _m_o_t_i_o_n _c_o_m_m_a_n_d represents one of the commands:

           <<ssppaaccee>>  00  bb  FF  ll  WW  ^^  $$  ;;  EE  ff  TT  ww  ||  ,,  BB  ee  hh  tt

       If the current line is not the edit line, any command that modifies the
       current line shall cause the content of the current line to replace the
       content of the edit line, and the current line shall become the edit
       line. This replacement cannot be undone (see the uu and UU commands
       below). The modification requested shall then be performed to the edit
       line. When the current line is the edit line, the modification shall be
       done directly to the edit line.

       Any command that is preceded by _c_o_u_n_t shall take a count (the numeric
       value of any preceding decimal digits). Unless otherwise noted, this
       count shall cause the specified operation to repeat by the number of
       times specified by the count.  Also unless otherwise noted, a _c_o_u_n_t
       that is out of range is considered an error condition and shall alert
       the terminal, but neither the cursor position, nor the command line,
       shall change.

       The terms _w_o_r_d and _b_i_g_w_o_r_d are used as defined in the _v_i description.
       The term _s_a_v_e _b_u_f_f_e_r corresponds to the term _u_n_n_a_m_e_d _b_u_f_f_e_r in _v_i.

       The following commands shall be recognized in command mode:

       <newline> Execute the current command line. If the current command line
                 is not empty, this line shall be entered into the command
                 history (see _f_c).

       <control>-L
                 Redraw the current command line. Position the cursor at the
                 same location on the redrawn line.

       ##         Insert the character ''##'' at the beginning of the current
                 command line and treat the resulting edit line as a comment.
                 This line shall be entered into the command history; see _f_c.

       ==         Display the possible shell word expansions (see _S_e_c_t_i_o_n _2_._6,
                 _W_o_r_d _E_x_p_a_n_s_i_o_n_s) of the bigword at the current command line
                 position.

                 NNoottee::     This does not modify the content of the current
                           line, and therefore does not cause the current line
                           to become the edit line.

                 These expansions shall be displayed on subsequent terminal
                 lines. If the bigword contains none of the characters ''??'',
                 ''**'', or ''[['', an <asterisk> (''**'') shall be implicitly assumed
                 at the end. If any directories are matched, these expansions
                 shall have a ''//'' character appended. After the expansion, the
                 line shall be redrawn, the cursor repositioned at the current
                 cursor position, and _s_h shall be placed in command mode.

       \\         Perform pathname expansion (see _S_e_c_t_i_o_n _2_._6_._6, _P_a_t_h_n_a_m_e
                 _E_x_p_a_n_s_i_o_n) on the current bigword, up to the largest set of
                 characters that can be matched uniquely. If the bigword
                 contains none of the characters ''??'', ''**'', or ''[['', an
                 <asterisk> (''**'') shall be implicitly assumed at the end. This
                 maximal expansion then shall replace the original bigword in
                 the command line, and the cursor shall be placed after this
                 expansion. If the resulting bigword completely and uniquely
                 matches a directory, a ''//'' character shall be inserted
                 directly after the bigword. If some other file is completely
                 matched, a single <space> shall be inserted after the
                 bigword. After this operation, _s_h shall be placed in insert
                 mode.

       **         Perform pathname expansion on the current bigword and insert
                 all expansions into the command to replace the current
                 bigword, with each expansion separated by a single <space>.
                 If at the end of the line, the current cursor position shall
                 be moved to the first column position following the
                 expansions and _s_h shall be placed in insert mode. Otherwise,
                 the current cursor position shall be the last column position
                 of the first character after the expansions and _s_h shall be
                 placed in insert mode. If the current bigword contains none
                 of the characters ''??'', ''**'', or ''[['', before the operation, an
                 <asterisk> (''**'') shall be implicitly assumed at the end.

       @@_l_e_t_t_e_r   Insert the value of the alias named ___l_e_t_t_e_r.  The symbol
                 _l_e_t_t_e_r represents a single alphabetic character from the
                 portable character set; implementations may support
                 additional characters as an extension. If the alias ___l_e_t_t_e_r
                 contains other editing commands, these commands shall be
                 performed as part of the insertion. If no alias ___l_e_t_t_e_r is
                 enabled, this command shall have no effect.

       [[_c_o_u_n_t]]~~  Convert, if the current character is a lowercase letter, to
                 the equivalent uppercase letter and _v_i_c_e _v_e_r_s_a, as prescribed
                 by the current locale. The current cursor position then shall
                 be advanced by one character. If the cursor was positioned on
                 the last character of the line, the case conversion shall
                 occur, but the cursor shall not advance. If the ''~~'' command
                 is preceded by a _c_o_u_n_t, that number of characters shall be
                 converted, and the cursor shall be advanced to the character
                 position after the last character converted.  If the _c_o_u_n_t is
                 larger than the number of characters after the cursor, this
                 shall not be considered an error; the cursor shall advance to
                 the last character on the line.

       [[_c_o_u_n_t]]..  Repeat the most recent non-motion command, even if it was
                 executed on an earlier command line. If the previous command
                 was preceded by a _c_o_u_n_t, and no count is given on the ''..''
                 command, the count from the previous command shall be
                 included as part of the repeated command. If the ''..''  command
                 is preceded by a _c_o_u_n_t, this shall override any _c_o_u_n_t
                 argument to the previous command. The _c_o_u_n_t specified in the
                 ''..''  command shall become the count for subsequent ''..''
                 commands issued without a count.

       [[_n_u_m_b_e_r]]vv Invoke the _v_i editor to edit the current command line in a
                 temporary file. When the editor exits, the commands in the
                 temporary file shall be executed and placed in the command
                 history. If a _n_u_m_b_e_r is included, it specifies the command
                 number in the command history to be edited, rather than the
                 current command line.

       [[_c_o_u_n_t]]ll   (ell)

       [[_c_o_u_n_t]]<space>
                 Move the current cursor position to the next character
                 position. If the cursor was positioned on the last character
                 of the line, the terminal shall be alerted and the cursor
                 shall not be advanced. If the _c_o_u_n_t is larger than the number
                 of characters after the cursor, this shall not be considered
                 an error; the cursor shall advance to the last character on
                 the line.

       [[_c_o_u_n_t]]hh  Move the current cursor position to the _c_o_u_n_tth (default 1)
                 previous character position. If the cursor was positioned on
                 the first character of the line, the terminal shall be
                 alerted and the cursor shall not be moved. If the count is
                 larger than the number of characters before the cursor, this
                 shall not be considered an error; the cursor shall move to
                 the first character on the line.

       [[_c_o_u_n_t]]ww  Move to the start of the next word. If the cursor was
                 positioned on the last character of the line, the terminal
                 shall be alerted and the cursor shall not be advanced. If the
                 _c_o_u_n_t is larger than the number of words after the cursor,
                 this shall not be considered an error; the cursor shall
                 advance to the last character on the line.

       [[_c_o_u_n_t]]WW  Move to the start of the next bigword. If the cursor was
                 positioned on the last character of the line, the terminal
                 shall be alerted and the cursor shall not be advanced. If the
                 _c_o_u_n_t is larger than the number of bigwords after the cursor,
                 this shall not be considered an error; the cursor shall
                 advance to the last character on the line.

       [[_c_o_u_n_t]]ee  Move to the end of the current word. If at the end of a word,
                 move to the end of the next word. If the cursor was
                 positioned on the last character of the line, the terminal
                 shall be alerted and the cursor shall not be advanced. If the
                 _c_o_u_n_t is larger than the number of words after the cursor,
                 this shall not be considered an error; the cursor shall
                 advance to the last character on the line.

       [[_c_o_u_n_t]]EE  Move to the end of the current bigword. If at the end of a
                 bigword, move to the end of the next bigword. If the cursor
                 was positioned on the last character of the line, the
                 terminal shall be alerted and the cursor shall not be
                 advanced. If the _c_o_u_n_t is larger than the number of bigwords
                 after the cursor, this shall not be considered an error; the
                 cursor shall advance to the last character on the line.

       [[_c_o_u_n_t]]bb  Move to the beginning of the current word. If at the
                 beginning of a word, move to the beginning of the previous
                 word. If the cursor was positioned on the first character of
                 the line, the terminal shall be alerted and the cursor shall
                 not be moved. If the _c_o_u_n_t is larger than the number of words
                 preceding the cursor, this shall not be considered an error;
                 the cursor shall return to the first character on the line.

       [[_c_o_u_n_t]]BB  Move to the beginning of the current bigword. If at the
                 beginning of a bigword, move to the beginning of the previous
                 bigword. If the cursor was positioned on the first character
                 of the line, the terminal shall be alerted and the cursor
                 shall not be moved. If the _c_o_u_n_t is larger than the number of
                 bigwords preceding the cursor, this shall not be considered
                 an error; the cursor shall return to the first character on
                 the line.

       ^^         Move the current cursor position to the first character on
                 the input line that is not a <blank>.

       $$         Move to the last character position on the current command
                 line.

       00         (Zero.) Move to the first character position on the current
                 command line.

       [[_c_o_u_n_t]]||  Move to the _c_o_u_n_tth character position on the current command
                 line. If no number is specified, move to the first position.
                 The first character position shall be numbered 1. If the
                 count is larger than the number of characters on the line,
                 this shall not be considered an error; the cursor shall be
                 placed on the last character on the line.

       [[_c_o_u_n_t]]ff_c Move to the first occurrence of the character ''cc'' that occurs
                 after the current cursor position. If the cursor was
                 positioned on the last character of the line, the terminal
                 shall be alerted and the cursor shall not be advanced. If the
                 character ''cc'' does not occur in the line after the current
                 cursor position, the terminal shall be alerted and the cursor
                 shall not be moved.

       [[_c_o_u_n_t]]FF_c Move to the first occurrence of the character ''cc'' that occurs
                 before the current cursor position. If the cursor was
                 positioned on the first character of the line, the terminal
                 shall be alerted and the cursor shall not be moved. If the
                 character ''cc'' does not occur in the line before the current
                 cursor position, the terminal shall be alerted and the cursor
                 shall not be moved.

       [[_c_o_u_n_t]]tt_c Move to the character before the first occurrence of the
                 character ''cc'' that occurs after the current cursor position.
                 If the cursor was positioned on the last character of the
                 line, the terminal shall be alerted and the cursor shall not
                 be advanced. If the character ''cc'' does not occur in the line
                 after the current cursor position, the terminal shall be
                 alerted and the cursor shall not be moved.

       [[_c_o_u_n_t]]TT_c Move to the character after the first occurrence of the
                 character ''cc'' that occurs before the current cursor position.
                 If the cursor was positioned on the first character of the
                 line, the terminal shall be alerted and the cursor shall not
                 be moved. If the character ''cc'' does not occur in the line
                 before the current cursor position, the terminal shall be
                 alerted and the cursor shall not be moved.

       [[_c_o_u_n_t]];;  Repeat the most recent ff, FF, tt, or TT command. Any number
                 argument on that previous command shall be ignored. Errors
                 are those described for the repeated command.

       [[_c_o_u_n_t]],,  Repeat the most recent ff, FF, tt, or TT command. Any number
                 argument on that previous command shall be ignored. However,
                 reverse the direction of that command.

       aa         Enter insert mode after the current cursor position.
                 Characters that are entered shall be inserted before the next
                 character.

       AA         Enter insert mode after the end of the current command line.

       ii         Enter insert mode at the current cursor position. Characters
                 that are entered shall be inserted before the current
                 character.

       II         Enter insert mode at the beginning of the current command
                 line.

       RR         Enter insert mode, replacing characters from the command line
                 beginning at the current cursor position.

       [[_c_o_u_n_t]]cc_m_o_t_i_o_n
                 Delete the characters between the current cursor position and
                 the cursor position that would result from the specified
                 motion command. Then enter insert mode before the first
                 character following any deleted characters. If _c_o_u_n_t is
                 specified, it shall be applied to the motion command. A _c_o_u_n_t
                 shall be ignored for the following motion commands:

                     00    ^^    $$    cc

                 If the motion command is the character ''cc'', the current
                 command line shall be cleared and insert mode shall be
                 entered. If the motion command would move the current cursor
                 position toward the beginning of the command line, the
                 character under the current cursor position shall not be
                 deleted. If the motion command would move the current cursor
                 position toward the end of the command line, the character
                 under the current cursor position shall be deleted.  If the
                 _c_o_u_n_t is larger than the number of characters between the
                 current cursor position and the end of the command line
                 toward which the motion command would move the cursor, this
                 shall not be considered an error; all of the remaining
                 characters in the aforementioned range shall be deleted and
                 insert mode shall be entered. If the motion command is
                 invalid, the terminal shall be alerted, the cursor shall not
                 be moved, and no text shall be deleted.

       CC         Delete from the current character to the end of the line and
                 enter insert mode at the new end-of-line.

       SS         Clear the entire edit line and enter insert mode.

       [[_c_o_u_n_t]]rr_c Replace the current character with the character ''cc''.  With a
                 number _c_o_u_n_t, replace the current and the following _c_o_u_n_t-1
                 characters. After this command, the current cursor position
                 shall be on the last character that was changed. If the _c_o_u_n_t
                 is larger than the number of characters after the cursor,
                 this shall not be considered an error; all of the remaining
                 characters shall be changed.

       [[_c_o_u_n_t]]__  Append a <space> after the current character position and
                 then append the last bigword in the previous input line after
                 the <space>.  Then enter insert mode after the last character
                 just appended. With a number _c_o_u_n_t, append the _c_o_u_n_tth
                 bigword in the previous line.

       [[_c_o_u_n_t]]xx  Delete the character at the current cursor position and place
                 the deleted characters in the save buffer. If the cursor was
                 positioned on the last character of the line, the character
                 shall be deleted and the cursor position shall be moved to
                 the previous character (the new last character). If the _c_o_u_n_t
                 is larger than the number of characters after the cursor,
                 this shall not be considered an error; all the characters
                 from the cursor to the end of the line shall be deleted.

       [[_c_o_u_n_t]]XX  Delete the character before the current cursor position and
                 place the deleted characters in the save buffer. The
                 character under the current cursor position shall not change.
                 If the cursor was positioned on the first character of the
                 line, the terminal shall be alerted, and the XX command shall
                 have no effect. If the line contained a single character, the
                 XX command shall have no effect. If the line contained no
                 characters, the terminal shall be alerted and the cursor
                 shall not be moved. If the _c_o_u_n_t is larger than the number of
                 characters before the cursor, this shall not be considered an
                 error; all the characters from before the cursor to the
                 beginning of the line shall be deleted.

       [[_c_o_u_n_t]]dd_m_o_t_i_o_n
                 Delete the characters between the current cursor position and
                 the character position that would result from the motion
                 command. A number _c_o_u_n_t repeats the motion command _c_o_u_n_t
                 times. If the motion command would move toward the beginning
                 of the command line, the character under the current cursor
                 position shall not be deleted. If the motion command is dd,
                 the entire current command line shall be cleared. If the
                 _c_o_u_n_t is larger than the number of characters between the
                 current cursor position and the end of the command line
                 toward which the motion command would move the cursor, this
                 shall not be considered an error; all of the remaining
                 characters in the aforementioned range shall be deleted. The
                 deleted characters shall be placed in the save buffer.

       DD         Delete all characters from the current cursor position to the
                 end of the line. The deleted characters shall be placed in
                 the save buffer.

       [[_c_o_u_n_t]]yy_m_o_t_i_o_n
                 Yank (that is, copy) the characters from the current cursor
                 position to the position resulting from the motion command
                 into the save buffer. A number _c_o_u_n_t shall be applied to the
                 motion command. If the motion command would move toward the
                 beginning of the command line, the character under the
                 current cursor position shall not be included in the set of
                 yanked characters. If the motion command is yy, the entire
                 current command line shall be yanked into the save buffer.
                 The current cursor position shall be unchanged. If the _c_o_u_n_t
                 is larger than the number of characters between the current
                 cursor position and the end of the command line toward which
                 the motion command would move the cursor, this shall not be
                 considered an error; all of the remaining characters in the
                 aforementioned range shall be yanked.

       YY         Yank the characters from the current cursor position to the
                 end of the line into the save buffer. The current character
                 position shall be unchanged.

       [[_c_o_u_n_t]]pp  Put a copy of the current contents of the save buffer after
                 the current cursor position. The current cursor position
                 shall be advanced to the last character put from the save
                 buffer. A _c_o_u_n_t shall indicate how many copies of the save
                 buffer shall be put.

       [[_c_o_u_n_t]]PP  Put a copy of the current contents of the save buffer before
                 the current cursor position. The current cursor position
                 shall be moved to the last character put from the save
                 buffer. A _c_o_u_n_t shall indicate how many copies of the save
                 buffer shall be put.

       uu         Undo the last command that changed the edit line. This
                 operation shall not undo the copy of any command line to the
                 edit line.

       UU         Undo all changes made to the edit line. This operation shall
                 not undo the copy of any command line to the edit line.

       [[_c_o_u_n_t]]kk

       [[_c_o_u_n_t]]--  Set the current command line to be the _c_o_u_n_tth previous
                 command line in the shell command history. If _c_o_u_n_t is not
                 specified, it shall default to 1. The cursor shall be
                 positioned on the first character of the new command. If a kk
                 or -- command would retreat past the maximum number of
                 commands in effect for this shell (affected by the _H_I_S_T_S_I_Z_E
                 environment variable), the terminal shall be alerted, and the
                 command shall have no effect.

       [[_c_o_u_n_t]]jj

       [[_c_o_u_n_t]]++  Set the current command line to be the _c_o_u_n_tth next command
                 line in the shell command history. If _c_o_u_n_t is not specified,
                 it shall default to 1. The cursor shall be positioned on the
                 first character of the new command. If a jj or ++ command
                 advances past the edit line, the current command line shall
                 be restored to the edit line and the terminal shall be
                 alerted.

       [[_n_u_m_b_e_r]]GG Set the current command line to be the oldest command line
                 stored in the shell command history. With a number _n_u_m_b_e_r,
                 set the current command line to be the command line _n_u_m_b_e_r in
                 the history. If command line _n_u_m_b_e_r does not exist, the
                 terminal shall be alerted and the command line shall not be
                 changed.

       //_p_a_t_t_e_r_n<newline>
                 Move backwards through the command history, searching for the
                 specified pattern, beginning with the previous command line.
                 Patterns use the pattern matching notation described in
                 _S_e_c_t_i_o_n _2_._1_3, _P_a_t_t_e_r_n _M_a_t_c_h_i_n_g _N_o_t_a_t_i_o_n, except that the ''^^''
                 character shall have special meaning when it appears as the
                 first character of _p_a_t_t_e_r_n.  In this case, the ''^^'' is
                 discarded and the characters after the ''^^'' shall be matched
                 only at the beginning of a line. Commands in the command
                 history shall be treated as strings, not as filenames. If the
                 pattern is not found, the current command line shall be
                 unchanged and the terminal is alerted. If it is found in a
                 previous line, the current command line shall be set to that
                 line and the cursor shall be set to the first character of
                 the new command line.

                 If _p_a_t_t_e_r_n is empty, the last non-empty pattern provided to //
                 or ??  shall be used. If there is no previous non-empty
                 pattern, the terminal shall be alerted and the current
                 command line shall remain unchanged.

       ??_p_a_t_t_e_r_n<newline>
                 Move forwards through the command history, searching for the
                 specified pattern, beginning with the next command line.
                 Patterns use the pattern matching notation described in
                 _S_e_c_t_i_o_n _2_._1_3, _P_a_t_t_e_r_n _M_a_t_c_h_i_n_g _N_o_t_a_t_i_o_n, except that the ''^^''
                 character shall have special meaning when it appears as the
                 first character of _p_a_t_t_e_r_n.  In this case, the ''^^'' is
                 discarded and the characters after the ''^^'' shall be matched
                 only at the beginning of a line. Commands in the command
                 history shall be treated as strings, not as filenames. If the
                 pattern is not found, the current command line shall be
                 unchanged and the terminal alerted. If it is found in a
                 following line, the current command line shall be set to that
                 line and the cursor shall be set to the fist character of the
                 new command line.

                 If _p_a_t_t_e_r_n is empty, the last non-empty pattern provided to //
                 or ??  shall be used. If there is no previous non-empty
                 pattern, the terminal shall be alerted and the current
                 command line shall remain unchanged.

       nn         Repeat the most recent // or ??  command. If there is no
                 previous // or ??, the terminal shall be alerted and the
                 current command line shall remain unchanged.

       NN         Repeat the most recent // or ??  command, reversing the
                 direction of the search. If there is no previous // or ??, the
                 terminal shall be alerted and the current command line shall
                 remain unchanged.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

           0   The script to be executed consisted solely of zero or more
               blank lines or comments, or both.

       1-125   A non-interactive shell detected an error other than
               _c_o_m_m_a_n_d___f_i_l_e not found, including but not limited to syntax,
               redirection, or variable assignment errors.

         127   A specified _c_o_m_m_a_n_d___f_i_l_e could not be found by a non-
               interactive shell.

       Otherwise, the shell shall return the exit status of the last command
       it invoked or attempted to invoke (see also the _e_x_i_t utility in _S_e_c_t_i_o_n
       _2_._1_4, _S_p_e_c_i_a_l _B_u_i_l_t_-_I_n _U_t_i_l_i_t_i_e_s).

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       See _S_e_c_t_i_o_n _2_._8_._1, _C_o_n_s_e_q_u_e_n_c_e_s _o_f _S_h_e_l_l _E_r_r_o_r_s.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Standard input and standard error are the files that determine whether
       a shell is interactive when --ii is not specified. For example:

           sshh >> ffiillee

       and:

           sshh 22>> ffiillee

       create interactive and non-interactive shells, respectively. Although
       both accept terminal input, the results of error conditions are
       different, as described in _S_e_c_t_i_o_n _2_._8_._1, _C_o_n_s_e_q_u_e_n_c_e_s _o_f _S_h_e_l_l _E_r_r_o_r_s;
       in the second example a redirection error encountered by a special
       built-in utility aborts the shell.

       A conforming application must protect its first operand, if it starts
       with a <plus-sign>, by preceding it with the ""----"" argument that denotes
       the end of the options.

       Applications should note that the standard _P_A_T_H to the shell cannot be
       assumed to be either //bbiinn//sshh or //uussrr//bbiinn//sshh, and should be determined
       by interrogation of the _P_A_T_H returned by _g_e_t_c_o_n_f _P_A_T_H, ensuring that
       the returned pathname is an absolute pathname and not a shell built-in.

       For example, to determine the location of the standard _s_h utility:

           ccoommmmaanndd --vv sshh

       On some implementations this might return:

           //uussrr//xxppgg44//bbiinn//sshh

       Furthermore, on systems that support executable scripts (the ""##!!""
       construct), it is recommended that applications using executable
       scripts install them using _g_e_t_c_o_n_f _P_A_T_H to determine the shell pathname
       and update the ""##!!"" script appropriately as it is being installed (for
       example, with _s_e_d).  For example:

           ##
           ## IInnssttaallllaattiioonn ttiimmee ssccrriipptt ttoo iinnssttaallll ccoorrrreecctt PPOOSSIIXX sshheellll ppaatthhnnaammee
           ##
           ## GGeett lliisstt ooff ppaatthhss ttoo cchheecckk
           ##
           SSiiffss==$$IIFFSS
           SSiiffss__sseett==$${{IIFFSS++yy}}
           IIFFSS==::
           sseett ---- $$((ggeettccoonnff PPAATTHH))
           iiff [[ ""$$SSiiffss__sseett"" == yy ]]
           tthheenn
               IIFFSS==$$SSiiffss
           eellssee
               uunnsseett IIFFSS
           ffii
           ##
           ## CChheecckk eeaacchh ppaatthh ffoorr ''sshh''
           ##
           ffoorr ii
           ddoo
               iiff [[ --xx ""$${{ii}}""//sshh ]]
               tthheenn
                   PPsshheellll==$${{ii}}//sshh
               ffii
           ddoonnee
           ##
           ## TThhiiss iiss tthhee lliisstt ooff ssccrriippttss ttoo uuppddaattee.. TThheeyy sshhoouulldd bbee ooff tthhee
           ## ffoorrmm ''$${{nnaammee}}..ssoouurrccee'' aanndd wwiillll bbee ttrraannssffoorrmmeedd ttoo ''$${{nnaammee}}''..
           ## EEaacchh ssccrriipptt sshhoouulldd bbeeggiinn::
           ##
           ## ##!!IINNSSTTAALLLLSSHHEELLLLPPAATTHH
           ##
           ssccrriippttss==""aa bb cc""
           ##
           ## TTrraannssffoorrmm eeaacchh ssccrriipptt
           ##
           ffoorr ii iinn $${{ssccrriippttss}}
           ddoo
               sseedd --ee ""ss||IINNSSTTAALLLLSSHHEELLLLPPAATTHH||$${{PPsshheellll}}||"" << $${{ii}}..ssoouurrccee >> $${{ii}}
           ddoonnee

EEXXAAMMPPLLEESS
        1. Execute a shell command from a string:

               sshh --cc ""ccaatt mmyyffiillee""

        2. Execute a shell script from a file in the current directory:

               sshh mmyy__sshheellll__ccmmddss

RRAATTIIOONNAALLEE
       The _s_h utility and the _s_e_t special built-in utility share a common set
       of options.

       The name _I_F_S was originally an abbreviation of ``Input Field
       Separators''; however, this name is misleading as the _I_F_S characters
       are actually used as field terminators. The KornShell ignores the
       contents of _I_F_S upon entry to the script. A conforming application
       cannot rely on importing _I_F_S.  One justification for this, beyond
       security considerations, is to assist possible future shell compilers.
       Allowing _I_F_S to be imported from the environment prevents many
       optimizations that might otherwise be performed via dataflow analysis
       of the script itself.

       The text in the STDIN section about non-blocking reads concerns an
       instance of _s_h that has been invoked, probably by a C-language program,
       with standard input that has been opened using the O_NONBLOCK flag; see
       _o_p_e_n() in the System Interfaces volume of POSIX.1-2008. If the shell
       did not reset this flag, it would immediately terminate because no
       input data would be available yet and that would be considered the same
       as end-of-file.

       The options associated with a _r_e_s_t_r_i_c_t_e_d _s_h_e_l_l (command name _r_s_h and
       the --rr option) were excluded because the standard developers considered
       that the implied level of security could not be achieved and they did
       not want to raise false expectations.

       On systems that support set-user-ID scripts, a historical trapdoor has
       been to link a script to the name --ii.  When it is called by a sequence
       such as:

           sshh --

       or by:

           ##!! uussrr//bbiinn//sshh --

       the historical systems have assumed that no option letters follow.
       Thus, this volume of POSIX.1-2008 allows the single <hyphen> to mark
       the end of the options, in addition to the use of the regular ""----""
       argument, because it was considered that the older practice was so
       pervasive. An alternative approach is taken by the KornShell, where
       real and effective user/group IDs must match for an interactive shell;
       this behavior is specifically allowed by this volume of POSIX.1-2008.

       NNoottee::     There are other problems with set-user-ID scripts that the
                 two approaches described here do not resolve.

       The initialization process for the history file can be dependent on the
       system start-up files, in that they may contain commands that
       effectively preempt the user's settings of _H_I_S_T_F_I_L_E and _H_I_S_T_S_I_Z_E.  For
       example, function definition commands are recorded in the history file,
       unless the _s_e_t --oo _n_o_l_o_g option is set. If the system administrator
       includes function definitions in some system start-up file called
       before the _E_N_V file, the history file is initialized before the user
       gets a chance to influence its characteristics. In some historical
       shells, the history file is initialized just after the _E_N_V file has
       been processed. Therefore, it is implementation-defined whether changes
       made to _H_I_S_T_F_I_L_E after the history file has been initialized are
       effective.

       The default messages for the various _M_A_I_L-related messages are
       unspecified because they vary across implementations.  Typical messages
       are:

           ""yyoouu hhaavvee mmaaiill\\nn""

       or:

           ""yyoouu hhaavvee nneeww mmaaiill\\nn""

       It is important that the descriptions of command line editing refer to
       the same shell as that in POSIX.1-2008 so that interactive users can
       also be application programmers without having to deal with
       programmatic differences in their two environments. It is also
       essential that the utility name _s_h be specified because this explicit
       utility name is too firmly rooted in historical practice of application
       programs for it to change.

       Consideration was given to mandating a diagnostic message when
       attempting to set _v_i-mode on terminals that do not support command line
       editing. However, it is not historical practice for the shell to be
       cognizant of all terminal types and thus be able to detect
       inappropriate terminals in all cases.  Implementations are encouraged
       to supply diagnostics in this case whenever possible, rather than
       leaving the user in a state where editing commands work incorrectly.

       In early proposals, the KornShell-derived _e_m_a_c_s mode of command line
       editing was included, even though the _e_m_a_c_s editor itself was not. The
       community of _e_m_a_c_s proponents was adamant that the full _e_m_a_c_s editor
       not be standardized because they were concerned that an attempt to
       standardize this very powerful environment would encourage vendors to
       ship strictly conforming versions lacking the extensibility required by
       the community. The author of the original _e_m_a_c_s program also expressed
       his desire to omit the program. Furthermore, there were a number of
       historical systems that did not include _e_m_a_c_s, or included it without
       supporting it, but there were very few that did not include and support
       _v_i.  The shell _e_m_a_c_s command line editing mode was finally omitted
       because it became apparent that the KornShell version and the editor
       being distributed with the GNU system had diverged in some respects.
       The author of _e_m_a_c_s requested that the POSIX _e_m_a_c_s mode either be
       deleted or have a significant number of unspecified conditions.
       Although the KornShell author agreed to consider changes to bring the
       shell into alignment, the standard developers decided to defer
       specification at that time. At the time, it was assumed that
       convergence on an acceptable definition would occur for a subsequent
       draft, but that has not happened, and there appears to be no impetus to
       do so. In any case, implementations are free to offer additional
       command line editing modes based on the exact models of editors their
       users are most comfortable with.

       Early proposals had the following list entry in _v_i _L_i_n_e _E_d_i_t_i_n_g _I_n_s_e_r_t
       _M_o_d_e:

       \     If followed by the _e_r_a_s_e or _k_i_l_l character, that character shall
             be inserted into the input line.  Otherwise, the <backslash>
             itself shall be inserted into the input line.

       However, this is not actually a feature of _s_h command line editing
       insert mode, but one of some historical terminal line drivers. Some
       conforming implementations continue to do this when the _s_t_t_y iieexxtteenn
       flag is set.

       In interactive shells, SIGTERM is ignored so that _k_i_l_l _0 does not kill
       the shell, and SIGINT is caught so that _w_a_i_t is interruptible. If the
       shell does not ignore SIGTTIN, SIGTTOU, and SIGTSTP signals when it is
       interactive and the --mm option is not in effect, these signals suspend
       the shell if it is not a session leader. If it is a session leader, the
       signals are discarded if they would stop the process, as required by
       the System Interfaces volume of POSIX.1-2008, _S_e_c_t_i_o_n _2_._4_._3, _S_i_g_n_a_l
       _A_c_t_i_o_n_s for orphaned process groups.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _C_h_a_p_t_e_r _2, _S_h_e_l_l _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e, _c_d, _e_c_h_o, _e_x_i_t, _f_c, _p_w_d, _i_n_v_a_l_i_d,
       _s_e_t, _s_t_t_y, _t_e_s_t, _t_r_a_p, _u_m_a_s_k, _v_i

       The Base Definitions volume of POSIX.1-2008, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s

       The System Interfaces volume of POSIX.1-2008, _d_u_p(), _e_x_e_c, _e_x_i_t(),
       _f_o_r_k(), _o_p_e_n(), _p_i_p_e(), _s_i_g_n_a_l(), _s_y_s_t_e_m(), _u_l_i_m_i_t(), _u_m_a_s_k(), _w_a_i_t()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                                SH(1)
