home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1993-12-02 | 177.3 KB | 3,513 lines
SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) NNNNAAAAMMMMEEEE sh, rsh - shell, the standard/restricted command programming language SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS sssshhhh [ ----aaaacccceeeeffffhhhhiiiikkkknnnnmmmmrrrrssssttttuuuuvvvvxxxx0000RRRR ] [ args ] rrrrsssshhhh [ ----aaaacccceeeeffffhhhhiiiikkkknnnnmmmmrrrrssssttttuuuuvvvvxxxx0000RRRR ] [ args ] DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _S_h is a command programming language that executes commands read from a terminal or a file. _R_s_h is a restricted version of the standard command interpreter _s_h; it is used to set up login names and execution environments whose capabilities are more controlled than those of the standard shell. See _I_n_v_o_c_a_t_i_o_n below for the meaning of arguments to the shell. DDDDeeeeffffiiiinnnniiiittttiiiioooonnnnssss A _b_l_a_n_k is a tab or a space. A _n_a_m_e is a sequence of letters, digits, or underscores beginning with a letter or underscore. A _p_a_r_a_m_e_t_e_r is a name, a digit, or any of the characters ****, @@@@, ####, ????, ----, $$$$, and !!!!. CCCCoooommmmmmmmaaaannnnddddssss A _s_i_m_p_l_e-_c_o_m_m_a_n_d is a sequence of non-blank _w_o_r_d_s separated by _b_l_a_n_k_s. The first word specifies the name of the command to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command. The command name is passed as argument 0 (see _e_x_e_c(2)). The _v_a_l_u_e of a simple-command is its exit status if it ter- minates normally, or (octal) 200+_s_t_a_t_u_s if it terminates abnormally (see _s_i_g_n_a_l(2) for a list of status values). A _p_i_p_e_l_i_n_e is a sequence of one or more _c_o_m_m_a_n_d_s separated by |||| (or, for historical compatibility, by ^^^^). The standard output of each command but the last is connected by a _p_i_p_e(2) to the standard input of the next command. Each command is run as a separate process; the shell waits for the last command to terminate. The exit status of a pipe- line is the exit status of the last command. A _l_i_s_t is a sequence of one or more pipelines separated by ;;;;, &&&& (OOOOSSSS////2222 only), &&&&&&&&, or ||||||||, and optionally terminated by ;;;; or &&&& (OOOOSSSS////2222 only). Of these four symbols, ;;;; and &&&& have equal precedence, which is lower precedence than that of &&&&&&&& and ||||||||. The symbols &&&&&&&& and |||||||| also have equal precedence. A semicolon (;;;;) causes sequential execution of the preceding pipeline; an ampersand (&&&&) causes asynchronous execution of the preceding pipeline (i.e., the shell does not wait for that command to finish. This option is only available under OOOOSSSS////2222 and is restricted to single commands and not pipelines because of the differences in the UUUUNNNNIIIIXXXX and OOOOSSSS////2222 process models). The symbol &&&&&&&& (||||||||) causes the _l_i_s_t following it to MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 1 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) be executed only if the preceding pipeline returns a zero (non-zero) exit status. An arbitrary number of new-lines may appear in a _l_i_s_t, instead of semicolons, to delimit com- mands. A _c_o_m_m_a_n_d is either a simple-command or one of the follow- ing. Unless otherwise stated, the value returned by a com- mand is that of the last simple-command executed in the com- mand. ffffoooorrrr _n_a_m_e [ iiiinnnn _w_o_r_d ... ] ddddoooo _l_i_s_t ddddoooonnnneeee Each time a ffffoooorrrr command is executed, _n_a_m_e is set to the next _w_o_r_d taken from the iiiinnnn _w_o_r_d list. If iiiinnnn _w_o_r_d ... is omitted, then the ffffoooorrrr command executes the ddddoooo _l_i_s_t once for each positional parameter that is set (see _P_a_r_a_m_e_t_e_r _S_u_b_s_t_i_t_u_t_i_o_n below). Execution ends when there are no more words in the list. sssseeeelllleeeecccctttt _n_a_m_e [ iiiinnnn _w_o_r_d ... ] ddddoooo _l_i_s_t ddddoooonnnneeee A sssseeeelllleeeecccctttt command prints on standard error (file descriptor 2), the set of _w_o_r_ds, each preceded by a number. If iiiinnnn _w_o_r_d ... is omitted, then the positional parameters are used instead (see _P_a_r_a_m_e_t_e_r _S_u_b_s_t_i_t_u_t_i_o_n below). The PPPPSSSS3333 prompt is printed and a line is read from the standard input. If this line consists of the number of one of the listed _w_o_r_ds, then the value of the parameter _n_a_m_e is set to the _w_o_r_d corresponding to this number. If this line is empty the selection list is printed again. Otherwise the value of the parameter _n_a_m_e is set to null. The contents of the line read from standard input is saved in the parameter RRRREEEEPPPPLLLLYYYY. The list is executed for each selection until a break or end-of-file is encountered. ccccaaaasssseeee _w_o_r_d iiiinnnn [ _p_a_t_t_e_r_n [ | _p_a_t_t_e_r_n ] ... )))) _l_i_s_t ;;;;;;;; ] ... eeeessssaaaacccc A ccccaaaasssseeee command executes the _l_i_s_t associated with the first _p_a_t_t_e_r_n that matches _w_o_r_d. The form of the pat- terns is the same as that used for file-name generation (see _F_i_l_e _N_a_m_e _G_e_n_e_r_a_t_i_o_n) except that a slash, a lead- ing dot, or a dot immediately following a slash need not be matched explicitly, and the match is case sensi- tive. iiiiffff _l_i_s_t tttthhhheeeennnn _l_i_s_t [ eeeelllliiiiffff _l_i_s_t tttthhhheeeennnn _l_i_s_t ] ... [ eeeellllsssseeee _l_i_s_t ] ffffiiii The _l_i_s_t following iiiiffff is executed and, if it returns a zero exit status, the _l_i_s_t following the first tttthhhheeeennnn is executed. Otherwise, the _l_i_s_t following eeeelllliiiiffff is exe- cuted and, if its value is zero, the _l_i_s_t following the next tttthhhheeeennnn is executed. Failing that, the eeeellllsssseeee _l_i_s_t is executed. If no eeeellllsssseeee _l_i_s_t or tttthhhheeeennnn _l_i_s_t is executed, then the iiiiffff command returns a zero exit status. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 2 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) wwwwhhhhiiiilllleeee _l_i_s_t ddddoooo _l_i_s_t ddddoooonnnneeee A wwwwhhhhiiiilllleeee command repeatedly executes the wwwwhhhhiiiilllleeee _l_i_s_t and, if the exit status of the last command in the list is zero, executes the ddddoooo _l_i_s_t; otherwise the loop ter- minates. If no commands in the ddddoooo _l_i_s_t are executed, then the wwwwhhhhiiiilllleeee command returns a zero exit status; uuuunnnnttttiiiillll may be used in place of wwwwhhhhiiiilllleeee to negate the loop termination test. ((((_l_i_s_t)))) Execute _l_i_s_t in a sub-shell. The shell creates a new environment in which to execute the _l_i_s_t, but does not fork a sub-shell as a Unix system would. The original environment is restored on completion. {{{{ _l_i_s_t;;;; }}}} _l_i_s_t is simply executed. [[[[[[[[ _e_x_p_r_e_s_s_i_o_n ]]]]]]]] Evaluates expression and returns a zero exit status when expression is true. See CCCCoooonnnnddddiiiittttiiiioooonnnnaaaallll EEEExxxxpppprrrreeeessssssssiiiioooonnnnssss below, for a description of expression. Note that [[[[[[[[ and ]]]]]]]] are keywords and require blanks between them and expression. ffffuuuunnnnccccttttiiiioooonnnn _n_a_m_e {{{{ _l_i_s_t;;;; }}}} _n_a_m_e (((()))) {{{{ _l_i_s_t;;;; }}}} Define a function which is referenced by _n_a_m_e. The body of the function is the _l_i_s_t of commands between {{{{ and }}}}. Execution of functions is described below (see _E_x_e_c_u_t_i_o_n). The following words are only recognized as the first word of a command and when not quoted: iiiiffff tttthhhheeeennnn eeeellllsssseeee eeeelllliiiiffff ffffiiii ccccaaaasssseeee eeeessssaaaacccc ffffoooorrrr wwwwhhhhiiiilllleeee uuuunnnnttttiiiillll ddddoooo ddddoooonnnneeee {{{{ }}}} [[[[[[[[ ]]]]]]]] CCCCoooommmmmmmmeeeennnnttttssss A word beginning with #### causes that word and all the follow- ing characters up to a new-line to be ignored. AAAAlllliiiiaaaassssiiiinnnngggg The first word of each command is replaced by the text of an alias if an alias for this word has been defined. The alias name must a valid identifier. The replacement string can contain any valid Shell script including the metacharacters listed above. The first word of each command of the replaced text will not be tested for additional aliases. If the last character of the alias value is a blank then the word following the alias will also be checked for alias MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 3 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) substitution. Aliases can be used to redefine special buil- tin commands but cannot be used to redefine the keywords listed above. Aliases can be created and listed with the aaaalllliiiiaaaassss command and can be removed with the uuuunnnnaaaalllliiiiaaaassss command. Aliasing is performed when scripts are read, not while they are executed. Therefore, for an alias to take effect the alias command has to be executed before the command which references the alias is read. Aliases are frequently used as a short hand for full path names. An option to the aliasing facility allows the value of the alias to be automatically set to the full pathname of the corresponding command. These aliases are called tracked aliases. The value of a tracked alias is defined the first time the corresponding command is looked up and becomes undefined each time the PATH variable is reset. These aliases remain tracked so that the next subsequent reference will redefine the value. CCCCoooonnnnddddiiiittttiiiioooonnnnaaaallll EEEExxxxpppprrrreeeessssssssiiiioooonnnnssss A conditional expression is used with the [[[[[[[[ compound com- mand to test attributes of files and to compare strings. Word splitting and file name generation are not performed on the words between [[[[[[[[ and ]]]]]]]]. Each expression can be con- structed from one or more of the following unary or binary expressions: ----aaaa _f_i_l_e True if _f_i_l_e exists. ----bbbb _f_i_l_e True if _f_i_l_e exists and is a block special file. ----cccc _f_i_l_e True if _f_i_l_e exists and is a character spe- cial file. ----dddd _f_i_l_e True if _f_i_l_e exists and is a directory. ----ffff _f_i_l_e True if _f_i_l_e exists and is a regular file. ----gggg _f_i_l_e True if _f_i_l_e exists and has its setgid bit set. ----hhhh _f_i_l_e True if _f_i_l_e exists and is a symbolic link. ----kkkk _f_i_l_e True if _f_i_l_e exists and has its sticky bit set. Under MMMMSSSSDDDDOOOOSSSS and OOOOSSSS////2222, the sticky bit is equivalent to the ARCHIVED attribute. ----nnnn _s_t_r_i_n_g True if the length of _s_t_r_i_n_g is non-zero. ----oooo _o_p_t_i_o_n True if the _o_p_t_i_o_n named is on. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 4 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) ----pppp _f_i_l_e True if _f_i_l_e exists and is a fifo special file or a pipe. ----rrrr _f_i_l_e True if _f_i_l_e exists and is readable. ----ssss _f_i_l_e True if _f_i_l_e exists and has a size greater than zero. ----tttt [ _f_i_l_d_e_s ] True if the open file whose file descriptor number is _f_i_l_d_e_s (1 by default) is associ- ated with a terminal device. ----uuuu _f_i_l_e True if _f_i_l_e exists and has its setuid bit set. ----wwww _f_i_l_e True if _f_i_l_e exists and is writable. ----xxxx _f_i_l_e True if _f_i_l_e exists and is executable. If _f_i_l_e exists and is a directory, then the current process has permission to search in the directory. ----zzzz _s_t_r_i_n_g True if the length of _s_t_r_i_n_g is zero. ----LLLL _f_i_l_e True if _f_i_l_e exists and is a symbolic link. ----OOOO _f_i_l_e True if _f_i_l_e exists and is owned by the effective user id of this process. Under MMMMSSSSDDDDOOOOSSSS and OOOOSSSS////2222, the UID bit is equivalent to the HIDDEN attribute. ----GGGG _f_i_l_e True if _f_i_l_e exists and is owned by the effective user group of this process. Under MMMMSSSSDDDDOOOOSSSS and OOOOSSSS////2222, the GID bit is equivalent to the SYSTEM attribute. ----SSSS _f_i_l_e True if _f_i_l_e exists and is a socket. _f_i_l_e_1 ----nnnntttt _f_i_l_e_2 True if file1 is newer than file2. True if _f_i_l_e_1 exists and is newer than _f_i_l_e_2. _f_i_l_e_1 ----ooootttt _f_i_l_e_2 True if _f_i_l_e_1 exists and is older than _f_i_l_e_2. _f_i_l_e_1 ----eeeeffff _f_i_l_e_2 True if _f_i_l_e_1 and _f_i_l_e_2 and refer to the same file. Under MMMMSSSSDDDDOOOOSSSS and OOOOSSSS////2222, inode information is not available, and the shell compares the absolute filenames. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 5 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) _s_1 ==== _s_2 True if strings _s_1 and _s_2 are identical. _s_1 !!!!==== _s_2 True if strings _s_1 and _s_2 are _n_o_t identi- cal. _s_1 <<<< _s_2 True if string _s_1 comes before _s_2 are based on the ASCII value of their characters. _s_1 >>>> _s_2 True if string _s_1 comes after _s_2 are based on the ASCII value of their characters. _n_1 ----eeeeqqqq _n_2 True if _n_1 is equal to _n_2. _n_1 ----nnnneeee _n_2 True if _n_1 is not equal to _n_2. _n_1 ----lllltttt _n_2 True if _n_1 is less than to _n_2. _n_1 ----ggggtttt _n_2 True if _n_1 is greater than to _n_2. _n_1 ----lllleeee _n_2 True if _n_1 is less than or equal to _n_2. _n_1 ----ggggeeee _n_2 True if _n_1 is greater than or equal to _n_2. Not all of the above have meaning under MMMMSSSSDDDDOOOOSSSS or OOOOSSSS////2222. In such cases, the appropriate value is set (_f_a_l_s_e, except for ----OOOO and ----GGGG). A compound expression can be constructed from these primi- tives by using any of the following, listed in decreasing order of precedence. (((( _e_x_p_r )))) True, if _e_x_p_r is true. Used to group expressions. !!!! _e_x_p_r True, if _e_x_p_r is false. _e_x_p_r_1 &&&&&&&& _e_x_p_r_2 True, if _e_x_p_r_1 and _e_x_p_r_2 are both true. _e_x_p_r_1 |||||||| _e_x_p_r_2 True, if _e_x_p_r_1 or _e_x_p_r_2 is true. TTTTiiiillllddddeeee SSSSuuuubbbbssssttttiiiittttuuuuttttiiiioooonnnn Each word is checked to see if it begins with an unquoted ~~~~. If it is, the ~~~~ is replaced by the value of the HHHHOOOOMMMMEEEE parame- ter. A ~~~~ followed by a ++++ or ---- is replaced by the value of the parameter PPPPWWWWDDDD and OOOOLLLLDDDDPPPPWWWWDDDD respectively. CCCCoooommmmmmmmaaaannnndddd SSSSuuuubbbbssssttttiiiittttuuuuttttiiiioooonnnn The standard output from a command enclosed in parenthesis MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 6 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) preceded by a dollar sign ($$$$(((())))), or in a pair of grave accents (````````) may be used as part or all of a word; trailing new-lines are removed. The command substitution $$$$((((ccccaaaatttt _f_i_l_e)))) can be replaced by the equivalent but faster $$$$((((<<<<_f_i_l_e)))). PPPPaaaarrrraaaammmmeeeetttteeeerrrr SSSSuuuubbbbssssttttiiiittttuuuuttttiiiioooonnnn The character $$$$ is used to introduce substitutable _p_a_r_a_m_e_- _t_e_r_s. There are two types of parameters, positional and keyword. If _p_a_r_a_m_e_t_e_r is a digit, it is a positional param- eter. Positional parameters may be assigned values by sssseeeetttt. Keyword parameters (also known as variables) may be assigned values by writing: _n_a_m_e = _v_a_l_u_e [ _n_a_m_e = _v_a_l_u_e ] ... Pattern-matching is not performed on _v_a_l_u_e. There cannot be a function and a variable with the same _n_a_m_e. Alternatively, named parameters can be assigned values and attributes by using the typeset special command. $$$${{{{_p_a_r_a_m_e_t_e_r}}}} The value, if any, of the _p_a_r_a_m_e_t_e_r is substituted. The braces are required only when _p_a_r_a_m_e_t_e_r is followed by a letter, digit, or underscore that is not to be interpreted as part of its name. If _p_a_r_a_m_e_t_e_r is **** or @@@@, all the positional parameters, starting with $$$$1111, are substituted (separated by spaces). Parameter $$$$0000 is set from argument zero when the shell is invoked. $$$${{{{####_p_a_r_a_m_e_t_e_r}}}} If _p_a_r_a_m_e_t_e_r is **** or @@@@, the number of positional param- eters is substituted. Otherwise, the length of the value of the _p_a_r_a_m_e_t_e_r is substituted. $$$${{{{_p_a_r_a_m_e_t_e_r::::----_w_o_r_d}}}} If _p_a_r_a_m_e_t_e_r is set and is non-null, substitute its value; otherwise substitute _w_o_r_d. $$$${{{{_p_a_r_a_m_e_t_e_r::::====_w_o_r_d}}}} If _p_a_r_a_m_e_t_e_r is not set or is null set it to _w_o_r_d; the value of the parameter is substituted. Positional parameters may not be assigned to in this way. $$$${{{{_p_a_r_a_m_e_t_e_r::::????_w_o_r_d}}}} If _p_a_r_a_m_e_t_e_r is set and is non-null, substitute its value; otherwise, print _w_o_r_d and exit from the shell. If _w_o_r_d is omitted, the message ``parameter null or not set'' is printed. $$$${{{{_p_a_r_a_m_e_t_e_r::::++++_w_o_r_d}}}} If _p_a_r_a_m_e_t_e_r is set and is non-null, substitute _w_o_r_d; MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 7 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) otherwise substitute nothing. $$$${{{{_p_a_r_a_m_e_t_e_r####_p_a_t_t_e_r_n}}}} $$$${{{{_p_a_r_a_m_e_t_e_r########_p_a_t_t_e_r_n}}}} If the Shell _p_a_t_t_e_r_n matches the beginning of the value of _p_a_r_a_m_e_t_e_r, then the value of this substitution is the value of the _p_a_r_a_m_e_t_e_r with the matched portion deleted; otherwise the value of this _p_a_r_a_m_e_t_e_r is sub- stituted. In the first form the smallest matching _p_a_t_- _t_e_r_n is deleted and in the latter form the largest matching _p_a_t_t_e_r_n is deleted. $$$${{{{_p_a_r_a_m_e_t_e_r%%%%_p_a_t_t_e_r_n}}}} $$$${{{{_p_a_r_a_m_e_t_e_r%%%%%%%%_p_a_t_t_e_r_n}}}} If the Shell _p_a_t_t_e_r_n matches the end of the value of _p_a_r_a_m_e_t_e_r, then the value of this substitution is the value of the _p_a_r_a_m_e_t_e_r with the matched portion deleted; otherwise the value of this _p_a_r_a_m_e_t_e_r is sub- stituted. In the first form the smallest matching _p_a_t_- _t_e_r_n is deleted and in the latter form the largest matching _p_a_t_t_e_r_n is deleted. In the above, _w_o_r_d is not evaluated unless it is to be used as the substituted string, so that, in the following exam- ple, ppppwwwwdddd is executed only if dddd is not set or is null: echo ${d:-`pwd`} If the colon (::::) is omitted from the above expressions, the shell only checks whether _p_a_r_a_m_e_t_e_r is set or not (_I_t _i_s _n_o_t _c_l_e_a_r _w_h_a_t _t_h_i_s _m_e_a_n_s). The following parameters are automatically set by the shell: #### The number of positional parameters in decimal. ---- Flags supplied to the shell on invocation or by the sssseeeetttt command. ???? The decimal value returned by the last synchro- nously executed command. $$$$ The process number of this shell. !!!! The process number of the last background command invoked. ____ The last argument of the previous command. ~~~~ The shell reserves all variables beginning with a ~~~~ for its own internal use and these variables cannot be accessed by the user. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 8 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The following parameters are used by the shell: CCCCDDDDPPPPAAAATTTTHHHH The search path for the _c_d command. (Note that because a colon is used by MMMMSSSSDDDDOOOOSSSS to indicate a drive, a semi-colon is used to separate the path names instead of a colon - this implies that the CDPATH variable must be set using single or double quotes to surround the value). CCCCOOOOLLLLUUUUMMMMNNNNSSSS This variable is contains the number of columns on the screen. CCCCOOOOMMMMSSSSPPPPEEEECCCC When the shell has to process an MMMMSSSSDDDDOOOOSSSS ._b_a_t or OOOOSSSS////2222 ._c_m_d file, it expects the file indicated by the value of this environment variable to be an executable program capable of processing the MMMMSSSSDDDDOOOOSSSS ._b_a_t or OOOOSSSS////2222 ._c_m_d file. The program is invoked with the arguments ////cccc ffffiiiilllleeee____nnnnaaaammmmeeee. CCCCOOOOMMMMSSSSPPPPEEEECCCC is parsed and split on white space to allow addition parameters to be passed to command processor. Thus the default environment size could be set to 1000 by setting to _c_o_m_m_a_n_d /_e:_1_0_0_0. EEEEDDDDIIIITTTTOOOORRRR If the value of this variable ends in emacs or vi, and the VVVVIIIISSSSUUUUAAAALLLL variable is not set, then the corresponding option is turned on. EEEENNNNVVVV If this parameter is set, then parameter substitu- tion is performed on the value to generate the pathname of the script that will be executed when the shell is invoked (See Invocation below). This file is typically used for alias and function definitions. EEEEXXXXTTTTEEEENNNNDDDDEEEEDDDD____LLLLIIIINNNNEEEE This parameter pointers to a file which contains information for the shell about how command lines are to be built for particular external programs and how to convert from the format entered to the shell (see _C_o_m_m_a_n_d _L_i_n_e _B_u_i_l_d_i_n_g). FFFFCCCCEEEEDDDDIIIITTTT The default editor name for the fc command. HHHHIIIISSSSTTTTFFFFIIIILLLLEEEE The file where command history is saved across login sessions. The default value is $$$$HHHHOOOOMMMMEEEE////hhhhiiiissssttttoooorrrryyyy....sssshhhh. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 9 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) HHHHIIIISSSSTTTTSSSSIIIIZZZZEEEE The number of commands normally stored for his- tory, default 100. HHHHOOOOMMMMEEEE The default argument (home directory) for the _c_d command. IIIIFFFFSSSS Internal field separators, normally ssssppppaaaacccceeee, ttttaaaabbbb, and nnnneeeewwww----lllliiiinnnneeee. LLLLIIIINNNNEEEENNNNOOOO This variable contains the current line number in the script being processed. LLLLIIIINNNNEEEESSSS This variable contains the number of lines on the screen. MMMMAAAAIIIILLLL If this parameter is set to the name of a mail file _a_n_d the MMMMAAAAIIIILLLLPPPPAAAATTTTHHHH parameter is not set, the shell informs the user of the arrival of mail in the specified file. MMMMAAAAIIIILLLLCCCCHHHHEEEECCCCKKKK This parameter specifies how often (in seconds) the shell will check for the arrival of mail in the files specified by the MMMMAAAAIIIILLLLPPPPAAAATTTTHHHH or MMMMAAAAIIIILLLL param- eters. If set to 0, the shell will check before each prompt. MMMMAAAAIIIILLLLPPPPAAAATTTTHHHH A semi-colon (;;;;) separated list of file names. If this parameter is set, the shell informs the user of the arrival of mail in any of the specified files. Each file name can be followed by %%%% and a message that will be printed when the modification time changes. The default message is "_y_o_u _h_a_v_e _m_a_i_l". OOOOLLLLDDDDPPPPWWWWDDDD The previous working directory set by the ccccdddd com- mand. OOOOPPPPTTTTAAAARRRRGGGG The value of the last option argument processed by the ggggeeeettttooooppppttttssss special command. OOOOPPPPTTTTIIIINNNNDDDD The index of the last option argument processed by the ggggeeeettttooooppppttttssss special command. OOOOSSSSMMMMOOOODDDDEEEE MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 10 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The operating system under which the shell is run- ning (0 - MMMMSSSSDDDDOOOOSSSS, 1 - OOOOSSSS////2222). PPPPAAAATTTTHHHH The search path for commands (see _E_x_e_c_u_t_i_o_n below). The user may not change PPPPAAAATTTTHHHH if executing under _r_s_h. (Note that because a colon is used by MMMMSSSSDDDDOOOOSSSS to indicate a drive, a semi-colon is used to separate the path names instead of a colon - this implies that the PATH variable must be set using single or double quotes to surround the value). The Shell automatically converts Unix format PPPPAAAATTTTHHHH assignments to MMMMSSSSDDDDOOOOSSSS format when appropriate. A assignment is converted if there are no semi- colons, no \\\\s and one or more colons. If there is only one colon, it must not be the second charac- ter of the new value. PPPPWWWWDDDD The present working directory set by the ccccdddd com- mand. PPPPSSSS1111 Primary prompt string, by default ``$$$$ ''. PPPPSSSS2222 Secondary prompt string, by default ``>>>> ''. PPPPSSSS3333 Selection prompt string used within a select loop, ``####???? ''. PPPPSSSS4444 The value of this parameter is expanded for param- eter substitution and precedes each line of an execution trace. If omitted, the execution trace prompt is ``+ ''. RRRRAAAANNNNDDDDOOOOMMMM Each time this parameter is referenced, a random integer is generated. The sequence of random numbers can be initialized by assigning a numeric value to RRRRAAAANNNNDDDDOOOOMMMM. RRRREEEEPPPPLLLLYYYY This parameter is set by the sssseeeelllleeeecccctttt statement and by the rrrreeeeaaaadddd special command when no arguments are supplied. SSSSEEEECCCCOOOONNNNDDDDSSSS Each time this parameter is referenced, the number of seconds since shell invocation is returned. If this parameter is assigned a value, then the value returned upon reference will be the value that was assigned plus the number of seconds since the assignment. SSSSHHHHEEEELLLLLLLL MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 11 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) When the shell is invoked, it scans the environ- ment (see _E_n_v_i_r_o_n_m_e_n_t below) for this name. If it is found and there is an 'r' in the file name part of its value, the shell becomes a restricted shell. The shell also uses this variable to decide which program to spawn to interpret shell scripts (see _E_x_e_c_u_t_i_o_n below). SSSSHHHHMMMMOOOODDDDEEEE The compilation mode of shell - 16 or 32 bit. VVVVIIIISSSSUUUUAAAALLLL If the value of this variable ends in emacs or vi, then the corresponding option is turned on. TTTTMMMMPPPP The location of temporary files created by the shell. If this variable is not defined, the Shell uses the HHHHOOOOMMMMEEEE directory for temporary files. Failing that, the root directory of the current drive is used. WWWWIIIINNNNTTTTIIIITTTTLLLLEEEE Under OOOOSSSS////2222, the name of the shell's window. The shell gives default values to PPPPAAAATTTTHHHH, PPPPSSSS1111, PPPPSSSS2222, SSSSHHHHEEEELLLLLLLL, HHHHOOOOMMMMEEEE and IIIIFFFFSSSS. AAAAlllltttteeeerrrrnnnnaaaattttiiiioooonnnn The ccccsssshhhh provides a filename expandsion method known as alternation. This has been added into this version of the ksh. When performing filename substitution, you can get the shell to create a set of strings for you. For example: _e_x_a_m_p_l{_a,_b,_c,_d,_e} will expand to _e_x_a_m_p_l_a _e_x_a_m_p_l_b _e_x_a_m_p_l_c _e_x_a_m_p_l_d _e_x_a_m_p_l_e. A common separated set of strings in curly braces will be expanded into a set of strings that are passed into the command. The strings are not sorted. The set of strings may contain parameter substitutions. AAAArrrriiiitttthhhhmmmmeeeettttiiiicccc EEEExxxxppppaaaannnnssssiiiioooonnnn A string of the form $$$$((((((((_e_x_p)))))))) is substitued with the value of the arithemtic expression _e_x_p. _e_x_p is treated as if it were within single quotes. See AAAArrrriiiitttthhhhmmmmeeeettttiiiicccc EEEEvvvvaaaalllluuuuaaaattttiiiioooonnnn below. BBBBllllaaaannnnkkkk IIIInnnntttteeeerrrrpppprrrreeeettttaaaattttiiiioooonnnn After parameter and command substitution, the results of substitution are scanned for internal field separator char- acters (those found in IIIIFFFFSSSS) and split into distinct argu- ments where such characters are found. Explicit null argu- ments ("""""""" or '''''''') are retained. Implicit null arguments (those resulting from _p_a_r_a_m_e_t_e_r_s that have no values) are removed. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 12 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) FFFFiiiilllleeee NNNNaaaammmmeeee GGGGeeeennnneeeerrrraaaattttiiiioooonnnn Following substitution, each command _w_o_r_d is scanned for the characters ****, ???? and [[[[. If one of these characters appears the word is regarded as a _p_a_t_t_e_r_n. The word is replaced with alphabetically sorted file names that match the pat- tern. If no file name is found that matches the pattern, the word is left unchanged. The character .... at the start of a file name or immediately following a ////, as well as the character //// itself, must be matched explicitly. When match- ing patterns for file names, the shell ignores the case of the pattern and the file directory entries. Generated file names are always in lower case (for FAT file systems). Under HPFS on OOOOSSSS////2222, case is preserved. **** Matches any string, including the null string. ???? Matches any single character. [[[[ ............ ]]]] Matches any one of the enclosed characters. A pair of characters separated by ---- matches any character lexically between the pair, inclusive. If the first character following the opening ``['' is a ````````!!!!'''''''' any character not enclosed is matched. If the shell has to open or create the file ////ddddeeeevvvv////ttttttttyyyy or ////ddddeeeevvvv////nnnnuuuullllllll (which are Unix special files), they are converted to the equivalent MMMMSSSSDDDDOOOOSSSS file names (////ddddeeeevvvv////ccccoooonnnn and ////ddddeeeevvvv////nnnnuuuullll respectively). Any user programs which could expect ////ddddeeeevvvv////ttttttttyyyy or ////ddddeeeevvvv////nnnnuuuullllllll as arguments must do its own mapping to the MMMMSSSSDDDDOOOOSSSS equivalents. The shell checks for valid FAT filenames (single dot, not at the beginning). Invalid dots are converted to ~~~~. A warning message is displayed if the shell detects an invalid file name. QQQQuuuuoooottttiiiinnnngggg The following characters have a special meaning to the shell and cause termination of a word unless quoted: ;;;; &&&& (((( )))) |||| ^^^^ <<<< >>>> nnnneeeewwww----lllliiiinnnneeee ssssppppaaaacccceeee ttttaaaabbbb A character may be _q_u_o_t_e_d (i.e., made to stand for itself) by preceding it with a \\\\. The pair \\\\nnnneeeewwww----lllliiiinnnneeee is ignored. All characters enclosed between a pair of single quote marks (''''''''), except a single quote, are quoted. Inside double quote marks (""""""""), parameter and command substitution occurs and \\\\ quotes the characters \\\\, ````, """", and $$$$. """"$$$$****"""" is equivalent to """"$$$$1111 $$$$2222 ............"""", whereas """"$$$$@@@@"""" is equivalent to """"$$$$1111"""" """"$$$$2222"""" ............. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 13 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) AAAArrrriiiitttthhhhmmmmeeeettttiiiicccc EEEEvvvvaaaalllluuuuaaaattttiiiioooonnnn An ability to perform integer arithmetic is provided with the special command lllleeeetttt. Evaluations are performed using _l_o_n_g arithmetic. Constants are of the form _b_a_s_e#_n where _b_a_s_e is a decimal number between two and thirty-six representing the arithmetic base and _n is a number in that base. If _b_a_s_e# is omitted then base 10 is used. An arithmetic expression uses nearly the same syntax pre- cedence, and associatively of expression as C. The follow- ing set of operators, listed in order of decreasing pre- cedence, have been implemented: - + ! ~ ++ -- unary minus/plus, logical NOT, comple- ment, {pre, post}{in,de}crement & Logical AND ^ Logical XOR | Logical OR * / % multiplication, division, remainder + - addition, subtraction << >> Logical shift left and right <= >= < > comparison == != equality inequality && Logical AND || ^^ Logical OR, XOR ? : Ternary operator = += -= *= /= assignement %= &= ^= |= <<= >>= &&= ||= ^^= The operators &&&&&&&&, ||||||||, &&&&&&&&==== and ||||||||==== are short-circuiting and only one of the latter two expressions in a ternary operator is evaluated. Note the precedence of the logical AND, XOR and OR operators. Sub-expressions in parentheses () are evaluated first and can be used to override the above precedence rules. Named parameters can be reference by name within an expres- sion without using the parameter substitution symtax. Since many of the arithmetic operators require quoting, an alternative form of the lllleeeetttt command is provided. For any command which begins with a ((((((((, all the characters until a matching )))))))) are treated as a quoted expression. More pre- cisely, ((((((((............)))))))) is equivalent to lllleeeetttt """"............"""". PPPPrrrroooommmmppppttttiiiinnnngggg When used interactively, the shell prompts with the value of PPPPSSSS1111 before reading a command. If at any time a new-line is typed and further input is needed to complete a command, the secondary prompt (i.e., the value of PPPPSSSS2222) is issued. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 14 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) Many people like to have the shell provide them with useful information in their prompt. To accommodate this, the shell recognises special sequences of characters in the values of PPPPSSSS1111 and PPPPSSSS2222, and substitutes the appropriate information for them. The special sequences and what they signify are: %%%%dddd Place the current date, in the form DAY DD-MM-YY into the prompt. %%%%eeee Place the current event number (as defined by the hhhhiiiissssttttoooorrrryyyy command) into the prompt. If history evaluation has been turned off (via hhhhiiiissssttttoooorrrryyyy ----dddd), no number will be substituted in (i.e. the %%%%eeee will be removed). %%%%nnnn Place the current working drive into the prompt. %%%%pppp Place the current working directory into the prompt. %%%%tttt Place the current time of day, in the form HH:MM into the prompt. The time is on a 24 hour clock, i.e. 1:30 in the afternoon will be 13:30. %%%%vvvv Place the MMMMSSSSDDDDOOOOSSSS version number, in the form MSDOS MM:MM into the prompt. %%%%%%%% Place the character % into the prompt. \\\\xxxxxxxxxxxx Place the character \_x_x_x into the prompt. The processing of escape sequences is the same as that for eeeecccchhhhoooo. Some of these facilities are of more use than others. IIIInnnnppppuuuutttt////OOOOuuuuttttppppuuuutttt Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. The following may appear anywhere in a simple- command or may precede or follow a _c_o_m_m_a_n_d and are _n_o_t passed on to the invoked command; substitution occurs before _w_o_r_d or _d_i_g_i_t is used: <<<<wwwwoooorrrrdddd Use file _w_o_r_d as standard input (file descrip- tor 0). >>>>wwwwoooorrrrdddd Use file _w_o_r_d as standard output (file descriptor 1). If the file does not exist it is created; otherwise, it is truncated to zero length. >>>>>>>>wwwwoooorrrrdddd Use file _w_o_r_d as standard output. If the file MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 15 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) exists output is appended to it (by first seeking to the end-of-file); otherwise, the file is created. <<<<<<<<[----]wwwwoooorrrrdddd The shell input is read up to a line that is the same as _w_o_r_d, or to an end-of-file. The resulting document becomes the standard input. If any character of _w_o_r_d is quoted, no interpretation is placed upon the characters of the document; otherwise, parameter and com- mand substitution occurs, (unescaped) \\\\nnnneeeewwww---- lllliiiinnnneeee is ignored, and \\\\ must be used to quote the characters \\\\, $$$$, ````, and the first charac- ter of _w_o_r_d. If ---- is appended to <<<<<<<<, all leading tabs are stripped from _w_o_r_d and from the document. <<<<&&&&ddddiiiiggggiiiitttt Use the file associated with file descriptor _d_i_g_i_t as standard input. Similarly for the standard output using >>>>&&&&ddddiiiiggggiiiitttt. <<<<&&&&---- The standard input is closed. Similarly for the standard output using >>>>&&&&----. nnnn<<<<>>>>wwwwoooorrrrdddd causes the file _w_o_r_d to be opened on file descriptor _n for both reading and writing. The file must already exist. If any of the above is preceded by a digit, the file descriptor which will be associated with the file is that specified by the digit (instead of the default 0 or 1). For example: ... 2>&1 associates file descriptor 2 with the file currently associ- ated with file descriptor 1. The order in which redirections are specified is signifi- cant. The shell evaluates redirections left-to-right. For example: ... 1>_x_x_x 2>&1 first associates file descriptor 1 with file _x_x_x. It asso- ciates file descriptor 2 with the file associated with file descriptor 1 (i.e. _x_x_x). If the order of redirections were reversed, file descriptor 2 would be associated with the terminal (assuming file descriptor 1 had been) and file descriptor 1 would be associated with file _x_x_x . MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 16 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The environment for the execution of a command contains the file descriptors of the invoking shell as modified by input/output specifications. Redirection of output is not allowed in the restricted shell. EEEEnnnnvvvviiiirrrroooonnnnmmmmeeeennnntttt The _e_n_v_i_r_o_n_m_e_n_t (see _e_n_v_i_r_o_n(5)) is a list of name-value pairs that is passed to an executed program in the same way as a normal argument list. The shell interacts with the environment in several ways. On invocation, the shell scans the environment and creates a parameter for each name found, giving it the corresponding value. If the user modifies the value of any of these parameters or creates new parameters, none of these affects the environment unless the eeeexxxxppppoooorrrrtttt com- mand is used to bind the shell's parameter to the environ- ment (see also sssseeeetttt ----aaaa). A parameter may be removed from the environment with the uuuunnnnsssseeeetttt command. The environment seen by any executed command is thus composed of any unmodified name-value pairs originally inherited by the shell, minus any pairs removed by uuuunnnnsssseeeetttt, plus any modifications or addi- tions, all of which must be noted in eeeexxxxppppoooorrrrtttt commands. The environment for any _s_i_m_p_l_e-_c_o_m_m_a_n_d may be augmented by prefixing it with one or more assignments to parameters. Thus: TERM=450 cmd args and (export TERM; TERM=450; cmd args) are equivalent (as far as the execution of _c_m_d is con- cerned). If the ----kkkk flag is set, _a_l_l keyword arguments are placed in the environment, even if they occur after the command name. The following first prints aaaa====bbbb cccc and cccc: echo a=b c set -k echo a=b c SSSSiiiiggggnnnnaaaallllssss The INTERRUPT and QUIT signals for an invoked command are ignored if the command is followed by &&&&; otherwise signals have the values inherited by the shell from its parent, with the exception of signal 11 (but see also the ttttrrrraaaapppp command below). MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 17 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) CCCCoooommmmmmmmaaaannnndddd RRRReeee----eeeennnnttttrrrryyyy The text of the last HHHHIIIISSSSTTTTSSSSIIIIZZZZEEEE (default: 100) commands entered from a terminal device is saved in a _h_i_s_t_o_r_y file. The file $$$$HHHHOOOOMMMMEEEE////hhhhiiiissssttttoooorrrryyyy....sssshhhh is used if the HHHHIIIISSSSTTTTFFFFIIIILLLLEEEE variable is not set. The special command ffffcccc is used to list or edit a portion of this file. The portion of the file to be edited or listed can be selected by number or by giving the first character or characters of the command. A single com- mand or range of commands can be specified. If you do not specify an editor program as an argument to ffffcccc, the value of the parameter FFFFCCCCEEEEDDDDIIIITTTT is used. The edited command is printed and re-executed upon leaving the editor. The editor name ---- is used to skip the editing phase and to re-execute the com- mand. In this case a substitution parameter of the form _o_l_d====_n_e_w can be used to modify the command before execution. For example, if rrrr is aliased to ````ffffcccc ----eeee ----'''', typing `rrrr bbbbaaaadddd====ggggoooooooodddd cccc' re-executes the most recent command that starts with the letter cccc and replaces the first occurrence of the string bbbbaaaadddd with the string ggggoooooooodddd. HHHHiiiissssttttoooorrrryyyy When reading input from an interactive terminal and vvvviiii, eeeemmmmaaaaccccssss or ggggmmmmaaaaccccssss input editing mode has not been selected (see IIIInnnn----lllliiiinnnneeee EEEEddddiiiittttiiiinnnngggg OOOOppppttttiiiioooonnnnssss), a ``!'' at the start of a line signals to the shell that it should attempt to perform a history subsitution. A history subsitution is a short-hand method which allows the user to recall a previous command for execution or editing. The recalled command is placed in the command line for editing or passing to the rest of the shell for normal processing. A history substitution takes the form: !!!! [ ! | _s_t_r | _n_u_m ] _t_e_r_m_i_n_a_t_o_r !!!!!!!! will place the previous command in the command line. !!!!_n_u_m will place the history command with the specified number in the command line. !!!!_s_t_r will find the most recent command line that started with the characters in _s_t_r. The _t_e_r_m_i_n_a_t_o_r determines what action is performed after the history line has been found. If the original history com- mand is entered using the <<<<rrrreeeettttuuuurrrrnnnn>>>> key, the new command line is passed directly to the shell. If the <<<<eeeennnndddd>>>> key is pressed, the new command line can be edited in the manner described below. CCCCoooommmmmmmmaaaannnndddd LLLLiiiinnnneeee EEEEddddiiiittttiiiinnnngggg When reading input from an interactive terminal, certain keystrokes allow the current input line to be edited. The following keystrokes corresponding to the following func- tions are defined in the initialisation file sssshhhh....iiiinnnniiii. The keywords in the initialisation file which provide the MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 18 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) functions are listed below: RRRRiiiigggghhhhtttt Move the cursor right one character WWWWoooorrrrddddRRRRiiiigggghhhhtttt Move the cursor right one word LLLLeeeefffftttt Move the cursor left one character WWWWoooorrrrddddLLLLeeeefffftttt Move the cursor left one word PPPPrrrreeeevvvviiiioooouuuussss Get the previous command from the history file NNNNeeeexxxxtttt Get the next command from the history file IIIInnnnsssseeeerrrrtttt Toggle insert/overwrite mode (note the shape of the cursor changes to indicate the current mode) DDDDeeeelllleeeetttteeeeRRRRiiiigggghhhhtttt Delete the current character unless the cursor is at the end of line when no action is taken SSSSttttaaaarrrrtttt Move the cursor to the start of the command CCCCoooommmmpppplllleeeetttteeee Attempt to complete the filename. The shell attempts to complete the file name at the current cursor posi- tion. The file name is delimited by white space char- acters. If the shell is unable to complete the file name (ie no match can be found in the appropriate directory), the bell is rung. If a single match is found, the new file name is displayed. If multiple matches are found, the file name is replaced by the longest non-unique part of the file name and the bell is rung. EEEEnnnndddd Move the cursor to the end of the command, unless the first character of the command is a !!!!, in which case the appropriate history search is done. The cursor is placed at the end of the command line. FFFFlllluuuusssshhhh Delete to the end of the line SSSSccccaaaannnnBBBBaaaacccckkkkwwwwaaaarrrrdddd Search backwards from the current history command for the next match against the last history request or the MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 19 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) string currently in the command line if there has been no previous history request. SSSSccccaaaannnnFFFFoooorrrreeeewwwwaaaarrrrdddd Search forewards from the current history command for the next match against the last history request or the string currently in the command line if there has been no previous history request. CCCClllleeeeaaaarrrr Erase the complete line. CCCClllleeeeaaaarrrrSSSSccccrrrreeeeeeeennnn Clears the complete screen. This function is only available under OOOOSSSS////2222. DDDDiiiirrrreeeeccccttttoooorrrryyyy Display the file name list matching the partially entered file name under the cursor. If no matches are found the bell is rung. To display the whole direc- tory, enter the directory name followed by a slash ////. After the directory listing has been displayed, the entered command line is redisplayed. DDDDeeeelllleeeetttteeeeLLLLeeeefffftttt Delete the character to the left of the cursor. RRRReeeettttuuuurrrrnnnn Execute the command line, unless the first character of the command is a !!!!, in which case the appropriate his- tory processing is done. _T_h_i_s _i_s _t_h_e _a_c_t_u_a_l _k_e_y _p_r_e_s_s_e_d _a_n_d _c_a_n_n_o_t _b_e _m_o_d_i_f_i_e_d _b_y _t_h_e _i_n_i_t_i_a_l_i_s_a_t_i_o_n _f_i_l_e. JJJJoooobbbbssss Print a list of the child processes of the shell. This function is only available under OOOOSSSS////2222. TTTTrrrraaaannnnssssppppoooosssseeee Transpose the two characters under the cursor. QQQQuuuuooootttteeee Disable any special processing for the next keystroke. IIIInnnn----lllliiiinnnneeee EEEEddddiiiittttiiiinnnngggg OOOOppppttttiiiioooonnnnssss Normally, each command line entered from a terminal device is simply typed followed by a new-line (`RETURN' or `LINE FEED'), see previous section. If the vvvviiii option is active, the user can edit the command line. To be in this edit mode sssseeeetttt the vvvviiii option. An editing option is automatically selected each time the VVVVIIIISSSSUUUUAAAALLLL or EEEEDDDDIIIITTTTOOOORRRR variable is assigned a value ending in either of these option names. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 20 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The editing mode implements a concept where the user is looking through a window at the current line. The window width is the value of CCCCOOOOLLLLUUUUMMMMNNNNSSSS if it is defined, otherwise _8_0. If the line is longer than the window width minus two, a mark is displayed at the end of the window to notify the user. As the cursor moves and reaches the window boundaries the window will be centered about the cursor. The mark is a >>>> (<<<<, ****) if the line extends on the right (left, both) side(s) of the window. The search commands in each edit mode provide access to the history file. Only strings are matched, not patterns, although a leading ^^^^ in the string restricts the match to begin at the first character in the line. VVVViiii EEEEddddiiiittttiiiinnnngggg MMMMooooddddeeee There are two typing modes. Initially, when you enter a command you are in the input mode. To edit, the user enters control mode by typing ESC (\\\\000033333333) and moves the cursor to the point needing correction and then inserts or deletes characters or words as needed. Most control commands accept an optional repeat count prior to the command. In edit mode, the key mappings defined in the initialisation file are mapped onto the appropriate vvvviiii edit command. IIIInnnnppppuuuutttt EEEEddddiiiitttt CCCCoooommmmmmmmaaaannnnddddssss By default the editor is in input mode. _b_a_c_k_s_p_a_c_e Deletes previous character. CCCCttttrrrrllll----WWWW Deletes the previous blank separated word. CCCCttttrrrrllll----DDDD Terminates the shell. CCCCttttrrrrllll----VVVV Escapes the next character. Editing characters can be entered in a command line or in a search string if preceded by a CCCCttttrrrrllll----VVVV. The CCCCttttrrrrllll----VVVV removes the next character's editing features (if any). \\\\ Escapes the next _e_d_i_t_i_n_g character. MMMMoooottttiiiioooonnnn EEEEddddiiiitttt CCCCoooommmmmmmmaaaannnnddddssss These commands move the cursor: MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 21 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) [_C_o_u_n_t]llll Moves the cursor forward (right) one character. [_C_o_u_n_t]wwww Moves the cursor forward one alphanumeric word. [_C_o_u_n_t]WWWW Moves the cursor to the beginning of the next word that follows a blank. [_C_o_u_n_t]eeee Moves the cursor to end of the current word. [_C_o_u_n_t]EEEE Moves the cursor to end of the current blank- separated word. [_C_o_u_n_t]hhhh Moves the cursor backward (left) one character. [_C_o_u_n_t]bbbb Moves the cursor backward one word. [_C_o_u_n_t]BBBB Moves the cursor to the previous blank-separated word. [_C_o_u_n_t]|||| Moves the cursor to the column specified by the _c_o_u_n_t parameter. [_C_o_u_n_t]ffffcccc Finds the next character _c in the current line. [_C_o_u_n_t]FFFFcccc Finds the previous character _c in the current line. [_C_o_u_n_t]ttttcccc Equivalent to ffff followed by hhhh. [_C_o_u_n_t]TTTTcccc Equivalent to FFFF followed by llll. [_C_o_u_n_t];;;; Repeats for the number of times specified by the _c_o_u_n_t parameter the last single-character find command: ffff, FFFF, tttt, or TTTT. [_C_o_u_n_t],,,, Reverses the last single-character find command the number of times specified by the _c_o_u_n_t MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 22 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) parameter. 0000 Moves the cursor to start of line. ^^^^ Moves the cursor to first nonblank character in line. $$$$ Moves the cursor to end of line. SSSSeeeeaaaarrrrcccchhhh EEEEddddiiiitttt CCCCoooommmmmmmmaaaannnnddddssss These commands access your command history: [_C_o_u_n_t]kkkk Fetches the previous command. Each time kkkk is entered, the previous command is accessed. [_C_o_u_n_t]---- Equivalent to kkkk. [_C_o_u_n_t]jjjj Fetches the next command. Each time jjjj is entered, the next command is accessed. [_C_o_u_n_t]++++ Equivalent to jjjj. [_C_o_u_n_t]GGGG Fetches the command whose number is specified by the _c_o_u_n_t parameter. The default is the least recent history command. ////_S_t_r_i_n_g Searches backward through history for a previous command containing the specified _s_t_r_i_n_g. The _s_t_r_i_n_g is terminated by a RETURN or new-line char- acter. If the specified string is preceded by a ^^^^ (caret), the matched line must begin with _s_t_r_i_n_g. If the value of the _s_t_r_i_n_g parameter is null, the previous string is used. ????_S_t_r_i_n_g Same as ////_S_t_r_i_n_g except that the search is in the forward direction. nnnn Searches for the next match of the last pattern to //// or ???? commands. NNNN Searches for the next match of the last pattern to //// or ???? commands, but in the opposite direction. Searches history for the _s_t_r_i_n_g entered by the previous //// command. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 23 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) TTTTeeeexxxxtttt MMMMooooddddiiiiffffiiiiccccaaaattttiiiioooonnnn EEEEddddiiiitttt CCCCoooommmmmmmmaaaannnnddddssss These commands modify the line: aaaa Enters the input mode and enters text after the current character. AAAA Appends text to the end of the line. Equivalent to $$$$aaaa. [_C_o_u_n_t]cccc_M_o_t_i_o_n cccc[_C_o_u_n_t]_M_o_t_i_o_n Deletes the current character through the charac- ter to which the _m_o_t_i_o_n parameter specifies to move the cursor, and enters input mode. If the value of the _m_o_t_i_o_n parameter is cccc, the entire line is deleted and the input mode is entered. CCCC Deletes the current character through the end of the line and enters input mode. Equivalent to cccc$$$$. SSSS Equivalent to cccccccc. DDDD Deletes the current character through the end of line. Equivalent to dddd$$$$. [_C_o_u_n_t]dddd_M_o_t_i_o_n dddd[_C_o_u_n_t]_M_o_t_i_o_n Deletes the current character up to and including the character specified by the _m_o_t_i_o_n parameter. If _m_o_t_i_o_n is dddd, the entire line is deleted. iiii Enters the input mode and inserts text before the current character. IIII Inserts text before the beginning of the line. Equivalent to 0000iiii. [_C_o_u_n_t]PPPP Places the previous text modification before the cursor. [_C_o_u_n_t]pppp Places the previous text modification after the cursor. RRRR Enters the input mode and types over the charac- ters on the screen. [_C_o_u_n_t]rrrr_c Replaces the number of characters specified by the _c_o_u_n_t parameter, starting at the current cursor MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 24 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) position, with the characters specified by the _c variable. Advances the cursor after the charac- ters are replaced. [_C_o_u_n_t]xxxx Deletes the current character. [_C_o_u_n_t]XXXX Deletes the preceding character. [_C_o_u_n_t].... Repeats the previous text modification command. [_C_o_u_n_t]~~~~ Inverts the case of the number of characters specified by the _c_o_u_n_t parameter, starting at the current cursor position, and advances the cursor. [_C_o_u_n_t]____ Causes the word specified by the _c_o_u_n_t parameter word of the previous command to be appended, and enters input mode. The last word is used if the _c_o_u_n_t parameter is omitted. **** Appends an **** (asterisk) to the current word and attempts filename substitution. If no match is found, it rings the bell. Otherwise, the word is replaced by the matching pattern and input mode is entered. \\\\ File-name completion. Replaces the current word with the longest common prefix of all file names matching the current word with an asterisk appended. If the match is unique, a //// (slash) is appended if the file is a directory and a space is appended if the file is not a directory. OOOOtttthhhheeeerrrr EEEEddddiiiitttt CCCCoooommmmmmmmaaaannnnddddssss Other miscellaneous edit commands include: [_C_o_u_n_t]yyyy_M_o_t_i_o_n yyyy[_C_o_u_n_t]_M_o_t_i_o_n Yanks the current character through the character to which the _m_o_t_i_o_n parameter specifies to move the cursor and puts these characters into the delete buffer. The text and cursor are unchanged. YYYY Yanks from the current position to the end of the line. Equivalent to yyyy$$$$. uuuu Undoes the last text-modifying command. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 25 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) UUUU Undoes all the text-modifying commands performed on the line. [_C_o_u_n_t]vvvv Returns the command ffffcccc ----eeee $$$${{{{VVVVIIIISSSSUUUUAAAALLLL::::----$$$${{{{EEEEDDDDIIIITTTTOOOORRRR::::----vvvviiii}}}}}}}} _c_o_u_n_t in the input buffer. If the _c_o_u_n_t parameter is omitted, then the current line is used. CCCCttttrrrrllll----LLLL Line-feeds and prints the current line. Has effect only in control mode. CCCCttttrrrrllll----JJJJ (New line) Executes the current line, regardless of the mode. CCCCttttrrrrllll----MMMM (Return) Executes the current line, regardless of the mode. #### Sends the line after inserting a #### (hash sign) in front of the line. Useful for causing the current line to be inserted in the history without being executed. ==== Lists the file names that match the current word as if an asterisk were appended to it. @@@@LLLLeeeetttttttteeeerrrr Searches the alias list for an alias named _Letter. If an alias of this name is defined, its value is placed into the input queue for process- ing. EEEEMMMMAAAACCCCSSSS EEEEddddiiiittttiiiinnnngggg MMMMooooddddeeee When the eeeemmmmaaaaccccssss option is set, interactive input line editing is enabled. This mode is slightly different from the emacs mode in AT&T's KornShell. In this mode various _e_d_i_t_i_n_g _c_o_m_- _m_a_n_d_s (typically bound to one or more control characters) cause immediate actions without waiting for a new-line. Several _e_d_i_t_i_n_g _c_o_m_m_a_n_d_s are bound to particular control characters when the shell is invoked; these bindings can be changed using the bbbbiiiinnnndddd command. The following _e_d_i_t_i_n_g _c_o_m_m_a_n_d_s are available, where a caret indicates the control character, and ^[ is the ASCII ESC character. Note that _e_d_i_t_i_n_g _c_o_m_m_a_n_d names are used only with the bbbbiiiinnnndddd command. The default bindings were chosen to resemble corresponding EMACS key bindings. ___________________________________________________________________________________________________________ Editing command Default Function ___________________________________________________________________________________________________________ MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 26 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) pppprrrreeeeffffiiiixxxx----3333 0xE0 Introduces a 2-character command sequence. This prefix allows the user to map PC function keys onto commands. The second character is the IBM scan code value of the function key to be assigned. For example: _F_1 has a scan code of ;;;;; _C_t_r_l-_F_1 has a scan code of ^^^^; _S_h_i_f_t-_F_1 has a scan code of TTTT; _A_l_t-_F_1 has a scan code of hhhh. bbbbeeeeggggiiiinnnnnnnniiiinnnngggg----ooooffff----lllliiiinnnneeee Ctrl-A Moves the cursor to start of line. bbbbaaaacccckkkkwwwwaaaarrrrdddd----cccchhhhaaaarrrr Ctrl-B Moves the cursor backward (left) one character. eeeeooootttt----oooorrrr----ddddeeeelllleeeetttteeee Ctrl-D Acts as _e_n_d-_o_f-_f_i_l_e if alone on a line; otherwise deletes current character. eeeennnndddd----ooooffff----lllliiiinnnneeee Ctrl-E Moves the cursor to end of line. ffffoooorrrrwwwwaaaarrrrdddd----cccchhhhaaaarrrr Ctrl-F Moves the cursor forward one position. aaaabbbboooorrrrtttt Ctrl-G Useful as a response to a request for a sssseeeeaaaarrrrcccchhhh----hhhhiiiissssttttoooorrrryyyy pattern in order to abort the search. ddddeeeelllleeeetttteeee----cccchhhhaaaarrrr----bbbbaaaacccckkkkwwwwaaaarrrrdddd Ctrl-H Deletes the previous character. nnnneeeewwwwlllliiiinnnneeee Ctrl-M Ctrl-J Executes the current line. kkkkiiiillllllll----ttttoooo----eeeeoooollll Ctrl-K Deletes from the cursor to the end of the line. If pre- ceded by a numerical parameter whose value is less than the current cursor position, this editing command deletes from the given position up to the cursor. If preceded by a numerical parameter whose value is greater than the current cursor position, this editing command deletes from the cursor up to given cursor position. rrrreeeeddddrrrraaaawwww Ctrl-L Linefeeds and print the current line. ddddoooowwwwnnnn----hhhhiiiissssttttoooorrrryyyy Ctrl-N Fetches the next command line. Each time Ctrl-N is entered, the next command line forward in time is accessed. ooooppppeeeerrrraaaatttteeee Ctrl-O Executes the current line and fetches the next line relative to the current line from the history file. uuuupppp----hhhhiiiissssttttoooorrrryyyy Ctrl-P Fetches the previous command. Each time CCCCttttrrrrllll----PPPP is entered, the previous command back in time is accessed. Moves back one line when not on the first line of a mul- tiple line command. sssseeeeaaaarrrrcccchhhh----hhhhiiiissssttttoooorrrryyyy Ctrl-R _S_t_r_i_n_g Reverses search history for a previous command line con- taining the string specified by the SSSSttttrrrriiiinnnngggg parameter. If a value of zero is given, the search is forward. The specified ssssttttrrrriiiinnnngggg is terminated by an _E_n_t_e_r or _n_e_w-_l_i_n_e character. If the ssssttttrrrriiiinnnngggg is preceded by a ^^^^ (caret character), the matched line must begin with SSSSttttrrrriiiinnnngggg. If the SSSSttttrrrriiiinnnngggg parameter is omitted, then the next command line containing the most recent SSSSttttrrrriiiinnnngggg is accessed. In this case, a value of zero reverses the direction of the search. ttttrrrraaaannnnssssppppoooosssseeee----cccchhhhaaaarrrrssss Ctrl-T Transposes the current character with the next character in eeeemmmmaaaaccccssss mode. Transposes the two previous characters in ggggmmmmaaaaccccssss mode. kkkkiiiillllllll----lllliiiinnnneeee Ctrl-U Deletes the entire input line. kkkkiiiillllllll----rrrreeeeggggiiiioooonnnn Ctrl-W Kills from the cursor to the mark. pppprrrreeeeffffiiiixxxx----2222 Ctrl-X Introduces a 2-character command sequence. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 27 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) ppppoooopppp----tttteeeexxxxtttt Ctrl-Y Restores the last item removed from line. (Yanks the item back to the line.) sssseeeeaaaarrrrcccchhhh----cccchhhhaaaarrrr----ffffoooorrrrwwwwaaaarrrrdddd Ctrl-] _c Moves the cursor forward on the current line to the indicated character. sssseeeeaaaarrrrcccchhhh----cccchhhhaaaarrrr----bbbbaaaacccckkkkwwwwaaaarrrrdddd _P_r_e_f_i_x-_1 Ctrl-] _c Search backwards in the current line for the next key- board character. Moves the cursor backword on the current line to the indicated character. qqqquuuuooootttteeee Ctrl-^ \ Escapes the next character. Editing characters can be entered in a command line or in a search string if pre- ceded by a _q_u_o_t_e command. The escape removes the next character's editing features, if any. eeeeooootttt Ctrl-_ Acts as an end-of-file. ccccoooommmmmmmmeeeennnntttt----eeeexxxxeeeeccccuuuutttteeee _P_r_e_f_i_x-_1 # Inserts a #### (pound sign) at the beginning of the line and then execute the line. This causes a comment to be inserted in the history file. ccccoooommmmpppplllleeeetttteeee----lllliiiisssstttt _P_r_e_f_i_x-_1 * Attempts file name substitution on the current word. An asterisk is appended if the word doesn't match any file or contain any special pattern characters. pppprrrreeeevvvv----hhhhiiiisssstttt----wwwwoooorrrrdddd ccccooooppppyyyy----llllaaaasssstttt----aaaarrrrgggg _P_r_e_f_i_x-_1 . _P_r_e_f_i_x-_1 _ Inserts on the line the last word of the previous com- mand. If preceded by a numeric parameter, the value of this parameter determines which word to insert rather than the last word. Note I/O redirections do not count as words of the command. bbbbeeeeggggiiiinnnnnnnniiiinnnngggg----ooooffff----hhhhiiiissssttttoooorrrryyyy _P_r_e_f_i_x-_1 < Fetches the least recent (oldest) history line. lllliiiisssstttt _P_r_e_f_i_x-_1 = Prints a sorted, columnated list of file names (if any) that can complete the partial word containing the cur- sor. Directory names have //// postpended to them, and executable file names are followed by ****. eeeennnndddd----ooooffff----hhhhiiiissssttttoooorrrryyyy _P_r_e_f_i_x-_1 > Fetches the most recent (youngest) history line. bbbbaaaacccckkkkwwwwaaaarrrrdddd----wwwwoooorrrrdddd _P_r_e_f_i_x-_1 B Moves the cursor backward one word. ccccaaaappppiiiittttaaaalllliiiisssseeee----wwwwoooorrrrdddd _P_r_e_f_i_x-_1 C Capitalises the current word. ddddeeeelllleeeetttteeee----wwwwoooorrrrdddd----bbbbaaaacccckkkkwwwwaaaarrrrdddd _P_r_e_f_i_x-_1 Ctrl-H _P_r_e_f_i_x-_1 H Deletes the previous word. ddddeeeelllleeeetttteeee----wwwwoooorrrrdddd----ffffoooorrrrwwwwaaaarrrrdddd _P_r_e_f_i_x-_1 D Deletes the current word. pppprrrreeeeffffiiiixxxx----1111 ESC Introduces a 2-character command sequence. Three intro- ducers are available. ccccoooommmmpppplllleeeetttteeee _P_r_e_f_i_x-_1 ESC File-name completion. Replaces the current word with the longest common prefix of all file names that match the current word with an asterisk appended. If the match is unique, a //// (slash) is appended if the file is a directory and a space is appended if the file is not a directory. ffffoooorrrrwwwwaaaarrrrdddd----wwwwoooorrrrdddd _P_r_e_f_i_x-_1 F Moves the cursor forward one word (a string of charac- ters consisting of only letters, digits, and under- scores). ddddoooowwwwnnnnccccaaaasssseeee----wwwwoooorrrrdddd _P_r_e_f_i_x-_1 L Changes the current word to lowercase. mmmmuuuullllttttiiiippppllllyyyy _P_r_e_f_i_x-_1 M Multiplies the parameter of the next command by 4. uuuuppppccccaaaasssseeee----wwwwoooorrrrdddd _P_r_e_f_i_x-_1 U Change the current word to upper-case. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 28 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) _P_r_e_f_i_x-_1 DDDDiiiiggggiiiittttssss Defines the numeric parameter. The ddddiiiiggggiiiittttssss are taken as a parameter to the next command. The commands that accept a parameter are _f_o_r_w_a_r_d-_c_h_a_r, _b_a_c_k_w_a_r_d-_c_h_a_r, _b_a_c_k_w_a_r_d-_w_o_r_d, _f_o_r_w_a_r_d-_w_o_r_d, _d_e_l_e_t_e-_w_o_r_d-_f_o_r_w_a_r_d, _d_e_l_e_t_e-_c_h_a_r-_f_o_r_w_a_r_d, _d_e_l_e_t_e-_w_o_r_d-_b_a_c_k_w_a_r_d, _d_e_l_e_t_e-_c_h_a_r- _b_a_c_k_w_a_r_d, _p_r_e_v-_h_i_s_t-_w_o_r_d, _c_o_p_y-_l_a_s_t-_a_r_g, _u_p-_h_i_s_t_o_r_y, _d_o_w_n-_h_i_s_t_o_r_y, _s_e_a_r_c_h-_h_i_s_t_o_r_y, _u_p_c_a_s_e-_w_o_r_d, _d_o_w_n_c_a_s_e- _w_o_r_d, _c_a_p_i_t_a_l_i_s_e-_w_o_r_d, _u_p_c_a_s_e-_c_h_a_r, _d_o_w_n_c_a_s_e-_c_h_a_r, _c_a_p_i_t_a_l_i_s_e-_c_h_a_r, _k_i_l_l-_t_o-_e_o_l, _s_e_a_r_c_h-_c_h_a_r-_f_o_r_w_a_r_d and _s_e_a_r_c_h-_c_h_a_r-_b_a_c_k_w_a_r_d. ccccaaaappppiiiittttaaaalllliiiisssseeee----cccchhhhaaaarrrr _P_r_e_f_i_x-_1 c Capitalises the current character. ddddoooowwwwnnnnccccaaaasssseeee----cccchhhhaaaarrrr _P_r_e_f_i_x-_1 l Change the character under the cursor to lower case. ppppuuuusssshhhh----tttteeeexxxxtttt _P_r_e_f_i_x-_1 p Pushes the region from the cursor to the mark on the stack. sssseeeetttt----mmmmaaaarrrrkkkk _P_r_e_f_i_x-_1 space Sets a mark. uuuuppppccccaaaasssseeee----cccchhhhaaaarrrr _P_r_e_f_i_x-_1 u Change the character under the cursor to upper case. yyyyaaaannnnkkkk----ppppoooopppp _P_r_e_f_i_x-_1 y Immediately after a yyyyaaaannnnkkkk, replaces the inserted text string with the next previous killed text string. eeeexxxxcccchhhhaaaannnnggggeeee----ppppooooiiiinnnntttt----aaaannnndddd----mmmmaaaarrrrkkkk _P_r_e_f_i_x-_2 Ctrl-X Interchanges the cursor and the mark. jjjjoooobbbbssss _P_r_e_f_i_x-_2 j Print a list of the current jobs (OS/2 only). aaaauuuuttttoooo----iiiinnnnsssseeeerrrrtttt Simply causes the character to appear as literal input. (Most ordinary characters are bound to this.) ddddeeeelllleeeetttteeee----cccchhhhaaaarrrr----ffffoooorrrrwwwwaaaarrrrdddd Deletes the character after the cursor. nnnnoooo----oooopppp Does nothing. cccclllleeeeaaaarrrr----ssssccccrrrreeeeeeeennnn Clear the screen and print the current line. rrrreeeesssseeeetttt Reset input, clearing the current line and yank buffers. _P_r_e_f_i_x-_1 Ctrl-] LLLLeeeetttttttteeeerrrr Search the alias list for an alias named __L_e_t_t_e_r. If an alias of this name is defined, its value is placed into the input queue. _P_r_e_f_i_x-_1 LLLLeeeetttttttteeeerrrr Search the alias list for an alias named __L_e_t_t_e_r. If an alias of this name is defined, its value is placed into the input queue. The LLLLeeeetttttttteeeerrrr parameter must not specify one of the escape functions. IIIInnnniiiittttiiiiaaaalllliiiissssaaaattttiiiioooonnnn FFFFiiiilllleeee When the shell is run in interactive mode, the Command Line Editing keys and other user configuration parameters are read from the initialisation file _s_h._i_n_i. This shell looks for this file in the same directory as the sssshhhh executable which is running. It does not use the SSSSHHHHEEEELLLLLLLL environment variable or search the directories in the PPPPAAAATTTTHHHH environment variable. At present, there are two types of entry in this file: keyboard configuration; and others. The entry is con- tained in a single line and consists of a keyword (in upper or lower case), white space, an equals symbols, white space and one or two numeric values (see _s_t_r_t_o_l(_3) for valid for- mats where _b_a_s_e parameter is zero), followed by an end of line character. For the keyboard entries, the numeric values give the MMMMSSSSDDDDOOOOSSSS Function 8 (Console Input without Echo) return values for that entry. Note that extended codes (function keys) MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 29 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) require two calls to this function. The first call returns zero and the second the extended code. In the configuration file, a first numeric value of zero indicates a extended code and must be followed by a second value. The shell also supports the use of the AAAALLLLTTTT _k_e_y _i_n _c_o_m_b_i_n_a_t_i_o_n _w_i_t_h _a_n_o_t_h_e_r _k_e_y. _I_n _t_h_i_s _c_a_s_e, _t_h_e _f_i_r_s_t _v_a_l_u_e _c_o_n_t_a_i_n_s 0000xxxxffffffff, that selects AAAALLLLTTTT key, and the second key contains the appropriate scan code for the key required. The program sssshhhhoooowwwwkkkkeeeeyyyy can be used to determine the scan codes required. A non-zero first numeric value must not be followed by any- thing else on the line. Other entries must only have one numeric value. A zero value disables the function and a non-zero value enables the function. At present, there are two other functions: BBBBeeeellllllll Enable/disable warning bells HHHHaaaallllffffHHHHeeeeiiiigggghhhhtttt Use full or halfheight block cursor to indicate Insert mode IIIInnnnsssseeeerrrrttttMMMMooooddddeeee Set the default insert mode on or off IIIInnnnsssseeeerrrrttttCCCCuuuurrrrssssoooorrrr Enable/disable the insert mode cursor. RRRRoooooooottttDDDDrrrriiiivvvveeee Determines the root drive from which to read /_e_t_c/_p_r_o_f_i_l_e. EEEEOOOOFFFFKKKKeeeeyyyy Determines the End-of-File key. Invalid lines or lines beginning with a #### are ignored. The following table gives the list of valid keywords and their default values: MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 30 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) _________________________________________________________________________ Keyword First numeric Second numeric Actual Key _________________________________________________________________________ KEYBOARD ENTRIES ScanBackward 0 0x49 PAGE UP ScanForeward 0 0x51 PAGE DOWN Previous 0 0x48 UP ARROW Next 0 0x50 DOWN ARROW Left 0 0x4b LEFT ARROW Right 0 0x4d RIGHT ARROW WordRight 0 0x74 Control RIGHT ARROW WordLeft 0 0x73 Control LEFT ARROW Start 0 0x47 HOME Clear 0 0x76 Control PAGE DOWN Flush 0 0x75 Control END End 0 0x4f END Insert 0 0x52 INSERT DeleteRight 0 0x53 DELETE DeleteLeft 0x08 BACKSPACE Complete 0 0x77 Control HOME Directory 0 0x0f Shift TAB ClearScreen 0 0x84 Control PAGE UP Jobs 0 0x68 ALT F1 Transpose 0x14 Control T Quote 0x11 Control Q _________________________________________________________________________ OTHER FUNCTIONS Bell 0 HalfHeight 0 InsertMode 0 InsertCursor 1 RootDrive 3 EOFKey 0x1a _________________________________________________________________________ EEEExxxxeeeeccccuuuuttttiiiioooonnnn Each time a command is executed, the above substitutions are carried out. If the command name matches one of the _S_p_e_c_i_a_l _C_o_m_m_a_n_d_s listed below, it is executed in the shell process. If the command name does not match a _S_p_e_c_i_a_l _C_o_m_m_a_n_d, but matches the name of a defined function, the function is exe- cuted in the shell process (note how this differs from the execution of shell procedures). The positional parameters $$$$1111, $$$$2222, .... are set to the arguments of the function. If the command name matches neither a _S_p_e_c_i_a_l _C_o_m_m_a_n_d nor the name of a defined function, a new process is created and an attempt is made to execute the command via _e_x_e_c(2). The shell parameter PPPPAAAATTTTHHHH defines the search path for the directory containing the command. Alternative directory names are separated by a semi-colon (;;;;). The default path is ....;;;;cccc::::////bbbbiiiinnnn;;;;cccc::::////uuuussssrrrr////bbbbiiiinnnn (specifying the current directory, cccc::::////bbbbiiiinnnn, and cccc::::////uuuussssrrrr////bbbbiiiinnnn, in that order). Note that the current directory is specified by a null path name, which MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 31 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) can appear immediately after the equal sign or between the semi-colon delimiters anywhere else in the path list. If the command name contains a //// or starts with xxxx:::: (where x is a drive letter) the search path is not used; such commands will not be executed by the restricted shell. Otherwise, each directory in the path is searched for an executable file. Executable files are indicated by a .exe or .com extension. This extension is automatically supplied by the shell and not have to be entered by the user. If the file with a .com or .exe extension cannot be found in the directory, the file is opened and first 512 characters are read. If there are no characters in the block with a value in the range 0 to 7, the file is assumed to be a script file containing shell commands. Note that the shell will check the file and if that file does not exist or is not a script, it will try the file with an extension of ....sssshhhh or ....kkkksssshhhh. If a ((((ggggiiiivvvveeeennnn bbbbyyyy tttthhhheeee eeeennnnvvvviiiirrrroooonnnnmmmmeeeennnntttt vvvvaaaarrrriiiiaaaabbbblllleeee SSSSHHHHEEEELLLLLLLL) is spawned to read it. If the script file starts with the a line of the form #! _i_n_t_e_r_p_r_e_t_e_r [_a_r_g_u_m_e_n_t_s], the interpreter is invoked instead of the shell to process the script. Optional arguments can be supplied in the script file which are passed before the name of the script file. Thus, if the file _d_e_m_o contained the following string as the first line #! perl -sP Entering _d_e_m_o _n_a_m_e would be equivalent to entering the _p_e_r_l -_s_P _n_a_m_e at the command prompt. Note that no other process- ing of the first line other that the separation (by white space) into arguments is done. Note that if the iiiinnnntttteeeerrrrpppprrrreeeetttteeeerrrr is either /_b_i_n/_s_h or /_b_i_n/_k_s_h, the value of the SSSSHHHHEEEELLLLLLLL environment variable is used to execute the script. If none of the above conditions for a executable file are detected and a file with a .bat extension exists in the directory, the command processor given by the CCCCOOOOMMMMSSSSPPPPEEEECCCC environment variable is spawned to process the file. This is normally the standard MMMMSSSSDDDDOOOOSSSS _c_o_m_m_a_n_d._c_o_m or OOOOSSSS////2222 _c_m_d._e_x_e processor. A parenthesized command is also executed in a sub-shell. CCCCoooommmmmmmmaaaannnndddd LLLLiiiinnnneeee BBBBuuuuiiiillllddddiiiinnnngggg The file pointed to by the EEEEXXXXTTTTEEEENNNNDDDDEEEEDDDD____LLLLIIIINNNNEEEE parameter contains information which instructs the shell on how to create the command line for a particular program from the information entered to the shell. If the program name is not found in this file, the standard MMMMSSSSDDDDOOOOSSSS or OOOOSSSS////2222 mechanisms are used with no special processing. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 32 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The file is scanned prior to the execution of an external command. An entry in this file is contained in a single line and consists of a program name (in upper or lower case), white space, an equals symbol, white space and the program type followed by up to four optional values, fol- lowed by an end of line character. The vvvvaaaalllluuuueeee tells the shell how to build the command line and the optional values provide additional information. The valid pppprrrrooooggggrrrraaaammmm ttttyyyyppppeeeessss are (note that invalid entries cause a line to be ignored) given below. These pppprrrrooooggggrrrraaaammmm ttttyyyyppppeeeessss must appear as the first value following the _e_q_u_a_l_s. Otherwise, they are ignored. An empty pppprrrrooooggggrrrraaaammmm ttttyyyyppppeeeessss may be empty to only select one or more of the optional values. Under OOOOSSSS////2222, by default the shell generates the command line using the format specified by Eberhard Mattes's EMX inter- face. This is makes no difference to programs which do not support the interface. uuuunnnniiiixxxx This program can process the command line using the indirect command file character @@@@. When a program, which can process this format, finds a command line parameter starting with a @@@@ in the command line, it treats the rest of the parameter as a file and reads the command line parameters from that file (one per line, the end of line characters can be escaped by preceeding with a \\\\). Examples of this functionality include the Stan- dard LLLLiiiinnnnkkkkeeeerrrr and LLLLiiiibbbbrrrraaaarrrriiiiaaaannnn. The file name is set up in UUUUNNNNIIIIXXXX format (using //// as the directory separators). This functionality allows the user to get round the 127 byte command line length limit of MMMMSSSSDDDDOOOOSSSS. A sample version of the code to process wild cards and indirect command files is included with the source of the shell in the file _s_t_d_a_r_g_v._c. ddddoooossss This program can process the command line using the indirect command file character @@@@. The file name is set up in DOS format (using \\\\s as the directory separators). eeeennnnvvvviiiirrrroooonnnn The command line is passed to the external program in the environment variable specified by the first optional value. The optional second value which is numeric, gives the parameter separator charac- ter to be used (see _s_t_r_t_o_l(_3) for valid formats where _b_a_s_e parameter is zero). If this second value is missing or evaluates to zero, space is MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 33 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) used. The following optional values described below may be used after either uuuunnnniiiixxxx or ddddoooossss or by themselves: sssswwwwiiiittttcccchhhh The optional value sssswwwwiiiittttcccchhhh causes the program parameters to be converted from UUUUNNNNIIIIXXXX format to MMMMSSSSDDDDOOOOSSSS format. This means that parameters begin- ning with an ---- have it converted to a ////. For all other parameters, ////s are converted to \\\\s. This option is not applied to quoted parameters or escaped characters. This functionality allows ease of entry of MMMMSSSSDDDDOOOOSSSS commands which expect MMMMSSSSDDDDOOOOSSSS directory separators which the shell interpretes as the escape charac- ter (not that the underlying MMMMSSSSDDDDOOOOSSSS really cares). eeeexxxxppppoooorrrrtttt The optional value eeeexxxxppppoooorrrrtttt causes the marked environment variables to be converted from UUUUNNNNIIIIXXXX format to MMMMSSSSDDDDOOOOSSSS format. This is equivalent to setting the -m flag for this program only. nnnnooooeeeexxxxppppaaaannnndddd The optional value nnnnooooeeeexxxxppppaaaannnndddd disables file name generation when building the command line (also see sssseeeetttt command). nnnnoooosssswwwwaaaapppp The optional value nnnnoooosssswwwwaaaapppp disables swapping for the command. This may speed up the execution of small commands. nnnnooooqqqquuuuooootttteeee The optional value nnnnooooqqqquuuuooootttteeee stops the shell from escaping double quotes in the command line before they are passed to the command. Double quotes processed by some programs. FFFFuuuunnnnccccttttiiiioooonnnnssss The ffffuuuunnnnccccttttiiiioooonnnn keyword, described in the CCCCoooommmmmmmmaaaannnnddddssss section above, is used to define shell functions. Shell functions are read in and stored internally. Alias names are resolved when the function is read. Functions are executed like com- mands with the arguments passed as positional parameters. (See EEEExxxxeeeeccccuuuuttttiiiioooonnnn above). Functions execute in the same process as the caller and share all files and present working directory with the caller. Traps caught by the caller are reset to their MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 34 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) default action inside the function. A trap condition that is not caught or ignored by the function causes the function to terminate and the condition to be passed on to the caller. A trap set on EXIT inside a function is executed after the function completes. Ordinarily, variables are shared between the calling program and the function. However, the ttttyyyyppppeeeesssseeeetttt special command used within a function defines local variables whose scope includes the current function and all functions it calls. The special command rrrreeeettttuuuurrrrnnnn is used to return from function calls. Errors within functions return control to the caller. Function identifiers can be listed with the ffffuuuunnnnccccttttiiiioooonnnn special command. The text of functions will also be listed. Func- tion can be undefined with the uuuunnnnffffuuuunnnnccccttttiiiioooonnnn special command. Ordinarily, functions are unset when the shell executes a shell script. Functions that need to be defined across separate invocations of the shell should be placed in the EEEENNNNVVVV file. JJJJoooobbbbssss Under OOOOSSSS////2222, an interactive shell associates a _j_o_b with each pipeline. It keeps a table of current jobs, printed by the jjjjoooobbbbssss command, and assigns them small integer numbers. When a job is started asynchronously with &&&&, the shell prints a line that looks like: [1] 1234 indicating job number 1 was started asynchronously and had one (top-level) process whose process ID was 1234. There are several ways to refer to jobs in the shell. A job can be referred to by the process id of any process in the job or by one of the following: %_n_u_m_b_e_r The job with the given number. %_s_t_r_i_n_g Any job whose command line begins with string. %?_s_t_r_i_n_g Any job whose command line contains string. %% Current job. %+ Equivalent to %%. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 35 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) %- Previous job. The shell learns when a process changes state. It informs the user when a job terminates, but only just before it prints a prompt. If you try to leave the shell while jobs are running or stopped, you are warned, _Y_o_u _h_a_v_e _r_u_n_n_i_n_g _j_o_b_s_f_R. _Y_o_u _m_a_y _u_s_e _t_h_e jjjjoooobbbbssss command to identify them. If you immediately try to exit again, the shell will not warn you a second time. SSSSppppeeeecccciiiiaaaallll CCCCoooommmmmmmmaaaannnnddddssss Input/output redirection is permitted for these commands. File descriptor 1 is the default output location. :::: No effect; the command does nothing. A zero exit code is returned. _l_e_t_t_e_r:::: Select the drive specified by _l_e_t_t_e_r. .... _f_i_l_e Read and execute commands from _f_i_l_e and return. The search path specified by PPPPAAAATTTTHHHH is used to find the directory containing _f_i_l_e. aaaalllliiiiaaaassss [ ----tttt ] [ _n_a_m_e[=_v_a_l_u_e ] ... ] AAAAlllliiiiaaaassss with no arguments prints the list of aliases in the form _n_a_m_e=vvvvaaaalllluuuueeee on standard output. An alias is defined for each _n_a_m_e whose _v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word to be checked for alias substitution. The ----tttt flag is used to set and list tracked aliases. The _v_a_l_u_e of a tracked alias is the full pathname corresponding to the given name. The _v_a_l_u_e becomes undefined when the _v_a_l_u_e of PATH is reset but the aliases remained tracked. Without the ----tttt flag, for each _n_a_m_e in the argument list for which no _v_a_l_u_e is given, the _n_a_m_e and _v_a_l_u_e of the alias is printed. Alias returns zero unless a _n_a_m_e is given for which no alias has been defined. bbbbiiiinnnndddd -m [ _s_t_r_i_n_g ] = [ _e_d_i_t_i_n_g-_c_o_m_m_a_n_d ] BBBBiiiinnnndddd with no arguments prints the list of EMACS key bindings in the form _n_a_m_e=vvvvaaaalllluuuueeee on standard output. The specified _e_d_i_t_i_n_g _c_o_m_m_a_n_d is bound to the given _s_t_r_i_n_g, which should consist of a control character (which may be written using ``caret notation'' ^^^^_x), optionally preceded by one of the two prefix characters. Future input of the _s_t_r_i_n_g will cause the _e_d_i_t_i_n_g _c_o_m_m_a_n_d to be immediately invoked. Three prefix characters (nor- mal ESC and ^X) are supported. If the -_m flag is MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 36 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) supplied, the specified input _s_t_r_i_n_g will afterwards be immediately replaced by the given _e_d_i_t_i_n_g-_c_o_m_m_a_n_d string, which may contain _e_d_i_t_i_n_g _c_o_m_m_a_n_d_s. bbbbrrrreeeeaaaakkkk [ _n ] Exit from the enclosing ffffoooorrrr or wwwwhhhhiiiilllleeee loop, if any. If _n is specified, break _n levels. bbbbuuuuiiiillllttttiiiinnnn [ _a_r_g_s ... ] Force the selection of the bbbbuuuuiiiillllttttiiiinnnn version of a com- mand. The builtin shell command selected by the first _a_r_g_s value is executed with the parameters defined by the remaining _a_r_g_ss. If no arguments are given, a list of all _b_u_i_l_t_i_n commands is printed. If the first argument is one of the following, the pro- cessing of the builtin command in the following argu- ments are changed as indicated: ----aaaa Set the following builtin commands to use builtin version in preference to any function or external versions. ----dddd Set the following builtin commands to use the function or external version in preference to the builtin version. ----ssss Display the current status of the following buil- tin commands. ccccoooonnnnttttiiiinnnnuuuueeee [ _n ] Resume the next iteration of the enclosing ffffoooorrrr or wwwwhhhhiiiilllleeee loop. If _n is specified, resume at the _n-th enclosing loop. ccccdddd [ ----LLLLPPPP ] [ _a_r_g ] ccccdddd _s_e_a_r_c_h _r_e_p_l_a_c_e This command can be in either of two forms. In the first form it changes the current direc- tory to _a_r_g. The shell parameter HHHHOOOOMMMMEEEE is the default _a_r_g. The shell parameter CCCCDDDDPPPPAAAATTTTHHHH defines the search path for the directory containing _a_r_g. Alternative directory names are separated by a semi-colon (;;;;). The default path is <<<<nnnnuuuullllllll>>>> (specifying the current direc- tory). Note that the current directory is specified by a null path name, which can appear immediately after the equal sign or between the semi-colon delimiters anywhere else in the path list. If _a_r_g begins with a //// or xxxx:::: (where x is a drive letter), the search path is not used. Otherwise, each directory in the path is searched for _a_r_g. The _c_d command may not be executed by _r_s_h. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 37 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The -_L option (default) preserves logical naming when treating substituted drives (see SSSSUUUUBBBBSSSSTTTT((((1111))))). ccccdddd ----LLLL ........ moves the current directory one path component closer to the root directory. The ----PPPP option preserves the physical path when treating substituted drives. ccccdddd ----PPPP ........ changes the working directory to the parent direc- tory of the current directory. These options are only available under the MSDOS 16 bit version. In the second form, ccccdddd substitutes the string _r_e_p_l_a_c_e for the string _s_e_a_r_c_h in the current directory name, PPPPWWWWDDDD and tries to change to this new directory. Note that the name cccchhhhddddiiiirrrr is an builtin alternative name for ccccdddd, allowing the user to set up aliases for ccccdddd and still have access to the change directory functional- ity. ddddeeeettttaaaacccchhhh _p_r_o_g_r_a_m [ _a_r_g_s ] This command (which is only available under OOOOSSSS////2222) starts and simultaneously detaches an OOOOSSSS////2222 _p_r_o_g_r_a_m from the shell. Any _p_r_o_g_r_a_m that is started with ddddeeeettttaaaacccchhhh command must be able to process independently outside the control of the shell. Builtin shell commands and functions cannot be detached. eeeecccchhhhoooo [ _a_r_g ... ] Echo arguments. EEEEcccchhhhoooo writes its arguments separated by blanks and terminated by a new-line on the standard output. It also understands C-like escape conventions; beware of conflicts with the shell's use of \\\\: \\\\bbbb backspace \\\\cccc print line without new-line \\\\ffff form-feed \\\\nnnn new-line \\\\rrrr carriage return \\\\tttt tab \\\\vvvv vertical tab \\\\\\\\ backslash \\\\_n the 8-bit character whose ASCII code is the 1-, 2- or 3-digit octal number _n, which must start with a zero. _E_c_h_o is useful for producing diagnostics in com- mand files and for sending known data into a pipe. eeeevvvvaaaallll [ _a_r_g ... ] The arguments are read as input to the shell and the resulting command(s) executed. eeeexxxxeeeecccc [ _a_r_g ... ] MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 38 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may appear and, if no other arguments are given, cause the shell input/output to be modified. eeeexxxxiiiitttt [ _n ] Causes a shell to exit with the exit status specified by _n. If _n is omitted the exit status is that of the last command executed (an end-of-file will also cause the shell to exit.) eeeexxxxppppoooorrrrtttt [ _n_a_m_e[=_v_a_l_u_e] ... ] The given _n_a_m_es are marked for automatic export to the _e_n_v_i_r_o_n_m_e_n_t of subsequently-executed commands. If no arguments are given, a list of all names that are exported in this shell is printed. Function names may _n_o_t be exported. ffffaaaallllsssseeee No effect; the command does nothing. A non-zero exit code is returned. ffffcccc [ ----eeee _E_d_i_t_o_r_N_a_m_e ] [ ----nnnnllllrrrr ] [ _F_i_r_s_t [ _L_a_s_t ] ] ffffcccc ----eeee ---- [ _O_l_d=_N_e_w ] [ _C_o_m_m_a_n_d ] In the first form, a range of commands from _F_i_r_s_t to _L_a_s_t is selected from the last 100 commands that were typed at the terminal. The _F_i_r_s_t and _L_a_s_t parameters can be specified as a number or as a string. A string locates the most recent command starting with the given string. A negative number is used as an offset to the current command number. If _L_a_s_t is not specified, then it is set to _F_i_r_s_t. If _F_i_r_s_t is not specified, the default is the previous command for editing and -16 for listing. ----llll Lists the commands to standard output. ----rrrr Reverses the order of the commands in the list. ----nnnn Suppresses command numbers when listing. If the ----llll flag is not specified, the editor program specified by _E_d_i_t_o_r_N_a_m_e is invoked on a file containing these key-board commands. If _E_d_i_t_o_r_N_a_m_e is not sup- plied, then the value of the FFFFCCCCEEEEDDDDIIIITTTT parameter is used as the editor. When editing is complete, the edited command(s) is executed. In the second form, the specified _c_o_m_m_a_n_d is carried out again after the _O_l_d=_N_e_w substitution is performed. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 39 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) ffffuuuunnnnccccttttiiiioooonnnnssss [ _n_a_m_e ... ] The functions given by _n_a_m_es are printed. If no argu- ments are given, a all the functions are displayed. ggggeeeettttooooppppttttssss _o_p_t_s_t_r_i_n_g _n_a_m_e [ _a_r_g ... ] Checks _a_r_g for legal options. If _a_r_g is omitted, the positional parameters are used. An option argument begins with a ++++ or a ----. An option not beginning with ++++ or ---- or the argument -------- ends the options. _o_p_t_s_t_r_i_n_g contains the letters that ggggeeeettttooooppppttttssss recognizes. If a letter is followed by a ::::, that option is expected to have an argument. The options can be separated from the argument by blanks. ggggeeeettttooooppppttttssss places the next option letter it finds inside variable _n_a_m_e eeeeaaaacccchhhh ttttiiiimmmmeeee iiiitttt iiiissss iiiinnnnvvvvooookkkkeeeedddd,,,, wwwwiiiitttthhhh aaaa ++++ prepended when _a_r_g begins with a ++++. The index of the next arg is stored in OOOOPPPPTTTTIIIINNNNDDDD. The option argument, if any, gets stored in OOOOPPPPTTTTAAAARRRRGGGG, A leading :::: in _o_p_t_s_t_r_i_n_g causes ggggeeeettttooooppppttttssss to store the letter of an invalid option in OOOOPPPPTTTTAAAARRRRGGGG, and to set _n_a_m_e to ???? for an unknown option and to :::: when a required option is missing. Otherwise, ggggeeeettttooooppppttttssss prints an error message. The exit status is non-zero when there are no more options. hhhhiiiissssttttoooorrrryyyy [ ----ddddeeeeiiiillllssss ] The hhhhiiiissssttttoooorrrryyyy command, with no arguments, will print all the commands that are currently saved in the shell's history buffers. As new commands are executed, and space in the buffers runs out, old commands will be deleted. The hhhhiiiissssttttoooorrrryyyy commands prints out the stored commands with sequence numbers. Negative numbered com- mands, through command number zero, are commands that were retrieved from the saved history file. Commands starting at one were entered during the current login session. If a saved command contains embedded new- lines, these will be printed out as the sequence \\\\nnnn, so that individual command stay on one line. The arguments changes the way the shell processes his- tory information as follows: ----dddd Disable the saving of commands in the history file. ----eeee Enable the saving of commands in the history file. ----iiii Initialise the history file. ----llll Load the history from the file given by the MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 40 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) HHHHIIIISSSSTTTTFFFFIIIILLLLEEEE environment variable. ----ssss Save the history to the file given by the HHHHIIIISSSSTTTTFFFFIIIILLLLEEEE environment variable. jjjjoooobbbbssss [ ----llllpppp | [ ----PPPP _j_o_b ] ] This command (which is only available under OOOOSSSS////2222) lists the active jobs; or all active jobs if job is omitted. The ----llll options lists process id's in addition to the normal information. The ----pppp flag lists all the child processes of the current shell, displaying their pro- cess ID and thread count. The ----PPPP iiiidddd option lists all the child processes of the specified process or job. See JJJJoooobbbbssss for a description of the format of job. kkkkiiiillllllll [ ----ssssiiiigggg ] [ _p_r_o_c_e_s_s | %%%%_j_o_b_i_d ] ... This command (which is only available under OOOOSSSS////2222) sends either the TTTTEEEERRRRMMMM (terminate) signal or the specified signal to the specified _p_r_o_c_e_s_s_e_s. Signals are given by name, which are listed by ''''kkkkiiiillllllll ----llll''''. If the _p_r_o_c_e_s_s number begins with a %%%%, the signal is sent to the job referenced. See JJJJoooobbbbssss for a description of the format of a _j_o_b. lllleeeetttt [ _a_r_g ... ] Each _a_r_g is an arithmetic expression to be evaluated. All calculations are done as long integers and no check for overflow is performed. See AAAArrrriiiitttthhhhmmmmeeeettttiiiicccc EEEEvvvvaaaalllluuuuaaaattttiiiioooonnnn above for a description of arithmetic expressions.. The return code is 0 if the value of the last expres- sion is non-zero, and 1 otherwise. mmmmssssddddoooossss [ _n_a_m_e[=_v_a_l_u_e] ... ] The given _n_a_m_es are marked _m_s_d_o_s format and if the ----mmmm flag is set, the values of the these _n_a_m_es are exported to child processes with any slashes in the value replaced by \\\\s. If no arguments are given, a list of all _m_s_d_o_s names is printed. pppprrrriiiinnnntttt [ ----RRRRnnnnpppprrrrssss ] [ ----uuuu uuuunnnniiiitttt ] [ _a_r_g_s ... ] The shell output mechanism. With no flags or with flag - or -- the _a_r_g_s are printed on standard output as described by the eeeecccchhhhoooo command. ----RRRR Prints in the raw mode, in which the escape con- ventions of the eeeecccchhhhoooo command are ignored. The -_R option prints all subsequent _a_r_g_s and options other than -_n. ----nnnn Prevents a new-line from being added to the out- put. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 41 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) ----pppp ----pppp flag has not effect and is defined for compata- bility. ----rrrr Prints in the raw mode, in which the escape con- ventions of the eeeecccchhhhoooo command are ignored. ----ssss Writes the _a_r_g_s to the history file instead of to standard output. ----uuuu uuuunnnniiiitttt Specifies a one digit file descriptor uuuunnnniiiitttt number on which the output is placed. The default is 1. ppppwwwwdddd [ ----LLLLPPPP ] [ _d_r_i_v_e ... ] Print the current working directory. If _d_r_i_v_e is present, the current working directory on each of the drives is printed. _d_r_i_v_e contains a string of drive letters, no colons are required. The -_L option (default) preserves the logical meaning of the current directory and -_P preserves the physical meaning of the current directory if it is on a substi- tuted drive (see ccccdddd and SSSSUUUUBBBBSSSSTTTT((((1111))))). This option is only available under the MSDOS 16bit version. rrrreeeeaaaadddd [ ----pppprrrrssss ] [ ----uuuu uuuunnnniiiitttt ] [ _n_a_m_e?_p_r_o_m_p_t ] [ _n_a_m_e ... ] The shell input mechanism. One line is read and is broken up into words using the characters in IIIIFFFFSSSS as separators. In raw mode, ----rrrr, a \\\\ at the end of a line does not signify line continuation. The first word is assigned to the first _n_a_m_e, the second word to the second _n_a_m_e, etc., with leftover words assigned to the last _n_a_m_e. If the ----ssss flag is present, the input will be saved as a command in the history file. The ----pppp flag has not effect and is defined for compatability. The flag ----uuuu can be used to specify a one digit file descriptor uuuunnnniiiitttt to read from. The file descriptor can be opened with the eeeexxxxeeeecccc special command. The default value of uuuunnnniiiitttt is 0. If _n_a_m_e is omitted then RRRREEEEPPPPLLLLYYYY is used as the default name. If the first argument con- tains a ????, the remainder of this word is used as a prompt when the shell is interactive. If the given file descriptor is open for writing and is a terminal device then the prompt is placed on this unit. Other- wise the prompt is issued on file descriptor 2. The return code is 0 unless an end-of-file is encountered. rrrreeeeaaaaddddoooonnnnllllyyyy [ _n_a_m_e[=_v_a_l_u_e] ... ] The given _n_a_m_es are marked _r_e_a_d_o_n_l_y and the values of the these _n_a_m_es may not be changed by subsequent assignment. If no arguments are given, a list of all _r_e_a_d_o_n_l_y names is printed. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 42 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) rrrreeeettttuuuurrrrnnnn [ _n ] Causes a function to exit with the return value speci- fied by _n. If _n is omitted, the return status is that of the last command executed. sssseeeetttt [ [----||||++++]aaaaeeeeffffkkkkmmmmnnnnttttuuuuvvvvxxxx ] [ ----oooo ooooppppttttiiiioooonnnn ] [ _a_r_g ... ] ----aaaa Mark variables which are modified or created for export. ----eeee Exit immediately if a command exits with a non- zero exit status. ----ffff Disable file name generation ----hhhh Each command becomes a tracked alias when first encountered. ----kkkk All keyword arguments are placed in the environ- ment for a command, not just those that precede the command name. ----mmmm Background jobs will run in a separate process group and a line will print upon completion. The exit status of background jobs is reported in a completion message. This only applies to OOOOSSSS////2222. The programs are detached from the current process group. ----nnnn Read commands but do not execute them. ----oooo ooooppppttttiiiioooonnnn The argument that follows this option can be one of the following option names: aaaalllllllleeeexxxxppppoooorrrrtttt Same as ----aaaa.... bbbbeeeellllllll Enable alarm bell on errors bbbbrrrreeeeaaaakkkk Enable the extended SIGINT checking (see BBBBRRRREEEEAAAAKKKK [ OOOONNNN |||| OOOOFFFFFFFF ] under _C_O_M_M_A_N_D._C_O_M). This option is only available under MMMMSSSSDDDDOOOOSSSS. eeeemmmmaaaaccccssss Select emacs-like command line editing mode. eeeerrrrrrrreeeexxxxiiiitttt Same as ----eeee.... ggggmmmmaaaaccccssss MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 43 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) Select gmacs-like command line editing mode. hhhhaaaallllffffhhhheeeeiiiigggghhhhtttt Set cursor to halfheight when in insert mode. If off, a full height cursor is used. iiiiggggnnnnoooorrrreeeeccccaaaasssseeee Under OOOOSSSS////2222, on non-FAT (ie case retentive) file systems, the shell will match file names ignoring case. Normally, the matches are case sensitive even though the file system is only case retentive. iiiiggggnnnnoooorrrreeeeeeeeooooffff The shell will not exit on end-of-file. The command exit must be used. iiiinnnnsssseeeerrrrttttmmmmooooddddeeee Set the default edit mode to insert rather than overwrite. kkkkeeeeyyyywwwwoooorrrrdddd Same as ----kkkk.... mmmmaaaarrrrkkkkddddiiiirrrrssss Appends a / (slash) to all directory names that are a result of file name substitution. mmmmssssddddoooossss Same as ----MMMM.... nnnnoooocccclllloooobbbbbbbbeeeerrrr Prevents redirection >>>> from truncating exist- ing files. A vertical bar must follow the redirection symbol ((((>>>>||||)))) to truncate a file when this option is turned on. nnnnooooeeeexxxxeeeecccc Same as ----nnnn.... nnnnoooogggglllloooobbbb Same as ----ffff.... nnnnoooouuuunnnnsssseeeetttt Same as ----uuuu.... pppprrrriiiivvvviiiilllleeeeggggeeeedddd Same as ----pppp.... rrrreeeeaaaallllppppiiiippppeeeessss Under OOOOSSSS////2222, the shell will use OOOOSSSS////2222 pipes and not temporary files to handle pipelines. See LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 44 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) ttttrrrraaaacccckkkkaaaallllllll Same as ----hhhh.... vvvveeeerrrrbbbboooosssseeee Same as ----vvvv.... vvvveeeerrrriiiiffffyyyy Same as ----VVVV.... vvvviiii Select vi-like command line editing mode. xxxxttttrrrraaaacccceeee Same as ----xxxx.... ----pppp Not supported. ----tttt Exit after reading and executing one command. ----uuuu Treat unset variables as an error when substitut- ing. ----vvvv Print shell input lines as they are read. ----wwww Disable shell warning messages. ----xxxx Print commands and their arguments as they are executed. ----MMMM For those variables marked as mmmmssssddddoooossss variables, the values are exported to child processes with the slashes replaced by \\\\s. Most MMMMSSSSDDDDOOOOSSSS utilities do not care if a file name contains a slash or \\\\ as a directory separator. However, some like the _l_i_n_k_e_r require \\\\s in the value of the LLLLIIIIBBBB vari- able. ----VVVV Enable the File write verification option in the operation system (see VVVVEEEERRRRIIIIFFFFYYYY [ OOOONNNN |||| OOOOFFFFFFFF ] under _C_O_M_M_A_N_D._C_O_M or _C_M_D._E_X_E). -------- Do not change any of the flags; useful in setting $$$$1111 to ----. Using ++++ rather than ---- causes these flags to be turned off. These flags can also be used upon invocation of the shell. The current set of flags may be found in $$$$----. The remaining arguments are positional parameters and are assigned, in order, to $$$$1111, $$$$2222, .... If no arguments are given the values of all names are printed. sssshhhhiiiifffftttt [ _n ] MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 45 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The positional parameters from $$$$nnnn++++1111 ... are renamed $$$$1111 .... If _n is not given, it is assumed to be 1. [ _p_r_o_g_r_a_m _a_r_g_s...]] [ ----AAAA sssseeeessssssssiiiioooonnnnIIIIdddd ] ssssttttaaaarrrrtttt [[ ----ddddffffWWWWPPPPFFFFiiiiCCCCIIIISSSS ] [ ----cccc [ vvvviiiillllssssnnnn ]] [ ----tttt ttttiiiittttlllleeee ] [ ---- eeee ssssttttrrrriiiinnnngggg ] This command (which is only available under OOOOSSSS////2222) starts an OOOOSSSS////2222 (or MMMMSSSSDDDDOOOOSSSS under OOOOSSSS////2222 2.x) _p_r_o_g_r_a_m in a new session. If no _p_r_o_g_r_a_m and _a_r_g_u_m_e_n_t_s parameters are entered, the shell is started unless the -C option has been used to select the OOOOSSSS////2222 command processor. Also see DDDDoooossssSSSSttttaaaarrrrttttSSSSeeeessssssssiiiioooonnnn((((2222)))). The arguments changes the way the shell starts the ses- sion as follows: ----dddd Normally, command are started by invoking the shell in the new session. This option invokes the command directly. ----SSSS Invoke the shell to started the command in the new session. ----ffff The program becomes the foreground session. If this parameter is not specified, the program becomes a background session. ----iiii The new session will inherit the original environ- ment of the shell instead of the current environ- ment. ----IIII The new session will independent of the current process. Normally, the session is a child session of the current process. Independent sessions are not terminated when the shell terminates. Start- ing a child session prevents any child session or process from also starting new sessions. ----tttt ttttiiiittttlllleeee Sets the _t_i_t_l_e of the new session. ----FFFF This application is a full-screen application that must run in a separate session independent of Presentation Manager. ----WWWW This is an OOOOSSSS////2222 application that runs within a Presentation Manager window. ----PPPP This application is started as a Presentation Manager application. ----CCCC Use the OOOOSSSS////2222 command processor instead of the MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 46 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) shell. ----eeee ssssttttrrrriiiinnnngggg This option can be used multiple times on the com- mand line and allows the user to excplicily specify the environment to be passed to the new process. When this option is used, only those environment variables set up by the ----eeee options are set in the new session's environment. Only one environment variable can be assigned per ----eeee switch. The ssssttttrrrriiiinnnnggggs are in standard environment format (_n_a_m_e=_v_a_l_u_e). This may of particular use under OOOOSSSS////2222 2.x when starting MMMMSSSSDDDDOOOOSSSS programs. ----cccc [ _v_i_l_s_n_a ] This option allows the user to configure the size of the window created for the new session: _v - visible; _i - invisible; _l - maximise; _s - minim- ise; _n - no autoclose; or _a - autoclose. Multiple selections can be made on one option. Any selec- tion removes any inappropriate previous selections (ie. _m_a_x_i_m_i_s_e removes any previous selected _m_i_n_i_m_- _i_s_e). Multiple ----cccc options are not cummulative and only take the values selected by the last ----cccc option. The default is window configuration is _n_o _a_u_t_o_c_l_o_s_e. ----AAAA sssseeeessssssssiiiioooonnnnIIIIdddd This option cannot be used with any other option and allows the user to switch to another session, given by _s_e_s_s_i_o_n_I_D, which must be a child session of the current session. sssswwwwaaaapppp [ _o_p_t_i_o_n_s ] This command (which is only available on the 16-bit MS-DOS version) defines how the shell will handle swap- ping itself to reduce its memory requirements whilst other programs execute. The options are ooooffffffff Disable swapping. The shell remains in memory whilst the child is running and reduces the avail- able memory by about 200K (depending on the size of the environment and history). oooonnnn Enable all devices. The shell will swap out to either expanded or extended memory or to disk, execute the command and then swap back in. Whilest swapped, the shell reduces the available memory by about 3K. eeeexxxxppppaaaannnndddd Enable swapping to Expanded Memory. The EMS MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 47 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) driver must exist on your system for this to work. eeeexxxxtttteeeennnndddd [ _s_t_a_r_t _a_d_d_r_e_s_s ] Enable swapping to Extended Memory. If you have an XMS driver on your system, the shell will use the XMS driver. Otherwise, the BIOS Interrupt 15 interface is used. The optional start address defines the based address in the Extended Memory at which point the shell writes its swap area when the BIOS interface is used. The default location is _0_x_1_0_0_0_0_0. ddddiiiisssskkkk Enable swapping to disk. The shell creates a tem- porary file and saves itself in it. On comple- tion, the file is deleted. This is the slowest method of swapping. With no options, the current swapping options are displayed. tttteeeesssstttt _e_x_p_r [[[[ _e_x_p_r ]]]] Evaluate conditional expressions. TTTTeeeesssstttt evaluates the expression _e_x_p_r and, if its value is true, returns a zero (true) exit status; otherwise, a non-zero (false) exit status is returned; tttteeeesssstttt also returns a non-zero exit status if there are no arguments. The primitives are the same as for the [[[[[[[[ _e_x_p_r_e_s_s_i_o_n ]]]]]]]] command, except that -_a and -_o are not primitives, but are used to combine operators (see tttteeeesssstttt ((((1111))))). -_a is the binary aaaannnndddd operator and -_o is the binary oooorrrr operator. Notice that all the operators and flags are separate arguments to tttteeeesssstttt. Notice also that parentheses are meaningful to the shell and, therefore, must be escaped. ttttrrrraaaapppp [ -_l ] _a_r_g ] [ _S_i_g_n_a_l_N_u_m_b_e_r ] ... The command _a_r_g is to be read and executed when the shell receives signal(s) _S_i_g_n_a_l_N_u_m_b_e_r. (Note that _a_r_g is scanned once when the trap is set and once when the trap is taken.) Trap commands are executed in order of signal number. Any attempt to set a trap on a signal that was ignored on entry to the current shell is inef- fective. If _a_r_g is absent all trap(s) _S_i_g_n_a_l_N_u_m_b_e_r are reset to their original values. If _a_r_g is the null string this signal is ignored by the shell and by the commands it invokes. A potential point of confusion is that UUUUNNNNIIIIXXXX signal numbers are different from MMMMSSSSDDDDOOOOSSSS and OOOOSSSS////2222 signal MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 48 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) numbers. MMMMSSSSDDDDOOOOSSSS and OOOOSSSS////2222 signal numbers sometimes appear to differ between compilers. If a numeric value is used, it is assumed to be a UUUUNNNNIIIIXXXX signal number and this is mapped to the appropriate MMMMSSSSDDDDOOOOSSSS/OOOOSSSS////2222 signal number. If there is no mapping, a warning message is displayed. If the signal number is a signal name, it is translated into the appropriate MMMMSSSSDDDDOOOOSSSS/OOOOSSSS////2222 signal number. The list of valid signal names is displayed using the -_l flag. If _S_i_g_n_a_l_N_u_m_b_e_r is DDDDEEEEBBBBUUUUGGGG then _a_r_g will be executed after each command. If _S_i_g_n_a_l_N_u_m_b_e_r is EEEERRRRRRRR, _a_r_g will be executed whenever a command has a non-zero exit code. If _S_i_g_n_a_l_N_u_m_b_e_r is 0 or EEEEXXXXIIIITTTT and the trap statement is executed inside the body of a function, the command _a_r_g is executed after the function completes. If _S_i_g_n_a_l_- _N_u_m_b_e_r is 0 or EEEEXXXXIIIITTTT for a trap set outside any func- tion, the command _a_r_g is executed on exit from the shell. The ttttrrrraaaapppp command with no arguments prints a list of commands associated with each signal number. ttttrrrruuuueeee No effect; the command does nothing. A zero exit code is returned. ttttyyyyppppeeeesssseeeetttt [ ----HHHHLLLLRRRRZZZZffffiiiillllpppprrrrttttuuuuxxxx[nnnn] [ nnnnaaaammmmeeee[ ====vvvvaaaalllluuuueeee ] ] ... ] When invoked inside a function, a new instance of the parameter name is created. The parameter value and type are restored when the function completes. The following list of attributes may be specified: ----HHHH This flag provides UUUUNNNNIIIIXXXX to host-name file mapping on non-UUUUNNNNIIIIXXXX machines (see mmmmssssddddoooossss command). ----LLLL Left justify and remove leading blanks from value. If nnnn is non-zero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. When the parameter is assigned to, it is filled on the right with blanks or truncated, if necessary, to fit into the field. Leading zeros are removed if the ----ZZZZ flag is also set. The ----RRRR flag is turned off. ----RRRR Right justify and fill with leading blanks. If nnnn is non-zero, it defines the width of the field, otherwise it is determined by the width of the value of first assignment. The field is left filled with blanks or truncated from the end if the parameter is reassigned. The ----LLLL flag is MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 49 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) turned off. ----ZZZZ Right justify and fill with leading zeros if the first non-blank character is a digit and the ----LLLL flag has not been set. If nnnn is non-zero, it defines the width of the field, otherwise it is determined by the width of the value of first assignment. ----ffff The names refer to function names rather than parameter names. No assignments can be made and the only other valid flags are ----tttt, which turns on execution tracing for this function and ----xxxx, to allow the function to remain in effect across shell procedures executed in the same process environment. ----iiii Parameter is an integer. This makes arithmetic faster. If nnnn is non-zero it defines the output arithmetic base, otherwise the first assignment determines the output base. ----llll All upper-case characters converted to lower-case. The upper-case flag, ----uuuu is turned off. ----pppp The output of this command, if any, is written onto the two-way pipe. TTTThhhhiiiissss ooooppppttttiiiioooonnnn hhhhaaaassss nnnnoooo eeeeffffffffeeeecccctttt iiiinnnn tttthhhheeee SSSShhhheeeellllllll. ----rrrr The given names are marked readonly and these names cannot be changed by subsequent assignment. ----tttt Tags the named parameters. Tags are user definable and have no special meaning to the shell. ----uuuu All lower-case characters are converted to upper- case characters. The lower-case flag, ----llll is turned off. ----xxxx The given names are marked for automatic export to the environment of subsequently-executed commands. Using + rather than - causes these flags to be turned off. If no name arguments are given but flags are specified, a list of names (and optionally the values) of the parameters which have these flags set is printed. (Using + rather than - keeps the values to be printed.) If no names and flags are given, the names and attributes of all parameters are printed. uuuummmmaaaasssskkkk [ _n_n_n ] The user file-creation mask is set to _n_n_n (see MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 50 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) _u_m_a_s_k(2)). If _n_n_n is omitted, the current value of the mask is printed. uuuunnnnaaaalllliiiiaaaassss _n_a_m_e ... The aliases given by the list of _n_a_m_es are removed from the alias list. uuuunnnnffffuuuunnnnccccttttiiiioooonnnn _n_a_m_e ... For each _n_a_m_e, remove the corresponding function. uuuunnnnsssseeeetttt [ ----ffff ] _n_a_m_e ... The parameters given by the list of _n_a_m_es are unas- signed (their values and attributes are erased). The following variables, as well as those with a read-only attribute cannot be unset: PPPPAAAATTTTHHHH, PPPPSSSS1111, PPPPSSSS2222, and IIIIFFFFSSSS. If the -f flag is set, then the names refer to function names and the functions are removed. Unsetting LLLLIIIINNNNEEEENNNNOOOO, MMMMAAAAIIIILLLLCCCCHHHHEEEECCCCKKKK, OOOOPPPPTTTTAAAARRRRGGGG, OOOOPPPPTTTTIIIINNNNDDDD, RRRRAAAANNNNDDDDOOOOMMMM, SSSSEEEECCCCOOOONNNNDDDDSSSS, and ____ removes their special meaning even if they are subsequently assigned to. vvvveeeerrrr Display the current version of the shell. wwwwaaaaiiiitttt [ jjjjoooobbbb ] This command (which is only available under OOOOSSSS////2222) waits for the specified _j_o_b to terminate and report its status. This status becomes the return code for the wwwwaaaaiiiitttt command. If _j_o_b is not given, wwwwaaaaiiiitttt waits for all currently active child processes to terminate. The termination status returned is that of the last pro- cess. See JJJJoooobbbbssss for a description of the format of a _j_o_b. wwwwhhhheeeennnncccceeee [ ----ppppvvvv ] [ _n_a_m_e ... ] ttttyyyyppppeeee [ ----pppp ] [ _n_a_m_e ... ] For each _n_a_m_e specified, indicate how it would be interpreted if used as a command name. Note that ttttyyyyppppeeee is a shorthand for wwwwhhhheeeennnncccceeee ----vvvv. ----pppp Does a path search for _n_a_m_e even if the name is an alias, a function, or a reserved word. ----vvvv Produces a more verbose report. IIIInnnnvvvvooooccccaaaattttiiiioooonnnn If the shell is invoked through _e_x_e_c(2) and the first char- acter of argument zero is ---- or the ----0000(zero) switch is in the invokation line, commands are initially read from ////eeeettttcccc////pppprrrrooooffffiiiilllleeee (the extensions ....sssshhhh or ....kkkksssshhhh may be used) and from $$$$HHHHOOOOMMMMEEEE////pppprrrrooooffffiiiilllleeee (the extensions rrrreeeeaaaadddd ffffrrrroooommmm tttthhhheeee ffffiiiilllleeee nnnnaaaammmmeeeedddd bbbbyyyy ppppeeeerrrrffffoooorrrrmmmmiiiinnnngggg ppppaaaarrrraaaammmmeeeetttteeeerrrr ssssuuuubbbbssssttttiiiittttuuuuttttiiiioooonnnn oooonnnn tttthhhheeee vvvvaaaalllluuuueeee ooooffff tttthhhheeee MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 51 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) eeeennnnvvvviiiirrrroooonnnnmmmmeeeennnntttt ppppaaaarrrraaaammmmeeeetttteeeerrrr EEEENNNNVVVV if the file exists. Thereafter, commands are read as described below, which is also the case when the shell is invoked as ////bbbbiiiinnnn////sssshhhh. The flags below are interpreted by the shell on invocation only; Note that unless the ----cccc or ----ssss flag is specified, the first argument is assumed to be the name of a file containing commands, and the remaining arguments are passed as positional parameters to that command file: ----cccc string If the ----cccc flag is present commands are read from _s_t_r_i_n_g. ----ssss If the ----ssss flag is present or if no arguments remain commands are read from the standard input. Any remaining arguments specify the positional parameters. Shell output (except for _S_p_e_c_i_a_l _C_o_m_- _m_a_n_d_s) is written to file descriptor 2. ----iiii If the ----iiii flag is present or if the shell input and output are attached to a terminal, this shell is _i_n_t_e_r_a_c_t_i_v_e. In this case, the TERMINATE sig- nal is ignored and the INTERRUPT signal is caught and ignored. In all cases, the QUIT signal is ignored by the shell. ----rrrr If the ----rrrr flag is present, the shell is a res- tricted shell. ----0000(zero) If the ----0000(zero) flag is present, this has the same effect as starting the shell with the first char- acter of argument zero as a ---- (see above). ----PPPP This option enables real pipes under OOOOSSSS////2222. See LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS. ----RRRR If the ----RRRR flag is present, the shell is the _r_o_o_t shell and cannot be terminated using exit. Under MMMMSSSSDDDDOOOOSSSS, the system must be re-booted. Under OOOOSSSS////2222, the shell must be killed by an external program. In addition, the initialisation file is not read until just before the first keyboard input. This allows the location of the file to be changed by changing the value of the SHELL environment vari- able. The remaining flags and arguments are described under the sssseeeetttt command above. RRRRsssshhhh OOOOnnnnllllyyyy _R_s_h is used to set up login names and execution environments whose capabilities are more controlled than those of the standard shell. The actions of _r_s_h are identical to those MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 52 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) of _s_h, except that the following are disallowed: Changing directory (see _c_d(1)), Setting the value of SSSSHHHHEEEELLLLLLLL, EEEENNNNVVVV, or $$$$PPPPAAAATTTTHHHH, Specifying path or command names containing ////, Redirecting output (>>>> and >>>>>>>>). The restrictions above are enforced after pppprrrrooooffffiiiilllleeee and the EEEENNNNVVVV files are interpreted. When a command to be executed is found to be a shell pro- cedure, _r_s_h invokes _s_h to execute it. Thus, it is possible to provide to the end-user shell procedures that have access to the full power of the standard shell, while imposing a limited menu of commands; this scheme assumes that the end- user does not have write and execute permissions in the same directory. The net effect of these rules is that the writer of the pppprrrroooo---- ffffiiiilllleeee has complete control over user actions, by performing guaranteed setup actions and leaving the user in an appropriate directory (probably _n_o_t the login directory). The system administrator often sets up a directory of com- mands (i.e., ////uuuussssrrrr////rrrrbbbbiiiinnnn) that can be safely invoked by _r_s_h. Some systems also provide a restricted editor _r_e_d. EEEEXXXXIIIITTTT SSSSTTTTAAAATTTTUUUUSSSS Errors detected by the shell, such as syntax errors, cause the shell to return a non-zero exit status. If the shell is being used non-interactively execution of the shell file is abandoned. Otherwise, the shell returns the exit status of the last command executed (see also the eeeexxxxiiiitttt command above). FFFFIIIILLLLEEEESSSS /etc/profile $HOME/profile $HOME/history.sh. $TMP/sh*.tmp ??/sh.ini CCCCRRRRIIIITTTTIIIICCCCAAAALLLL EEEERRRRRRRROOOORRRRSSSS The Shell provide a Critical Error Handler (Interrupt 24) similar to the standard MMMMSSSSDDDDOOOOSSSS handler. In addition to the standard message, the handler also displays the Extended Error Code information in hexadecimal. LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS Under MS-DOS, any TSR (Terminate Stay Resident) programs must be loaded before loading _S_h as the shell will overwrite the TSR when it reloads itself after swapping out. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 53 SH(1L) MISC. REFERENCE MANUAL PAGES SH(1L) The shell checks for valid DOS filenames (single dot, not at the beginning). Invalid dots are converted to ~~~~. A warning message is displayed if the shell detects an invalid file name. Under OOOOSSSS////2222, asynchronous commands are supported to a degree. However, this is very limited because of the nature of the forking commands under OOOOSSSS////2222 which does not match the UUUUNNNNIIIIXXXX model. This difference has also meant that pipes (as in MS-DOS) are implemented as files and not OOOOSSSS////2222 pipes. For more details, see the source code. However, real OOOOSSSS////2222 pipes can be used with care for simple pipelines which do not create sub-shells or assume that a real child shell is created because the shell does not create child, it simulates their creating in the same pro- cess. This is because there is no fork under OOOOSSSS////2222. See the sssseeeetttt command on how to enable/disable real pipes. SSSSEEEEEEEE AAAALLLLSSSSOOOO cd(1), test(1), umask(1), exec(2), pipe(2), signal(2), umask(2), strtol(3), pro- file(4), environ(5) in the _U_N_I_X _S_y_s_t_e_m _P_r_o_g_r_a_m_m_e_r _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l. COMMAND(1) and SUBST(1) in the _M_S_D_O_S _R_e_f_e_r_e_n_c_e _G_u_i_d_e. CMD(1) in the _O_S/_2 Reference Guide. DosStartSession(2) in the _O_S/_2 _C_o_n_t_r_o_l _P_r_o_g_r_a_m _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l. AAAACCCCKKKKNNNNOOOOWWWWLLLLEEEEDDDDGGGGEEEEMMMMEEEENNNNTTTTSSSS This program is based on ideas, code or parts of code developed by: David Korn and Steve Bourne (the original ideas) Charles Forsyth (the original source for the MINIX Shell program) Erik Baalbergen (the code for the test function) Paul Falstad (the code for the maths functions) Simon J. Gerraty (the code for the new lexical analyser and the VI/EMACS edit functions). In addition, a very large number of people (too many to men- tion) who have been involved in testing and debugging the program. MS-DOS - OS/2 Version 2.2Last change: Data Logic Limited 54