Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sh — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

4.0; sh (shell), revision 4.0, 82/03/22.
SH (SHELL) -- Invoke a Shell (command line interpreter).
usage:  SH [(-V | -N | -X | -C | -S | -F)...] [pathname [arg ...]]


FORMAT

  Sh [options] [pathname [arg ...]]


  SH is the command line interpreter.  It reads lines from standard input
  or from shell programs; interprets them, finding the commands to which
  they refer and the arguments for the commands; and then invokes the
  commands. Note that SH does NOT create a process; it is only a program
  that runs inside a pre-existing process.  To start a process (which may
  then run a Shell or any other program), see HELP CP.


ARGUMENTS

  pathname
  (optional)       Specify file containing a Shell script to be
                   executed. Each line in the file will be
                   interpreted as a Shell command.
                   Default if omitted:  read standard input

  args
  (optional)       Specify any arguments to be passed to the program
                   in file 'pathname'.  Arguments are substituted for
                   ^n expressions in the program: arg1 for ^1, arg2
                   for ^2, etc.  (See the "DOMAIN System Command
                   Reference Manual" for details on passing arguments
                   to Shell commands.)  See example 1 below.
                   Default if omitted: no arguments passed


OPTIONS

  -C arg1 ...      Execute the following argument(s) as a Shell command,
                   exactly as if it had been read as an input line.
                   If any argument contains explicit blanks, enclose it
                   in quotes.

  -F               Do not exit after executing the command given by the
                   -C option.  This option is valid only if -C has been
                   specified.

  -I               Behave as though input is being entered interactively:
                   prompt for each input line, and do not exit on errors
                   or quit faults (DQ or CTRL/Q from keyboard).  Normally,
                   SH examines the program being run to see whether or not
                   interactive prompting is appropriate.  Use of this
                   option forces prompting.

  -N               Interpret each command line only; suppress execution.

  -S               Behave as though executing a Shell script: do not prompt
                   and abort on error.  A Shell normally will not quit; any
                   error or quit command is assumed to apply only to the
                   last command given to the Shell.

  -V               Display each line of text in the transcript pad as it
                   is read by the Shell program.

  -X               Display each command in the transcript pad immediately
                   before execution.  Each command is given in full, with
                   its complete pathname and with the values of arguments
                   inserted.


EXAMPLES

  1. $ sh program-name arg1 arg2 ...       The Shell executes the commands
                                            in the file 'program-name'. The
                                            arguments 'argn' are substituted
                                            for character sequences ^n in the
                                            program file.

  2. $ sh my_script -n                     Interpret each line in 'my_script',
                                            but do not execute anything.


SUMMARY OF SHELL SYNTAX

  cmds ->
     [ pipe ] { ';' [ pipe ] | '&' [ pipe ] }

  pipe ->
     scmd { '|' scmd }

  scmd ->
        '(' cmds ')' { redir }
     |  'if' scmd 'then' cmds 'else' cmds 'endif'
     |  'while' scmd 'do' cmds 'enddo'
     |  cmd { redir | arg | '(' { arg } ')' }

  redir ->
        <file | >file | <?file | >?file | <<! | <<?!

  cmd ->
      command | shell_program

  Note:  everything after an unquoted, unescaped '#' on a line is treated as
         a comment.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026