Annotation of coherent/a/usr/man/COHERENT/ksh, revision 1.1

1.1     ! root        1: 
        !             2: 
        !             3: ksh                          Command                          ksh
        !             4: 
        !             5: 
        !             6: 
        !             7: 
        !             8: The Korn shell
        !             9: 
        !            10: kksshh _t_o_k_e_n ...
        !            11: 
        !            12: The  COHERENT system  offers  two command  interpreters: sshh,  the
        !            13: Bourne  shell;  and  kksshh, the  Korn  shell.   sshh  is the  default
        !            14: COHERENT  command interpreter.   The shell  tutorial  included in
        !            15: this manual describes the Bourne shell in detail.
        !            16: 
        !            17: This article describes kksshh, the Korn shell.  kksshh is a superset of
        !            18: the Bourne  shell, and contains  many features that  you may well
        !            19: find useful.   These include MicroEMACS-style  editing of command
        !            20: lines; command  hashing; a full-featured aliasing  feature; and a
        !            21: job-control facility.
        !            22: 
        !            23: ***** Invoking ksh *****
        !            24: 
        !            25: To invoke  kksshh from within  the Bourne shell, simply  type kksshh at
        !            26: the  command-line prompt.   To  use kksshh  as  your default  shell,
        !            27: instead of sshh, append the command /uussrr/bbiinn/kksshh to the end of your
        !            28: entry in the file  /eettcc/ppaasssswwdd. (See the Lexicon entry for ppaasssswwdd
        !            29: for more information on this file.)
        !            30: 
        !            31: You can  invoke kksshh with one or more  built-in options; these are
        !            32: described below.
        !            33: 
        !            34: ***** Commands *****
        !            35: 
        !            36: A _c_o_m_m_a_n_d consists of one or  more _t_o_k_e_n_s. A _t_o_k_e_n is a string of
        !            37: text  characters  (i.e.,   one  or  more  alphabetic  characters,
        !            38: punctuation marks,  and numerals) delineated by  spaces, tabs, or
        !            39: newlines.
        !            40: 
        !            41: A _s_i_m_p_l_e _c_o_m_m_a_n_d consists of the command's name, followed by zero
        !            42: or more tokens that  represent arguments to the command, names of
        !            43: files,  or shell  operators.  A  _c_o_m_p_l_e_x  _c_o_m_m_a_n_d will  use shell
        !            44: constructs  to execute  one or  more commands  conditionally.  In
        !            45: effect, a  complex command is  a mini-program that  is written in
        !            46: the shell's programming language and interpreted by kksshh.
        !            47: 
        !            48: ***** Shell Operators *****
        !            49: 
        !            50: The  shell  includes  a  number  of  operators that  form  pipes,
        !            51: redirect  input  and  output  to  commands,  and let  you  define
        !            52: conditions under which commands are executed.
        !            53: 
        !            54: _c_o_m_m_a_n_d | _c_o_m_m_a_n_d
        !            55:      The _p_i_p_e  operator: let the  output of one  command serve as
        !            56:      the input to a second.  You can combine commands with `|' to
        !            57:      form _p_i_p_e_l_i_n_e_s. A pipeline passes the standard output of the
        !            58:      first (leftmost) command to the standard input of the second
        !            59:      command.  For example, in the pipeline
        !            60: 
        !            61:              sort customers | uniq | more
        !            62: 
        !            63: 
        !            64: COHERENT Lexicon                                           Page 1
        !            65: 
        !            66: 
        !            67: 
        !            68: 
        !            69: ksh                          Command                          ksh
        !            70: 
        !            71: 
        !            72: 
        !            73: 
        !            74:      kksshh invokes ssoorrtt to sort the contents of file ccuussttoommeerrss.  It
        !            75:      pipes the output of  ssoorrtt to the command uunniiqq, which outputs
        !            76:      one unique copy of the text that is input into it.  kksshh then
        !            77:      pipes the output of uunniiqq to the command mmoorree, which displays
        !            78:      it  on your  terminal one  screenful at  a time.   Note that
        !            79:      under   COHERENT,   unlike   MS-DOS,  pipes   are   executed
        !            80:      concurrently: that is, ssoorrtt does not have to finish its work
        !            81:      before uunniiqq  and mmoorree can begin to receive  input and get to
        !            82:      work.
        !            83: 
        !            84: _c_o_m_m_a_n_d ; _c_o_m_m_a_n_d
        !            85:      Execute  commands  on  a  command  line  sequentially.   The
        !            86:      command to the left  of the `;' executes to completion; then
        !            87:      the command  to the right  of it executes.   For example, in
        !            88:      the command line
        !            89: 
        !            90:              a | b ; c | d
        !            91: 
        !            92:      first  execute  the  pipeline aa  |  bb  then,  when  aa and  bb
        !            93:      complete, execute the pipeline cc | dd.
        !            94: 
        !            95: _c_o_m_m_a_n_d &
        !            96:      Execute  a command  in the  background.  This  operator must
        !            97:      follow the  command, not precede it.   It prints the process
        !            98:      identifier of the command on the standard output, so you can
        !            99:      use the  kkiillll command to kill  that process should something
        !           100:      go  wrong.  This  operator lets  you  execute more  than one
        !           101:      command simultaneously.  For example, the command
        !           102: 
        !           103:              /etc/fdformat -v /dev/fha0 &
        !           104: 
        !           105:      formats  a high-density,  5.25-inch floppy  disk in  drive 0
        !           106:      (that is,  drive A); but while the  disk is being formatted,
        !           107:      kksshh returns  the command line prompt  so you can immediately
        !           108:      enter another command and begin to work.  If you did not use
        !           109:      the  `&'  in this  command,  you would  have  to wait  until
        !           110:      formatting  was  finished  before  you could  enter  another
        !           111:      command.
        !           112: 
        !           113:      kksshh also  prints a message  on your terminal  when a command
        !           114:      that you are  running in the background finishes processing.
        !           115:      It  does not  check  these ``child''  processes very  often,
        !           116:      however, so a command may have finished some time before kksshh
        !           117:      informs you  of the fact.   See the Lexicon  article for the
        !           118:      command ppss  for information on  all processes; also  see the
        !           119:      description of the built-in command jjoobbss, below.
        !           120: 
        !           121: _c_o_m_m_a_n_d && _c_o_m_m_a_n_d
        !           122:      Execute a  command upon  success.  kksshh executes  the command
        !           123:      that  follows  the  token  `&&'  only  if the  command  that
        !           124:      precedes  it returns  a  zero exit  status, which  signifies
        !           125:      success.  For example, the command
        !           126: 
        !           127:              cd /etc
        !           128: 
        !           129: 
        !           130: COHERENT Lexicon                                           Page 2
        !           131: 
        !           132: 
        !           133: 
        !           134: 
        !           135: ksh                          Command                          ksh
        !           136: 
        !           137: 
        !           138: 
        !           139:              fdformat -v /dev/fha0 && badscan -o proto /dev/fha0 2400
        !           140: 
        !           141:      formats a  floppy disk, as  described above.  If  the format
        !           142:      was successful, it  then invokes the command bbaaddssccaann to scan
        !           143:      the disk for bad  blocks; if it was not successful, however,
        !           144:      it does nothing.
        !           145: 
        !           146: _c_o_m_m_a_n_d || _c_o_m_m_a_n_d
        !           147:      Execute  a  command  upon  failure.   This is  identical  to
        !           148:      operator `&&', except that the second command is executed if
        !           149:      the  first  returns   a  non-zero  status,  which  signifies
        !           150:      failure.  For example, the command
        !           151: 
        !           152:              /etc/fdformat -v /dev/fha0 || echo "Format failed!"
        !           153: 
        !           154:      formats a floppy  disk.  If formatting failed, it echoes the
        !           155:      message  FFoorrmmaatt  ffaaiilleedd!   on  your  terminal;  however,  if
        !           156:      formatting succeeds, it does nothing.
        !           157: 
        !           158:      Note that the tokens  newline, `;' and `&' bind less tightly
        !           159:      than `&&'  and `||'.  kksshh parses command  lines from left to
        !           160:      right if separators bind equally.
        !           161: 
        !           162: >_f_i_l_e
        !           163:      Redirect  standard  output.   The _s_t_a_n_d_a_r_d  _i_n_p_u_t,  _s_t_a_n_d_a_r_d
        !           164:      _o_u_t_p_u_t, and _s_t_a_n_d_a_r_d _e_r_r_o_r streams are normally connected to
        !           165:      the terminal.  A pipeline attaches the output of one command
        !           166:      to the input  of another command.  In addition, kksshh includes
        !           167:      a set of operators that redirect input and output into files
        !           168:      rather than other commands.
        !           169: 
        !           170:      The operator `>' redirects output into a file.  For example,
        !           171:      the command
        !           172: 
        !           173:              sort customers >customers.sort
        !           174: 
        !           175:      sorts file ccuussttoommeerrss  and writes the sorted output into file
        !           176:      ccuussttoommeerrss.ssoorrtt.  It creates  ccuussttoommeerrss.ssoorrtt if  it  does not
        !           177:      exist, and destroys its previous contents if it does exist.
        !           178: 
        !           179: >>_f_i_l_e
        !           180:      Redirect output  into a file, and append.   If the file does
        !           181:      not exist,  this operator creates  it; however, if  the file
        !           182:      already  exists, this  operator appends  the output  to that
        !           183:      file's contents rather  than destroying those contents.  For
        !           184:      example, the command
        !           185: 
        !           186:              sort customers.now | uniq >>customers.all
        !           187: 
        !           188:      sorts file ccuussttoommeerrss.nnooww,  pipes its output to command uunniiqq,
        !           189:      which throws away  duplicate lines of input, and appends the
        !           190:      results to file ccuussttoommeerrss.aallll.
        !           191: 
        !           192: <_f_i_l_e
        !           193:      Redirect input.  Here, kksshh  reads the contents of a file and
        !           194: 
        !           195: 
        !           196: COHERENT Lexicon                                           Page 3
        !           197: 
        !           198: 
        !           199: 
        !           200: 
        !           201: ksh                          Command                          ksh
        !           202: 
        !           203: 
        !           204: 
        !           205:      processes them as if  you had typed them from your keyboard.
        !           206:      For example, the command
        !           207: 
        !           208:              ed textfile <edit.script
        !           209: 
        !           210:      invokes  the  line-editor  eedd  to  edit  tteexxttffiillee;  however,
        !           211:      instead of reading  editing commands from your keyboard, the
        !           212:      shell passes  eedd the contents of  eeddiitt.ssccrriipptt.  This command
        !           213:      would  let you  prepare  an editing  script  that you  could
        !           214:      execute repeatedly upon files rather than having to type the
        !           215:      same commands over and over.
        !           216: 
        !           217: << _t_o_k_e_n
        !           218:      Prepare  a ``here  document''.  This  operator tells  kksshh to
        !           219:      accept standard input from  the shell input until it reads a
        !           220:      line that contains only _t_o_k_e_n. For example, the command
        !           221: 
        !           222:              cat >FOO <<\!
        !           223:                      Here is some text.
        !           224:              !
        !           225: 
        !           226:      redirects  all  text  between  `<<\!'  and  `!' to  the  ccaatt
        !           227:      command.  The  `>' in turn redirects the  output of ccaatt into
        !           228:      file FFOOOO.   kksshh performs parameter substitution  on the here
        !           229:      document  unless  the  leading  _t_o_k_e_n is  quoted;  parameter
        !           230:      substitution and quoting are described below.
        !           231: 
        !           232: _c_o_m_m_a_n_d 22> _f_i_l_e
        !           233:      Redirect  the  standard  error  stream  into  a  file.   For
        !           234:      example, the command
        !           235: 
        !           236:              nroff -ms textfile >textfile.p 2>textfile.err
        !           237: 
        !           238:      invokes  the  command   nnrrooffff  to  format  the  contents  of
        !           239:      tteexxttffiillee.   It  redirects the  output  of  nnrrooffff (i.e.,  the
        !           240:      standard  output)  into tteexxttffiillee.pp;  it  also redirects  any
        !           241:      error   messages   that  nnrrooffff   may   generate  into   file
        !           242:      tteexxttffiillee.eerrrr.
        !           243: 
        !           244:      Note in passing that a command may use up to 20 streams.  By
        !           245:      default, stream  0 is  the standard  input; stream 1  is the
        !           246:      standard output;  and stream 2  is the standard  error.  kksshh
        !           247:      lets  you redirect  any of  these streams  individually into
        !           248:      files, or combine streams into each other.
        !           249: 
        !           250: <&_n  kksshh can redirect  the standard input and output to duplicate
        !           251:      other  file  descriptors.   (See  the Lexicon  article  ffiillee
        !           252:      ddeessccrriippttoorr  for details  on what  these are.)  This operator
        !           253:      duplicates the standard input from file descriptor _n.
        !           254: 
        !           255: >&_n  Duplicate the  standard output from file  descriptor _n.  For
        !           256:      example,
        !           257: 
        !           258:              2>&1
        !           259: 
        !           260: 
        !           261: 
        !           262: COHERENT Lexicon                                           Page 4
        !           263: 
        !           264: 
        !           265: 
        !           266: 
        !           267: ksh                          Command                          ksh
        !           268: 
        !           269: 
        !           270: 
        !           271:      redirects  file descriptor  2 (the  standard error)  to file
        !           272:      descriptor 1 (the standard output).
        !           273: 
        !           274: Note that each  command executed as a foreground process inherits
        !           275: the file  descriptors and signal  traps (described below)  of the
        !           276: invoking   shell,   modified   by  any   specified   redirection.
        !           277: Background processes  take input  from the null  device /ddeevv/nnuullll
        !           278: (unless redirected), and ignore interrupt and quit signals.
        !           279: 
        !           280: ***** File-Name Patterns *****
        !           281: 
        !           282: The  shell interprets  an  input token  that contain  any of  the
        !           283: special characters `?', `*', or `[' as a file name _p_a_t_t_e_r_n.
        !           284: 
        !           285: ?  Match any  single character except newline.   For example, the
        !           286:    command
        !           287: 
        !           288:            ls name?
        !           289: 
        !           290:    will print  the name of  any file that consists  of the string
        !           291:    nnaammee  plus  any one  character.   If nnaammee  is  followed by  no
        !           292:    characters, or is followed  by two or more characters, it will
        !           293:    not be printed.
        !           294: 
        !           295: *  Match  a  string  of  non-newline  characters  of  any  length
        !           296:    (including zero).
        !           297: 
        !           298:            ls name*
        !           299: 
        !           300:    will print  the name of  any file that begins  with the string
        !           301:    nnaammee,  regardless  of  whether it  is  followed  by any  other
        !           302:    characters.  Likewise, the command
        !           303: 
        !           304:            ls name?*
        !           305: 
        !           306:    will print  the name of  any file that consists  of the string
        !           307:    nnaammee followed  by at least  one character.  Unlike  nnaammee*, the
        !           308:    token  nnaammee?*  insists  that  be  followed  by  at  least  one
        !           309:    character before it will be printed.
        !           310: 
        !           311: ~_n_a_m_e
        !           312:    Replace the  name of user _n_a_m_e with  his $HHOOMMEE directory.  For
        !           313:    example, the command
        !           314: 
        !           315:            ls -l ~norm/src
        !           316: 
        !           317:    lists the  contents of the _s_r_c  subdirectory located under the
        !           318:    $HHOOMMEE directory for user  nnoorrmm. This spares you from having to
        !           319:    know where a given user's HOME directory is located.
        !           320: 
        !           321: [_C-_c]
        !           322:    Enclose alternatives to match a single character.  A hyphen `-
        !           323:    ' indicates a range of characters.  For example, the command
        !           324: 
        !           325:            ls name[ABC]
        !           326: 
        !           327: 
        !           328: COHERENT Lexicon                                           Page 5
        !           329: 
        !           330: 
        !           331: 
        !           332: 
        !           333: ksh                          Command                          ksh
        !           334: 
        !           335: 
        !           336: 
        !           337: 
        !           338:    will  print  the  names  of  files  nnaammeeAA,  nnaammeeBB,  and  nnaammeeCC
        !           339:    (assuming, of  course, that those  files exist in  the current
        !           340:    directory).  The command
        !           341: 
        !           342:            ls name[A-K]
        !           343: 
        !           344:    prints the names of files nnaammeeAA through nnaammeeKK (again, assuming
        !           345:    that they exist in the current directory).
        !           346: 
        !           347: When kksshh reads a token that contains one of the above characters,
        !           348: it replaces  the token in  the command line  with an alphabetized
        !           349: list  of file  names  that match  the  pattern.  If  it finds  no
        !           350: matches,  it passes  the  token unchanged  to  the command.   For
        !           351: example, when you enter the command
        !           352: 
        !           353: 
        !           354:         ls name[ABC]
        !           355: 
        !           356: 
        !           357: kksshh  replaces the  token nnaammee[AABBCC] with  nnaammeeAA, nnaammeeBB,  and nnaammeeCC
        !           358: (again, if  they exist in the current  directory), so the command
        !           359: now reads:
        !           360: 
        !           361: 
        !           362:         ls nameA nameB nameC
        !           363: 
        !           364: 
        !           365: It then  passes this second,  transformed version of  the command
        !           366: line to the command llss.
        !           367: 
        !           368: Note that  the slash `/'  and leading period `.'  must be matched
        !           369: explicitly  in a  pattern.  The slash,  of course,  separates the
        !           370: elements of  a path name; while  a period at the  begin of a file
        !           371: name  usually  (but  not always)  indicates  that  that file  has
        !           372: special significance.
        !           373: 
        !           374: ***** Quoting Text *****
        !           375: 
        !           376: From  time to  time, you  will want to  ``turn off''  the special
        !           377: meaning of characters.  For example, you may wish to pass a token
        !           378: that contains a literal asterisk to a command; to do so, you need
        !           379: a way  to tell kksshh  not to expand  the token into a  list of file
        !           380: names.  Therefore, kksshh includes the qquuoottaattiioonn ooppeerraattoorrss `\', `"',
        !           381: and `'';  these ``turn  off'' (or  _q_u_o_t_e) the special  meaning of
        !           382: operators.
        !           383: 
        !           384: The backslash  `\' quotes the following  character.  For example,
        !           385: the command
        !           386: 
        !           387: 
        !           388: 
        !           389: 
        !           390: 
        !           391: 
        !           392: 
        !           393: 
        !           394: COHERENT Lexicon                                           Page 6
        !           395: 
        !           396: 
        !           397: 
        !           398: 
        !           399: ksh                          Command                          ksh
        !           400: 
        !           401: 
        !           402: 
        !           403:         ls name\*
        !           404: 
        !           405: 
        !           406: lists a file named nnaammee*, and no other.
        !           407: 
        !           408: The shell ignores  a backslash immediately followed by a newline,
        !           409: called a _c_o_n_c_e_a_l_e_d _n_e_w_l_i_n_e.  This lets you give more arguments to
        !           410: a command than will fit on one line.  For example, the command
        !           411: 
        !           412: 
        !           413:         cc -o output file1.c file2.c file3.c \
        !           414:                 file4.c file5.c file19.c
        !           415: 
        !           416: 
        !           417: invokes the C compiler cccc to compile a set of C source files, the
        !           418: names of which extend over more than one line of input.  You will
        !           419: find  this to  be extremely  helpful,  especially when  you write
        !           420: scripts  and  mmaakkeeffiillees,  to help  you  write  neat, easily  read
        !           421: commands.
        !           422: 
        !           423: A pair of apostrophes ' ' prevents interpretation of any enclosed
        !           424: special characters.  For example, the command
        !           425: 
        !           426: 
        !           427:         find . -name '*.c' -print
        !           428: 
        !           429: 
        !           430: finds and  prints the  name of any  C-source file in  the current
        !           431: directory and any  subdirectory.  The command ffiinndd interprets the
        !           432: `*'  internally;  therefore, you  want  to  suppress the  shell's
        !           433: expansion of  that operator,  which is accomplished  by enclosing
        !           434: that token between apostrophes.
        !           435: 
        !           436: A pair of quotation marks " "  has   the  same   effect.   Unlike
        !           437: apostrophes, however, kksshh will perform parameter substitution and
        !           438: command-output  substitution (described  below) within  quotation
        !           439: marks.  Note  that everything between  quotation marks will  be a
        !           440: single  argument, even  if there are  spaces between  the tokens.
        !           441: For example, the command
        !           442: 
        !           443: 
        !           444:         grep "x y" *.c
        !           445: 
        !           446: 
        !           447: calls  the string-search  command  ggrreepp to  look  for the  string
        !           448: xx<ssppaaccee>yy.
        !           449: 
        !           450: ***** Scripts *****
        !           451: 
        !           452: Shell commands can be stored in a file, or _s_c_r_i_p_t. The command
        !           453: 
        !           454: 
        !           455: 
        !           456: 
        !           457: 
        !           458: 
        !           459: 
        !           460: COHERENT Lexicon                                           Page 7
        !           461: 
        !           462: 
        !           463: 
        !           464: 
        !           465: ksh                          Command                          ksh
        !           466: 
        !           467: 
        !           468: 
        !           469:         ksh _s_c_r_i_p_t [ _p_a_r_a_m_e_t_e_r ... ]
        !           470: 
        !           471: 
        !           472: executes the  commands in  _s_c_r_i_p_t with  a new subshell  kksshh. Each
        !           473: _p_a_r_a_m_e_t_e_r  is a  value for a  positional parameter,  as described
        !           474: below.   If  you  have used  the  command  cchhmmoodd  to make  _s_c_r_i_p_t
        !           475: executable, you may omit the kksshh command.
        !           476: 
        !           477: Parameters  of  the form  `$_n'  represent command-line  arguments
        !           478: within a  script.  _n can range from zero  through nine; $00 always
        !           479: gives the  name of the script.  These  parameters are also called
        !           480: _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r_s.
        !           481: 
        !           482: If no  corresponding parameter is given on  the command line, the
        !           483: shell  substitutes  the  null  string  for that  parameter.   For
        !           484: example, if the script ffoorrmmaatt contains the following line:
        !           485: 
        !           486: 
        !           487:         nroff -ms $1 >$1.out
        !           488: 
        !           489: 
        !           490: then invoking ffoorrmmaatt with the command line:
        !           491: 
        !           492: 
        !           493:         format mytext
        !           494: 
        !           495: 
        !           496: invokes the  command nnrrooffff to format the  contents of mmyytteexxtt, and
        !           497: writes the output  into file mmyytteexxtt.oouutt.  If, however, you invoke
        !           498: this command with the command line
        !           499: 
        !           500: 
        !           501:         format mytext yourtext
        !           502: 
        !           503: 
        !           504: the script will format mmyytteexxtt but ignore yyoouurrtteexxtt altogether.
        !           505: 
        !           506: Reference  $*  represents all  command-line  arguments.  If,  for
        !           507: example, we change the contents of script ffoorrmmaatt to read
        !           508: 
        !           509: 
        !           510:         nroff -ms $* >$1.out
        !           511: 
        !           512: 
        !           513: then the command
        !           514: 
        !           515: 
        !           516:         format mytext yourtext
        !           517: 
        !           518: 
        !           519: will invoke nnrrooffff to  format the contents of mmyytteexxtt and yyoouurrtteexxtt,
        !           520: and write the output into file mmyytteexxtt.oouutt.
        !           521: 
        !           522: Commands  in a  script  can also  be  executed with  the .  (dot)
        !           523: command.   It resembles  the kksshh command,  but the  current shell
        !           524: 
        !           525: 
        !           526: COHERENT Lexicon                                           Page 8
        !           527: 
        !           528: 
        !           529: 
        !           530: 
        !           531: ksh                          Command                          ksh
        !           532: 
        !           533: 
        !           534: 
        !           535: executes the script commands without creating a new subshell or a
        !           536: new   environment;  therefore,   you   cannot  use   command-line
        !           537: arguments.
        !           538: 
        !           539: ***** Variables *****
        !           540: 
        !           541: Shell variables are names that can be assigned string values on a
        !           542: command line, in the form
        !           543: 
        !           544: 
        !           545:         _n_a_m_e=_v_a_l_u_e
        !           546: 
        !           547: 
        !           548: The  name must  begin  with a  letter, and  can contain  letters,
        !           549: digits,  and  underscores   `_'.   In  shell  input,  `$_n_a_m_e'  or
        !           550: `${_n_a_m_e}' represents the value of the variable.  For example:
        !           551: 
        !           552: 
        !           553:         TEXT=mytext
        !           554: 
        !           555:         nroff -ms $TEXT >$TEXT.out
        !           556: 
        !           557: 
        !           558: Here,  kksshh expands  $TTEEXXTT before it  executes the  nnrrooffff command.
        !           559: This technique is very useful in large, complex scripts: by using
        !           560: variables, you  can change the behavior of  the script by editing
        !           561: one  line,   rather  than  having  to   edit  numerous  variables
        !           562: throughout the script.
        !           563: 
        !           564: Note that if an assignment precedes a command on the same command
        !           565: line,  the effect  of the  assignment is  local to  that command;
        !           566: otherwise, the effect is permanent.  For example,
        !           567: 
        !           568: 
        !           569:         kp=one testproc
        !           570: 
        !           571: 
        !           572: assigns variable  kkpp the value oonnee only for  the execution of the
        !           573: script tteessttpprroocc.
        !           574: 
        !           575: kksshh sets the following variables by default:
        !           576: 
        !           577: #  The  number  of  actual  positional  parameters given  to  the
        !           578:    current command.
        !           579: 
        !           580: @  The list of positional parameters ``$1 $2 ...''.
        !           581: 
        !           582: *  The list of positional parameters ``$1'' ``$2'' ...  (the same
        !           583:    as `$@' unless some parameters are quoted).
        !           584: 
        !           585: -  Options  set in  the invocation  of  the shell  or by  the sseett
        !           586:    command.
        !           587: 
        !           588: ?  The exit status returned by the last command.
        !           589: 
        !           590: 
        !           591: 
        !           592: COHERENT Lexicon                                           Page 9
        !           593: 
        !           594: 
        !           595: 
        !           596: 
        !           597: ksh                          Command                          ksh
        !           598: 
        !           599: 
        !           600: 
        !           601: !  The process number of the last command invoked with `&'.
        !           602: 
        !           603: $  The process number of the current shell.
        !           604: 
        !           605: ***** Environmental Variables *****
        !           606: 
        !           607: kksshh references the following environmental variables:
        !           608: 
        !           609: CCWWDD     Current  working  directory: this  is  the  name  of  the
        !           610:         directory in which you are now working.
        !           611: 
        !           612: EENNVV     If this variable  is set  at start-up, after  all pprrooffiillee
        !           613:         files have been  executed, the expanded value  is used as
        !           614:         the  shell's   start-up  file.    It  typically   defines
        !           615:         functions and aliases.
        !           616: 
        !           617: FFCCEEDDIITT  This sets the editor used by the command ffcc.
        !           618: 
        !           619: HHOOMMEE    Initial  working  directory;  usually  specified  in  the
        !           620:         password file /eettcc/ppaasssswwdd.
        !           621: 
        !           622: IIFFSS     Delimiters  for  tokens;  by   default  space,  tab,  and
        !           623:         newline.
        !           624: 
        !           625: KKSSHH_VVEERRSSIIOONN
        !           626:         The current version of the Korn shell that you are using.
        !           627: 
        !           628: MMAAIILL    Checked at intervals specified  by environmental variable
        !           629:         MMAAIILLCCHHEECCKK. If  file  specified by  this  variable is  new
        !           630:         since last checked,  the shell prints  ``You have mail.''
        !           631:         on the  user's terminal.   If the  file has  increased in
        !           632:         size since the  last check,  the shell prints  ``You have
        !           633:         new mail.'' on the user's terminal.
        !           634: 
        !           635: MMAAIILLCCHHEECCKK
        !           636:         Specifies the number of seconds  between checking for new
        !           637:         mail.   If  not  specified,   MMAAIILLCCHHEECCKK  defaults  to  60
        !           638:         seconds.
        !           639: 
        !           640: OOLLDDPPWWDD  The prior working directory, if any.
        !           641: 
        !           642: PPAATTHH    Colon-separated  list   of   directories   searched   for
        !           643:         commands.
        !           644: 
        !           645: PPSS11     First prompt  string,  usually `$'.   Note  that in  this
        !           646:         variable and  PPSS22,  kksshh  expands the  symbol  ! into  the
        !           647:         current number  of the  command line.   For  example, the
        !           648:         prompt kksshh !> prints the prompt kksshh _N_N>    with     every
        !           649:         command, where _N_N  is the number of  the current command.
        !           650:         This is useful when you have enabled the history feature,
        !           651:         as described below.
        !           652: 
        !           653: PPSS22     Second prompt string, usually `>'.  kksshh prints it when it
        !           654:         expects more input,  such as when  an open quotation-mark
        !           655:         has been typed  but a  close quotation-mark has  not been
        !           656: 
        !           657: 
        !           658: COHERENT Lexicon                                          Page 10
        !           659: 
        !           660: 
        !           661: 
        !           662: 
        !           663: ksh                          Command                          ksh
        !           664: 
        !           665: 
        !           666: 
        !           667:         typed, or within a shell construct.
        !           668: 
        !           669: PPWWDD     The present working directory, i.e., the directory within
        !           670:         which you are now working.
        !           671: 
        !           672: SSEECCOONNDDSS
        !           673:         The  number  of  seconds  since  the  current  shell  was
        !           674:         started.
        !           675: 
        !           676: SSHHEELLLL   The  full  path  name  of the  shell  that  you  are  now
        !           677:         executing.
        !           678: 
        !           679: TTEERRMM    The name of  the type of  terminal you are  now using, as
        !           680:         used  by   various   programs   for   reading  the   file
        !           681:         /eettcc/tteerrmmccaapp.
        !           682: 
        !           683: TTIIMMEEZZOONNEE
        !           684:         The current timezone you  are located in, as  set in your
        !           685:         .pprrooffiillee.  This is an  interesting and powerful variable;
        !           686:         see its entry in the Lexicon for details.
        !           687: 
        !           688: UUSSEERR    The login-identifier of the user, i.e., you.
        !           689: 
        !           690: The following special forms substitute parameters conditionally:
        !           691: 
        !           692: ${_n_a_m_e-_t_o_k_e_n}
        !           693:      Substitite  _n_a_m_e if  it  is set;  if it  is not,  substitute
        !           694:      _t_o_k_e_n.
        !           695: 
        !           696: ${_n_a_m_e=_t_o_k_e_n}
        !           697:      Substitute _n_a_m_e  if it is set; if it  is not set, substitute
        !           698:      _t_o_k_e_n and set _n_a_m_e to equal _t_o_k_e_n.
        !           699: 
        !           700: ${_n_a_m_e+_t_o_k_e_n}
        !           701:      Substitute _t_o_k_e_n if _n_a_m_e is set.
        !           702: 
        !           703: ${_n_a_m_e?_t_o_k_e_n}
        !           704:      Substitute _n_a_m_e if it is set;  if it is not, print _t_o_k_e_n and
        !           705:      exit from the shell.
        !           706: 
        !           707: ***** Command Output Substitution *****
        !           708: 
        !           709: kksshh can  use the output of  a command as shell  input (as command
        !           710: arguments,  for  example)  by  enclosing  the  command  in  grave
        !           711: characters ` `.   For  example,  to  list  the  contents  of  the
        !           712: directories named in file ddiirrss, use the command
        !           713: 
        !           714: 
        !           715:         ls -l `cat dirs`
        !           716: 
        !           717: 
        !           718: ***** Constructs *****
        !           719: 
        !           720: kksshh  lets  you  control the  execution  of  programs through  the
        !           721: following  constructs.   It recognizes  a  construct  only if  it
        !           722: 
        !           723: 
        !           724: COHERENT Lexicon                                          Page 11
        !           725: 
        !           726: 
        !           727: 
        !           728: 
        !           729: ksh                          Command                          ksh
        !           730: 
        !           731: 
        !           732: 
        !           733: occurs unquoted  as the first  token of a  command.  This implies
        !           734: that a separator must precede each reserved word in the following
        !           735: constructs; for  example, newline or  `;' must precede  ddoo in the
        !           736: ffoorr construct.
        !           737: 
        !           738: bbrreeaakk [_n]
        !           739:      Exit from ffoorr,  uunnttiill, or wwhhiillee. If _n is  given, exit from _n
        !           740:      levels.
        !           741: 
        !           742: ccaassee _t_o_k_e_n iinn [ _p_a_t_t_e_r_n [ | _p_a_t_t_e_r_n ] ...) _s_e_q_u_e_n_c_e;; ] ... eessaacc
        !           743:      Check  _t_o_k_e_n  against  each  _p_a_t_t_e_r_n, and  execute  _s_e_q_u_e_n_c_e
        !           744:      associated with the first matching _p_a_t_t_e_r_n.
        !           745: 
        !           746: ccoonnttiinnuuee [_n]
        !           747:      Branch to the end of  the _nth enclosing ffoorr, uunnttiill, or wwhhiillee
        !           748:      construct.
        !           749: 
        !           750: ffoorr _n_a_m_e [ iinn _t_o_k_e_n ... ] ddoo _s_e_q_u_e_n_c_e ddoonnee
        !           751:      Execute  _s_e_q_u_e_n_c_e once  for each  _t_o_k_e_n. On  each iteration,
        !           752:      _n_a_m_e takes the value of the  next _t_o_k_e_n. If the iinn clause is
        !           753:      omitted,  $@ is  assumed.  For  example,  to list  all files
        !           754:      ending with .cc:
        !           755: 
        !           756:              for i in *.c
        !           757:              do
        !           758:                      cat $i
        !           759:              done
        !           760: 
        !           761: 
        !           762: iiff _s_e_q_1 tthheenn _s_e_q_2 [ eelliiff _s_e_q_3 tthheenn _s_e_q_4 ] ... [ eellssee _s_e_q_5 ] ffii
        !           763:      Execute _s_e_q_1.  If the exit status is  zero, execute _s_e_q_2; if
        !           764:      not, execute the optional _s_e_q_3 if given.  If the exit status
        !           765:      of _s_e_q_3 is zero, then execute  _s_e_q_4, and so on.  If the exit
        !           766:      status of all tested sequences is nonzero, execute _s_e_q_5.
        !           767: 
        !           768: ttiimmee _s_e_q_u_e_n_c_e
        !           769:      Time how  long it takes _s_e_q_u_e_n_c_e  to execute.  When _s_e_q_u_e_n_c_e
        !           770:      has  finished  exeucting,  the  time  is  displayed  on  the
        !           771:      standard output.
        !           772: 
        !           773: wwhhiillee _s_e_q_u_e_n_c_e_1 [ ddoo _s_e_q_u_e_n_c_e_2 ] ddoonnee
        !           774:      Execute  _s_e_q_u_e_n_c_e_2 as  long  as the  execution of  _s_e_q_u_e_n_c_e_1
        !           775:      results in an exit status of zero.
        !           776: 
        !           777: (_s_e_q_u_e_n_c_e)
        !           778:      Execute _s_e_q_u_e_n_c_e within a subshell.  This allows _s_e_q_u_e_n_c_e to
        !           779:      change the  current directory,  for example, and  not affect
        !           780:      the enclosing environment.
        !           781: 
        !           782: {_s_e_q_u_e_n_c_e}
        !           783:      Braces simply enclose a _s_e_q_u_e_n_c_e.
        !           784: 
        !           785: ***** Built-in Commands *****
        !           786: 
        !           787: kksshh  executes  most  commands via  the  ffoorrkk  system call,  which
        !           788: 
        !           789: 
        !           790: COHERENT Lexicon                                          Page 12
        !           791: 
        !           792: 
        !           793: 
        !           794: 
        !           795: ksh                          Command                          ksh
        !           796: 
        !           797: 
        !           798: 
        !           799: creates a  new process.  See  the Lexicon articles  on ffoorrkk() and
        !           800: eexxeecc  for details  on these  calls.  kksshh  also has  the following
        !           801: commands built into itself.
        !           802: 
        !           803: . _s_c_r_i_p_t
        !           804:      Read and execute commands from _s_c_r_i_p_t. Positional parameters
        !           805:      are not allowed.   kksshh searches the directories named in the
        !           806:      environmental variable PPAATTHH to find the given _s_c_r_i_p_t.
        !           807: 
        !           808: : [_t_o_k_e_n ...]
        !           809:      A colon  `:' indicates a ``partial  comment''.  kksshh normally
        !           810:      ignores all  commands on  a line  that begins with  a colon,
        !           811:      except for redirection and such symbols as $, {, ?, etc.
        !           812: 
        !           813: #    A complete  comment: if # is the first  character on a line,
        !           814:      kksshh ignores all text that follows on that line.
        !           815: 
        !           816: aalliiaass [-dd] [_n_a_m_e=_v_a_l_u_e ...]
        !           817:      When called without  arguments, aalliiaass prints all aliases and
        !           818:      their  values.  When  called with a  _n_a_m_e but  no associated
        !           819:      value, then it prints the value of _n_a_m_e.  When called with a
        !           820:      _n_a_m_e and _v_a_l_u_e combination, it associated _v_a_l_u_e with _n_a_m_e.
        !           821: 
        !           822:      For example, the command
        !           823: 
        !           824:              alias logout='exit'
        !           825: 
        !           826:      binds  the  token llooggoouutt  to  the  command eexxiitt:  hereafter,
        !           827:      whenever you  type llooggoouutt,  it will be  as if you  typed the
        !           828:      eexxiitt command.
        !           829: 
        !           830:      The -dd option creates an alias for a directory.
        !           831: 
        !           832:      kksshh has a number of aliases set by default.  See the section
        !           833:      AAlliiaasseess, below, for details.
        !           834: 
        !           835: bbiinndd [-mm] [_k_e_y__s_e_q_u_e_n_c_e=_b_i_n_d_i_n_g__n_a_m_e ...]
        !           836:      When called  without arguments, list the  current set of key
        !           837:      bindings  for  MicroEMACS-style  editing of  command  lines.
        !           838:      When  called  with   arguments,  bind  the  _k_e_y__s_e_q_u_e_n_c_e  to
        !           839:      _b_i_n_d_i_n_g__n_a_m_e.
        !           840: 
        !           841:      For example, the command
        !           842: 
        !           843:              bind '^[^H'=delete-word-backward
        !           844: 
        !           845:      binds  the editing command  ddeelleettee-wwoorrdd-bbaacckkwwaarrdd to  the key
        !           846:      sequence <eesscc><bbaacckkssppaaccee>.   Note that the  carat characters
        !           847:      in  this  command   are  literally  that,  not  the  shell's
        !           848:      representation of a literal <eesscc> or <bbaacckkssppaaccee> character.
        !           849: 
        !           850:      When  called  with   the  -mm  option,  bind  more  than  one
        !           851:      _b_i_n_d_i_n_g__n_a_m_e to  a given _k_e_y__s_e_q_u_e_n_c_e.  This  lets you build
        !           852:      keyboard macros,  to perform complex editing  tasks with one
        !           853:      or two keystrokes.
        !           854: 
        !           855: 
        !           856: COHERENT Lexicon                                          Page 13
        !           857: 
        !           858: 
        !           859: 
        !           860: 
        !           861: ksh                          Command                          ksh
        !           862: 
        !           863: 
        !           864: 
        !           865: 
        !           866:      See the section on CCoommmmaanndd-lliinnee EEddiittiinngg, below, for details.
        !           867: 
        !           868: bbuuiillttiinn _c_o_m_m_a_n_d
        !           869:      Execute _c_o_m_m_a_n_d as a built-in command.
        !           870: 
        !           871: ccdd _d_i_r
        !           872:      Change  the working  directory  to _d_i_r.  If  no argument  is
        !           873:      given,  change   to  the  home  directory   as  set  by  the
        !           874:      environmental variable  HHOOMMEE. When invoked,  it also changes
        !           875:      the environmental variables PPWWDD and OOLLDDPPWWDD.
        !           876: 
        !           877:      Using a  hyphen `-' as the argument causes  kksshh to change to
        !           878:      the  previous directory,  i.e., the  one indicated  by shell
        !           879:      variable OOLLDDPPWWDD. In  effect, this swaps OOLLDDPPWWDD and PPWWDD, thus
        !           880:      allowing  you to  flop  back and  forth  easily between  two
        !           881:      directories.
        !           882: 
        !           883: eecchhoo _t_o_k_e_n ...
        !           884:      Echo  _t_o_k_e_n  onto the  standard  output.   kksshh replaces  the
        !           885:      command eecchhoo with the alias eecchhoo='pprriinntt'.
        !           886: 
        !           887: eevvaall [_t_o_k_e_n ...]
        !           888:      Evaluate each _t_o_k_e_n and treat the result as shell input.
        !           889: 
        !           890: eexxeecc [_c_o_m_m_a_n_d]
        !           891:      Execute _c_o_m_m_a_n_d directly  rather than as a subprocess.  This
        !           892:      terminates the current shell.
        !           893: 
        !           894: eexxiitt [_s_t_a_t_u_s]
        !           895:      Set  the exit  status to _s_t_a_t_u_s,  if given,  then terminate;
        !           896:      otherwise, the previous status is used.
        !           897: 
        !           898: eexxppoorrtt [_n_a_m_e ...]
        !           899:      kksshh  executes  each  command  in  an _e_n_v_i_r_o_n_m_e_n_t,  which  is
        !           900:      essentially a set  of shell variable names and corresponding
        !           901:      string values.  It inherits an environment when invoked, and
        !           902:      normally it  passes the same environment  to each command it
        !           903:      invokes.  eexxppoorrtt  specifies that  the shell should  pass the
        !           904:      modified  value of  each given  _n_a_m_e  to the  environment of
        !           905:      subsequent commands.  When  no _n_a_m_e is given, kksshh prints the
        !           906:      name of each variable marked for export.
        !           907: 
        !           908: ffcc [-ll] [-nn] [_f_i_r_s_t [_l_a_s_t]]
        !           909:      Draw  the previously  executed commands  _f_i_r_s_t  through _l_a_s_t
        !           910:      back  for manipulation  and possible  execution.   _f_i_r_s_t and
        !           911:      _l_a_s_t can  be referenced either by  their history numbers, or
        !           912:      by  a string  with  which the  command  in question  begins.
        !           913:      Normally,  the  commands  are  pulled  into  an  editor  for
        !           914:      manipulation before they are executed; the editor is defined
        !           915:      by  the environmental  variable FFCCEEDDIITT  (default,  eedd).  The
        !           916:      commands in  question are executed as soon  as you exit from
        !           917:      the editor.   Option -ll lists the  command(s) on ssttddoouutt, and
        !           918:      so suppresses  the editing feature.  Option  -nn inhibits the
        !           919:      default history numbers.
        !           920: 
        !           921: 
        !           922: COHERENT Lexicon                                          Page 14
        !           923: 
        !           924: 
        !           925: 
        !           926: 
        !           927: ksh                          Command                          ksh
        !           928: 
        !           929: 
        !           930: 
        !           931: 
        !           932: ffcc -ss [_o_l_d=_n_e_w] [_c_o_m_m_a_n_d]
        !           933:      Re-execute _c_o_m_m_a_n_d after substituting string _n_e_w for _o_l_d.
        !           934: 
        !           935: ggeettooppttss _o_p_t_s_t_r_i_n_g _n_a_m_e [_a_r_g ...]
        !           936:      Parse  the _a_r_gs  to See  the Lexicon  entry for  ggeettooppttss for
        !           937:      details.
        !           938: 
        !           939: hhaasshh [-rr] [_n_a_m_e ...]
        !           940:      When called without  arguments, hhaasshh lists the path names of
        !           941:      all hashed  commands.  When called  with _n_a_m_e hhaasshh  check to
        !           942:      see if it is an executable command, and if so adds it to the
        !           943:      shell's hash list.  The -rr option removes _n_a_m_e from the hash
        !           944:      list.
        !           945: 
        !           946: kkiillll [-ll] [_s_i_g_n_a_l] _p_r_o_c_e_s_s ...
        !           947:      Send _s_i_g_n_a_l  to _p_r_o_c_e_s_s. The  default signal is  TTEERRMM, which
        !           948:      terminates the process.  _s_i_g_n_a_l  may either be a number or a
        !           949:      mnemonic as #ddeeffiinneed  in header file <ssiiggnnaall.hh>. When called
        !           950:      with the  -ll option,  it lists  all known types  of signals.
        !           951:      See the Lexicon entry for kkiillll for details.
        !           952: 
        !           953: lleett [_e_x_p_r_e_s_s_i_o_n]
        !           954:      Evaluate  each  _e_x_p_r_e_s_s_i_o_n.  This  command returns  zero  if
        !           955:      _e_x_p_r_e_s_s_i_o_n evaluates to  non-zero (i.e., fails), and returns
        !           956:      non-zero if  it evalutes to zero  (i.e., succeeds).  This is
        !           957:      useful for evaluating  expressions before actually executing
        !           958:      them.
        !           959: 
        !           960: pprriinntt [-nnrreeuu_n] [_a_r_g_u_m_e_n_t ...]
        !           961:      Print  each _a_r_g_u_m_e_n_t  on the  standard output,  separated by
        !           962:      spaces and terminated  with a newline.  Option -nn suppresses
        !           963:      printing of  the newline.  Option -uu_n  redirects output from
        !           964:      the standard output to file descriptor _n.
        !           965: 
        !           966:      Note that each _a_r_g_u_m_e_n_t can contain the following standard C
        !           967:      escape characters:  \bb, \ff,  \nn, \rr,  \vv, and \###.  See the
        !           968:      Lexicon article  on CC LLaanngguuaaggee for  details each character's
        !           969:      meaning.  The  option -rr inhibits  this feature, and  the -ee
        !           970:      option re-enables it.
        !           971: 
        !           972: rreeaadd _n_a_m_e ...
        !           973:      Read a line from the standard input and assign each token of
        !           974:      the input  to the corresponding shell  variable _n_a_m_e. If the
        !           975:      input contains  fewer tokens than the  _n_a_m_e list, assign the
        !           976:      null string to  extra variables.  If the input contains more
        !           977:      tokens, assign the last _n_a_m_e the remainder of the input.
        !           978: 
        !           979: rreeaaddoonnllyy [_n_a_m_e ...]
        !           980:      Mark  each  shell variable  _n_a_m_e  as  a read-only  variable.
        !           981:      Subsequent  assignments to read-only  variables will  not be
        !           982:      permitted.  With  no arguments, print the  name and value of
        !           983:      each read-only variable.
        !           984: 
        !           985: 
        !           986: 
        !           987: 
        !           988: COHERENT Lexicon                                          Page 15
        !           989: 
        !           990: 
        !           991: 
        !           992: 
        !           993: ksh                          Command                          ksh
        !           994: 
        !           995: 
        !           996: 
        !           997: rreettuurrnn [_s_t_a_t_u_s]
        !           998:      Return _s_t_a_t_u_s to the parent process.
        !           999: 
        !          1000: sseett [-aaeeffhhkkmmnnuuvvxx [-oo _k_e_y_w_o_r_d] [_n_a_m_e ...] ]
        !          1001:      Set listed flag.   The -oo option sets _k_e_y_w_o_r_d, where _k_e_y_w_o_r_d
        !          1002:      is a shell option.
        !          1003: 
        !          1004:      When used  with one or  more _n_a_m_e_s, this  command sets shell
        !          1005:      variables _n_a_m_e to  values of positional parameters beginning
        !          1006:      with $11.
        !          1007: 
        !          1008:      For example, the command
        !          1009: 
        !          1010:              set -h -o emacs ignoreeof
        !          1011: 
        !          1012:      performs the  following: turns on hashing  for all commands,
        !          1013:      turns  on MicroEMACS-style  command-line editing,  and turns
        !          1014:      off exiting  upon EOF (that  is, you must type  eexxiitt to exit
        !          1015:      from the  shell).  sseett  commands are especially  useful when
        !          1016:      embedded in  your .pprrooffiillee, where they  can customize kksshh to
        !          1017:      your preferences.
        !          1018: 
        !          1019:      For details of this command, see its Lexicon entry.
        !          1020: 
        !          1021: sshhiifftt
        !          1022:      Rename positional parameter 11 to current value of $22, and so
        !          1023:      on.
        !          1024: 
        !          1025: tteesstt [_o_p_t_i_o_n] [_e_x_p_r_e_s_s_i_o_n]
        !          1026:      Check _e_x_p_r_e_s_s_i_o_n for condition  _o_p_t_i_o_n. This is a useful and
        !          1027:      complex command, with  more options than can be listed here.
        !          1028:      See its Lexicon entry for details.
        !          1029: 
        !          1030: ttiimmeess
        !          1031:      Print on  the standard output  a summary of  processing time
        !          1032:      used by the current shell and all of its child processes.
        !          1033: 
        !          1034: ttrraapp [_c_o_m_m_a_n_d] [_n ...]
        !          1035:      Execute  _c_o_m_m_a_n_d if  kksshh receives  signal  _n. If  _c_o_m_m_a_n_d is
        !          1036:      omitted,  reset  traps  to  original  values.  To  ignore  a
        !          1037:      signal, pass  null string as  _c_o_m_m_a_n_d. With _n  zero, execute
        !          1038:      _c_o_m_m_a_n_d when the  shell exits.  With no arguments, print the
        !          1039:      current trap settings.
        !          1040: 
        !          1041: ttyyppeesseett [-ffiirrxx] [+ffiirrxx] [_n_a_m_e [=_v_a_l_u_e] ... ]
        !          1042:      When  called without  an  argument, this  command lists  all
        !          1043:      variables and their attributes.
        !          1044: 
        !          1045:      When called with an option  but without a _n_a_m_e, it lists all
        !          1046:      variables that have the specified attribute; - tells ttyyppeesseett
        !          1047:      to list the value of each variable and + tells it not to.
        !          1048: 
        !          1049:      When called  with one  or more _n_a_m_e_s,  it gives _n_a_m_e  to the
        !          1050:      listed  attribute.   If _n_a_m_e  is  associated  with a  _v_a_l_u_e,
        !          1051:      ttyyppeesseett also assigns the _v_a_l_u_e to it.
        !          1052: 
        !          1053: 
        !          1054: COHERENT Lexicon                                          Page 16
        !          1055: 
        !          1056: 
        !          1057: 
        !          1058: 
        !          1059: ksh                          Command                          ksh
        !          1060: 
        !          1061: 
        !          1062: 
        !          1063: 
        !          1064:      ttyyppeesseett recognizes the following attributes:
        !          1065: 
        !          1066:              -ii      Store variable's value as an integer
        !          1067:              -ff      List function instead of variable
        !          1068:              -rr      Make the variable read-only
        !          1069:              -xx      Export variable to the environment
        !          1070: 
        !          1071: uummaasskk [_n_n_n]
        !          1072:      Set user file creation mask to _n_n_n. If no argument is given,
        !          1073:      print the current file creation mask.
        !          1074: 
        !          1075: uunnaalliiaass [-dd] _n_a_m_e ...
        !          1076:      Remove the  alias for each _n_a_m_e. The  -dd option unaliases an
        !          1077:      alias for a directory.
        !          1078: 
        !          1079: wwaaiitt [_p_i_d]
        !          1080:      Hold  execution  of   further  commands  until  process  _p_i_d
        !          1081:      terminates.   If   _p_i_d  is  omitted,  wait   for  all  child
        !          1082:      processes.  If no children are active, this command finishes
        !          1083:      immediately.
        !          1084: 
        !          1085: wwhheennccee [-vv] _n_a_m_e ...
        !          1086:      List the type of command for each _n_a_m_e. When called with the
        !          1087:      -vv option, also list functions and aliases.
        !          1088: 
        !          1089: ***** Aliases *****
        !          1090: 
        !          1091: kksshh implements  as aliases a number of commands  that sshh calls as
        !          1092: separate executable programs.  The eecchhoo alias, for instance, does
        !          1093: everything that  /bbiinn/eecchhoo does, but kksshh does  not have to ffoorrkk()
        !          1094: and eexxeecc() simply to echo a token.  Other aliases, like ppwwdd, work
        !          1095: by  printing  the  contents  of  shell  variables.   The  command
        !          1096: /bbiinn/ppwwdd still  works should you prefer it,  but you must request
        !          1097: it by  its full  path name  should you not  wish to use  the much
        !          1098: faster alias version.
        !          1099: 
        !          1100: kksshh sets the following aliases  by default.  If you wish, you can
        !          1101: use the  built-in command uunnaalliiaass to  make one or all  of them go
        !          1102: away.
        !          1103: 
        !          1104:         eecchhoo=pprriinntt
        !          1105:         ffaallssee=lleett
        !          1106:         ffuunnccttiioonnss=ttyyppeesseett -ff
        !          1107:         hhiissttoorryy=ffcc -ll
        !          1108:         iinntteeggeerr=ttyyppeesseett -ii
        !          1109:         llooggiinn=eexxeecc llooggiinn
        !          1110:         nneewwggrrpp=eexxeecc nneewwggrrpp
        !          1111:         ppwwdd=pprriinntt -rr $PPWWDD
        !          1112:         rr=ffcc -ss
        !          1113:         ttrruuee=:
        !          1114:         ttyyppee=wwhheennccee -vv
        !          1115: 
        !          1116: 
        !          1117: 
        !          1118: 
        !          1119: 
        !          1120: COHERENT Lexicon                                          Page 17
        !          1121: 
        !          1122: 
        !          1123: 
        !          1124: 
        !          1125: ksh                          Command                          ksh
        !          1126: 
        !          1127: 
        !          1128: 
        !          1129: ***** Job Control *****
        !          1130: 
        !          1131: kksshh lets  you manipulate and monitor background  jobs via its _j_o_b
        !          1132: _c_o_n_t_r_o_l commands.
        !          1133: 
        !          1134: The following commands manipulate background jobs:
        !          1135: 
        !          1136: jjoobbss Display information about  all controlled jobs.  Information
        !          1137:      is in the following format:
        !          1138: 
        !          1139:              %_n_u_m [+-] _p_i_d _s_t_a_t_u_s _c_o_m_m_a_n_d
        !          1140: 
        !          1141:      where  _n_u_m indicates  the  job number,    `+' indicates  the
        !          1142:      current  job, `-'  indicates the  previous  job, _p_i_d  is the
        !          1143:      job's process identifier, _s_t_a_t_u_s shows the status of the job
        !          1144:      (e.g., Running,  Done, Killed),  and _c_o_m_m_a_n_d is  the command
        !          1145:      description.  Note  that kksshh only checks  for changes in job
        !          1146:      status when waiting for a command to complete.
        !          1147: 
        !          1148: kkiillll [-_s_i_g_n_a_l] _p_i_d ...
        !          1149:      Described above.
        !          1150: 
        !          1151: wwaaiitt [_p_i_d]
        !          1152:      Hold  execution  of   further  commands  until  process  _p_i_d
        !          1153:      terminates.  See its Lexicon entry for details.
        !          1154: 
        !          1155: The following `%' syntax can be used with the above commands:
        !          1156: 
        !          1157: %+   Select the current job.
        !          1158: 
        !          1159: %-   Select the previous job.
        !          1160: 
        !          1161: %_n_u_m Select the job with job number _n_u_m.
        !          1162: 
        !          1163: %_s_t_r_i_n_g
        !          1164:      Select the  most recently  invoked job whose  command begins
        !          1165:      with _s_t_r_i_n_g.
        !          1166: 
        !          1167: %?_s_t_r_i_n_g
        !          1168:      Select the most  recently invoked job whose command contains
        !          1169:      _s_t_r_i_n_g.
        !          1170: 
        !          1171: ***** Command-line Editing *****
        !          1172: 
        !          1173: One of the most useful features of kksshh is its ability to remember
        !          1174: commands that  you have typed previously.   You can interactively
        !          1175: edit previously issued commands and re-issue them with just a few
        !          1176: keystrokes.
        !          1177: 
        !          1178: You  can recall  commands  and edit  them using  the ffcc  command,
        !          1179: described  above.   kksshh,  however,  also  has  built  into  it  a
        !          1180: MicroEMACS editing feature that lets you recall and edit commands
        !          1181: using MicroEMACS-style editing  commands.  When you have finished
        !          1182: editing,  simply typing  <eenntteerr> dispatches  the command  for re-
        !          1183: execution.
        !          1184: 
        !          1185: 
        !          1186: COHERENT Lexicon                                          Page 18
        !          1187: 
        !          1188: 
        !          1189: 
        !          1190: 
        !          1191: ksh                          Command                          ksh
        !          1192: 
        !          1193: 
        !          1194: 
        !          1195: 
        !          1196: To turn on MicroEMACS editing, use the command
        !          1197: 
        !          1198: 
        !          1199:         set -o emacs
        !          1200: 
        !          1201: 
        !          1202: The following  table gives each  editing command and  its default
        !          1203: keybinding.   Note that  you  can replace  any  of the  following
        !          1204: keybindings by  using the  bbiinndd command, described  above.  Note,
        !          1205: too, that not every command has a default keybinding.  Those that
        !          1206: do not have one are marked ``None''.
        !          1207: 
        !          1208: aabboorrtt (<ccttrrll-GG>)
        !          1209:      Abort the current input line or function.
        !          1210: 
        !          1211: aauuttoo-iinnsseerrtt
        !          1212:      Insert text into the  command line.  This is the default for
        !          1213:      almost every key.
        !          1214: 
        !          1215: bbaacckkwwaarrdd-cchhaarr (<ccttrrll-BB>)
        !          1216:      Move the cursor one character to the left.
        !          1217: 
        !          1218: bbaacckkwwaarrdd-wwoorrdd (<eesscc>BB)
        !          1219:      Move the cursor one word to  the left.  A wwoorrdd is defined as
        !          1220:      any  cluster   of  characters  delineated  by   any  of  the
        !          1221:      characters  named  in  the  environmental variable  IIFFSS:  by
        !          1222:      default, <ssppaaccee>, <ttaabb>, and <nneewwlliinnee>.
        !          1223: 
        !          1224: bbeeggiinnnniinngg-ooff-lliinnee (<ccttrrll-AA>)
        !          1225:      Move  the  cursor   to  the  leftmost  position  (i.e.,  the
        !          1226:      beginning) of the line.
        !          1227: 
        !          1228: ccoommpplleettee (<eesscc><eesscc>)
        !          1229:      Complete as much as is  unique of the hashed command name or
        !          1230:      file name  in which the cursor is  positioned.  If no unique
        !          1231:      command or  file name is  found, kksshh beeps.   Note that this
        !          1232:      command does nothing unless you have used the sseett command to
        !          1233:      turn on hashing.
        !          1234: 
        !          1235: ccoommpplleettee-ccoommmmaanndd (<ccttrrll-XX><eesscc>)
        !          1236:      Automatically complete  as much as  is unique of  the hashed
        !          1237:      command name.  Like the ccoommpplleettee command, above, except that
        !          1238:      file names are not expanded.
        !          1239: 
        !          1240: ccoommpplleettee-ffiillee (<ccttrrll-XX><ccttrrll-XX>)
        !          1241:      Automatically  complete as  much as  is  unique of  the file
        !          1242:      name.   Like  the   ccoommpplleettee  command,  above,  except  that
        !          1243:      commands are not expanded.
        !          1244: 
        !          1245: ddeelleettee-cchhaarr-bbaacckkwwaarrdd (<ccttrrll-HH>)
        !          1246:      Delete the character to  the left of the cursor.  Shift text
        !          1247:      to the left to fill the gap left by the deleted character.
        !          1248: 
        !          1249: 
        !          1250: 
        !          1251: 
        !          1252: COHERENT Lexicon                                          Page 19
        !          1253: 
        !          1254: 
        !          1255: 
        !          1256: 
        !          1257: ksh                          Command                          ksh
        !          1258: 
        !          1259: 
        !          1260: 
        !          1261: ddeelleettee-cchhaarr-ffoorrwwaarrdd (<ccttrrll-DD>)
        !          1262:      Delete the  character upon  which the cursor  is positioned.
        !          1263:      Shift text to  the left to fill the gap  left by the deleted
        !          1264:      character.
        !          1265: 
        !          1266: ddeelleettee-wwoorrdd-bbaacckkwwaarrdd (<ccttrrll-WW>)
        !          1267:      Delete the  word to the  left of the cursor.   Shift text to
        !          1268:      the left to fill the gap left by the deleted word.
        !          1269: 
        !          1270: ddeelleettee-wwoorrdd-ffoorrwwaarrdd (<eesscc>DD)
        !          1271:      Delete the  word to the right of the  cursor.  Shift text to
        !          1272:      the left to fill the gap left by the deleted word.
        !          1273: 
        !          1274: ddoowwnn-hhiissttoorryy (<ccttrrll-NN>)
        !          1275:      Scroll to the next command in the history buffer, if any.
        !          1276: 
        !          1277: eenndd-ooff-lliinnee (<ccttrrll-EE>)
        !          1278:      Move the cursor to the rightmost position (i.e., the end) of
        !          1279:      the line.
        !          1280: 
        !          1281: eeoott (<ccttrrll-_>)
        !          1282:      Send  an EOT  (end  of transmission)  signal  to the  shell.
        !          1283:      Normally,  this is  sent  by <ccttrrll-DD>,  but MicroEMACS  mode
        !          1284:      binds this keystroke to an editing command.
        !          1285: 
        !          1286: ffoorrwwaarrdd-cchhaarr (<ccttrrll-FF>)
        !          1287:      Move the cursor one character to the right.
        !          1288: 
        !          1289: ffoorrwwaarrdd-wwoorrdd (<eesscc>FF)
        !          1290:      Move the cursor one word to the right.
        !          1291: 
        !          1292: kkiillll-lliinnee (<ccttrrll-UU>)
        !          1293:      Delete (i.e., erase) this entire input line.
        !          1294: 
        !          1295: kkiillll-ttoo-eeooll (<ccttrrll-KK>)
        !          1296:      Kill the  input line from where the  cursor is positioned to
        !          1297:      the end of the line.
        !          1298: 
        !          1299: lliisstt (<eesscc>?)
        !          1300:      Display  a sorted  listed of  all  hashed commands  and file
        !          1301:      names that have been entered so far, and so lists the tokens
        !          1302:      that can  be expanded with the  ccoommpplleettee commands, described
        !          1303:      above.
        !          1304: 
        !          1305: lliisstt-ccoommmmaanndd (<ccttrrll-XX>?)
        !          1306:      List all hashed commands.
        !          1307: 
        !          1308: lliisstt-ffiillee (none)
        !          1309:      List all files used in hashed commands so far.
        !          1310: 
        !          1311: nneewwlliinnee (<ccttrrll-JJ> or <ccttrrll-MM>)
        !          1312:      Dispatch the  current line to the  shell for execution.  The
        !          1313:      cursor need not  be at the beginning or end  of the line for
        !          1314:      this command to work correctly.
        !          1315: 
        !          1316: 
        !          1317: 
        !          1318: COHERENT Lexicon                                          Page 20
        !          1319: 
        !          1320: 
        !          1321: 
        !          1322: 
        !          1323: ksh                          Command                          ksh
        !          1324: 
        !          1325: 
        !          1326: 
        !          1327: pprreeffiixx-11 (<eesscc>)
        !          1328:      Introduce a two-character command sequence.
        !          1329: 
        !          1330: pprreeffiixx-22 (<ccttrrll-XX>)
        !          1331:      Introduce a two-character command sequence.
        !          1332: 
        !          1333: qquuoottee (<ccttrrll-^>)
        !          1334:      Read the  following character  literally, rather than  as an
        !          1335:      editing command.
        !          1336: 
        !          1337: rreeddrraaww (<ccttrrll-LL>)
        !          1338:      Redisplay the prompt  and the current command line.  This is
        !          1339:      useful if  the line is garbled due to,  say, line noise when
        !          1340:      you are using a modem.
        !          1341: 
        !          1342: sseeaarrcchh-cchhaarraacctteerr (<ccttrrll-]>)
        !          1343:      Search  forward in  the current  command  line for  the next
        !          1344:      character typed.
        !          1345: 
        !          1346: sseeaarrcchh-hhiissttoorryy (<ccttrrll-RR>)
        !          1347:      Enter incremental-search  mode and search  backwards through
        !          1348:      the history buffer.   aabboorrtt aborts search and returns you to
        !          1349:      the  line  from  which  you  began  the search;  <eesscc>  ends
        !          1350:      searching and leaves you in the current line.
        !          1351: 
        !          1352: ssttuuffff (none)
        !          1353:      Take a  character that  is bound  to an editing  command and
        !          1354:      ``stuff'' it back into the terminal input, so it can receive
        !          1355:      special treatment by the terminal handler.
        !          1356: 
        !          1357: ssttuuffff-rreesseett (none)
        !          1358:      ``Stuffs'' a character, then aborts input.
        !          1359: 
        !          1360: ttrraannssppoossee-cchhaarrss (<ccttrrll-TT>)
        !          1361:      Swap the  character the cursor in on,  with the character to
        !          1362:      its left.
        !          1363: 
        !          1364: uupp-hhiissttoorryy (<ccttrrll-PP>)
        !          1365:      Move to the previous line in the history buffer (if any).
        !          1366: 
        !          1367: yyaannkk (<ccttrrll-YY>)
        !          1368:      Insert the  most recently killed text  back into the command
        !          1369:      string, at the point where the cursor is positioned.
        !          1370: 
        !          1371: yyaannkk-ppoopp (<eesscc>YY)
        !          1372:      Yank a  string, then replace  it within the  ``yank'' buffer
        !          1373:      with the next most previously killed string.
        !          1374: 
        !          1375: ***** Example *****
        !          1376: 
        !          1377: The  following C  code  creates a  program  called sspplluurrtt.cc.   It
        !          1378: demonstrates  numbered redirection  of  kksshh, by  writing to  five
        !          1379: streams without opening them.  Compile it with the command:
        !          1380: 
        !          1381: 
        !          1382: 
        !          1383: 
        !          1384: COHERENT Lexicon                                          Page 21
        !          1385: 
        !          1386: 
        !          1387: 
        !          1388: 
        !          1389: ksh                          Command                          ksh
        !          1390: 
        !          1391: 
        !          1392: 
        !          1393: 
        !          1394:         cc -o splurt splurt.c
        !          1395: 
        !          1396: 
        !          1397: To call it from the command line, you could type a command of the
        !          1398: form:
        !          1399: 
        !          1400: 
        !          1401:         splurt  3> splurt3 4> splurt4 5> splurt5 6> splurt6 7> splurt7
        !          1402: 
        !          1403: 
        !          1404: This will redirect the sspplluurrtt's output into files sspplluurrtt33 through
        !          1405: sspplluurrtt77.
        !          1406: 
        !          1407: 
        !          1408: #include <stdio.h>
        !          1409: main()
        !          1410: {
        !          1411:         int i;
        !          1412:         char buf[50];
        !          1413: 
        !          1414: 
        !          1415: 
        !          1416:         for(i = 3; i < 8; i++) {
        !          1417:                 sprintf(buf, "For fd %d\n", i);
        !          1418:                 write(i, buf, strlen(buf));
        !          1419:         }
        !          1420: }
        !          1421: 
        !          1422: 
        !          1423: ***** Files *****
        !          1424: 
        !          1425: /eettcc/pprrooffiillee -- System-wide initial commands
        !          1426: $HHOOMMEE/.pprrooffiillee -- User-specific initial commands
        !          1427: /ddeevv/nnuullll -- For background input
        !          1428: 
        !          1429: ***** See Also *****
        !          1430: 
        !          1431: bbiinndd,  ccoommmmaannddss,  dduupp(), eennvviirroonn,  eexxeecc,  ffoorrkk(), ggeettooppttss,  jjoobbss,
        !          1432: kkiillll, llooggiinn, nneewwggrrpp, sseett, sshh, ssiiggnnaall(), tteesstt, wwaaiitt
        !          1433: _I_n_t_r_o_d_u_c_t_i_o_n _t_o _s_h, _t_h_e _B_o_u_r_n_e _S_h_e_l_l, tutorial
        !          1434: 
        !          1435: ***** Notes *****
        !          1436: 
        !          1437: This version of  kksshh offers a subset of the  features of the Korn
        !          1438: shell  shipped  with UNIX  System  V.2.  It  does  _n_o_t offer  the
        !          1439: following features:
        !          1440: 
        !          1441: -> vvii-style command-line editing.
        !          1442: 
        !          1443: -> Command ffcc -ee.
        !          1444: 
        !          1445: -> Variables RRAANNDDOOMM and PPPPIIDD.
        !          1446: 
        !          1447: 
        !          1448: 
        !          1449: 
        !          1450: COHERENT Lexicon                                          Page 22
        !          1451: 
        !          1452: 
        !          1453: 
        !          1454: 
        !          1455: ksh                          Command                          ksh
        !          1456: 
        !          1457: 
        !          1458: 
        !          1459: -> Variable arrays.
        !          1460: 
        !          1461: -> Variable attributes other than integers.
        !          1462: 
        !          1463: The Mark  Williams version of  kksshh is based  on the public-domain
        !          1464: version of the Korn shell, which  in turn is based on the public-
        !          1465: domain  version of  the seventh edition  Bourne shell  written by
        !          1466: Charles Forsyth  and modified by Eric  Gisin, Ron Natalie, Arnold
        !          1467: Robbins, Doug Gwyn, and Erik Baalbergen.
        !          1468: 
        !          1469: 
        !          1470: 
        !          1471: 
        !          1472: 
        !          1473: 
        !          1474: 
        !          1475: 
        !          1476: 
        !          1477: 
        !          1478: 
        !          1479: 
        !          1480: 
        !          1481: 
        !          1482: 
        !          1483: 
        !          1484: 
        !          1485: 
        !          1486: 
        !          1487: 
        !          1488: 
        !          1489: 
        !          1490: 
        !          1491: 
        !          1492: 
        !          1493: 
        !          1494: 
        !          1495: 
        !          1496: 
        !          1497: 
        !          1498: 
        !          1499: 
        !          1500: 
        !          1501: 
        !          1502: 
        !          1503: 
        !          1504: 
        !          1505: 
        !          1506: 
        !          1507: 
        !          1508: 
        !          1509: 
        !          1510: 
        !          1511: 
        !          1512: 
        !          1513: 
        !          1514: 
        !          1515: 
        !          1516: COHERENT Lexicon                                          Page 23
        !          1517: 
        !          1518: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.