Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sh — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

SHELL

SHELL COMMANDS

SHELL I_O

9.0;sh (shell), revision 9.0, 86/09/25
SH (SHELL) -- Invoke a Shell (command line interpreter).
usage:  SH [pathname [arg ...]] (or) SH [
                                        [-B[ON] | -BOFF | -NB[ON]]
                                        [-E[ON] | -EOFF | -NE[ON]]
                                        [-V[ON] | -VOFF | -NV[ON]]
                                        [-X[ON] | -XOFF | -NX[ON]]
                                        [ [ -F[IRST] ] -C[OMMAND] arg1... ]
                                        [-I[NTER] | -S[CRIPT] | -NI[NTER]]
                                        [-N[EXECUTE] | -EX[ECUTE]]
                                        [-P[ROMPT]1 prompt_string]
                                        [-P[ROMPT]2 prompt_string]
                                        [-START [file] | -NSTART]
                                        [pathname [arg ...]]  ]


FORMAT

  SH [options] [pathname [arg ...]]


  SH  is  the  command  line interpreter.  It reads lines from standard input or
  from shell scripts; interprets them, finding the commands to which they  refer
  and  the  arguments  for  the  commands; and then invokes the commands.  These
  commands provide all the  traditional  features  of  most  computing  systems:
  copying  and  deleting  files, compiling and binding user programs, displaying
  system status, etc.   Generally  speaking,  they  do  NOT  create  or  control
  processes,  windows,  or  other  components  of  the  display  screen.  (Those
  functions are provided by the Display Manager.)  For general information about
  the  Shell,     type HELP SHELL.  The DOMAIN System User's Guide also includes
  information on the Shell, particularly the method  that  it  uses  to  process
  input and the programming features available in scripts.

  Normally,  at  least  one process is running the Shell all the time.  When you
  give the command SH, you generate a separate, subordinate Shell running within
  the  current  process.    This Shell can carry on separate operations, and can
  execute special programs and scripts containing command lines.  One  of  these
  scripts  may  be  a  startup  script;  see  the  -START  option below for more
  information.

  Note: The SH command does not create a new process, only a  subordinate  Shell
  running in the current process. To start a process (which may then run a Shell
  or any other program), use the DM command CP (CREATE_PROCESS).


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.  ^* can be
                     used to specify all of the  arguments  at  once.  (See  the
                     DOMAIN System User's Guide for details on passing arguments
                     to Shell commands.)  See example 1 below.

                     Default if omitted:  no arguments passed.


OPTIONS

  Default options are indicated by "(D)."

  -B[ON]             Send the output of a background process (created with the &
                     parsing  operator)  to  the  display.    The  output of the
                     background process is displayed in the  transcript  pad  of
                     the  Shell where it was invoked.  If you do not specify -B,
                     the output of the background process is sent to /DEV/NULL.

  -BOFF        (D)   Do not display output from a background process.

  -NB[ON]      (D)   Same as -BOFF.

  -C[OMMAND] 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.
                     The Shell  passes  all  text  following  -C  to  'arg1'  as
                     arguments,  so  if you want to specify other options to the
                     SH command itself, they must precede -C.

                     If 'arg1' is the name of a  Shell  script,  note  that  the
                     script  creates a new Shell level for execution (just as if
                     you had invoked it at the $ prompt).   Thus  activities  in
                     the  script  that  are  level-dependent  (such as assigning
                     values to Shell variables) do NOT propogate upward when the
                     script  exits. This is in contrast to the -START option and
                     the Shell command SOURCE,  which  execute  scripts  at  the
                     current Shell level.

  -E[ON]              Enable evaluation of variables outside of expressions.  If
                     -E is specified,  the  Shell  always  evaluates  variables,
                     regardless  of  the context in which they appear.  If -E is
                     not specified, variables are evaluated only inside variable
                     expression delimeters, ((expression)); otherwise, the Shell
                     treats the ^var_name expressions as strings  and  they  are
                     not evaluated.

  -EOFF        (D)   Evaluate variables only inside expressions.

  -NE[ON]      (D)   Same as -EOFF.

  -F[IRST]            Do  not  exit  after executing the command given by the -C
                     option.    This  option  is  valid  only  if  -C  has  been
                     specified, and must precede -C on the command line.

  -I[NTER]            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, the
                     Shell only executes interactively if its input comes from a
                     pad or SIO line.  Use of this option forces prompting.

  -S[CRIPT]    (D)    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.

  -NI[NTER]    (D)   Same as -S.

  -N[EXECUTE]        Interpret each command line only; suppress execution.

  -EX[ECUTE]   (D)   Interpret each command line and execute it.

  -P[ROMPT]1 prompt_string
                     Define the prompt string for the Shell created with SH.

  -P[ROMPT]2 subprompt_string
                     Define the subpromt string for the Shell created  with  SH.
                     (The  subprompt  appears  when you continue a Shell command
                     over more than one line).

  -START [file]
                     Execute  the  specified  script after the Shell is created.
                     If 'file' is not specified, the Shell  searches  the  login
                     home  directory  for a file called USER_DATA/SH/STARTUP and
                     executes it if it exists.  No error  occurs  if  that  file
                     does not exist.

                     Note  that  the  script  is  executed  at the current Shell
                     level,  so  that  level-dependent   activities   (such   as
                     assigning  values  to  Shell  variables)  persist  when the
                     script exits. This is in contrast to the -C  option,  which
                     executes scripts at the next lower Shell level.

                     This option is a default if SH is the first program invoked
                     in a new process (i.e., CP /COM/SH).  It is not  a  default
                     at  any  other  time  (i.e., when you type SH at the dollar
                     sign or call it from a script).

  -NSTART            Disable startup file execution.

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

  -VOFF        (D)   Disable input verification.

  -NV[ON]      (D)   Same as -VOFF.

  -X[ON]              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.

  -XOFF        (D)   Disable input examination.

  -NX[ON]      (D)   Same as -XOFF.


EXAMPLES

  1. $ sh program-name arg1 arg2 ...     The Shell executes the commands
                                          in the file 'program-name', and
                                          substitutes the arguments ('argn')
                                          for character sequences ^n in the
                                          program file.

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

SUMMARY OF INTERNAL SHELL COMMANDS

  The Shell has four types of commands:

  External Commands
                  These are programs that reside on your disk.  They are invoked
                  when you type in their pathname or, if their  directories  are
                  included  in  your  command  search rules, when you type their
                  leafname.

  Internal Commands
                  These  are  built-in  Shell  commands  (see below).  The Shell
                  always looks for these first.

  Control Structures
                  These are programming constructs that allow you to control the
                  flow of control in  a  Shell  script.    Note:    Since  these
                  structures  are  legal  anywhere on the command line, you must
                  enclose them in quotes when using the HELP command (i.e., HELP
                  'IF').

  Expressions     These  are delimited by '((' and '))'.  Inside of these double
                  parentheses you can set variables, compare values and  perform
                  other  standard  integer,  string  or boolean operations.  The
                  assignment operation (VARIABLE := VALUE)  is  a  special  case
                  that does not have to be enclosed in double parentheses.

  Any  of  these  commands can have their output redirected or may be invoked in
  the background using the Shells parsing operators (>, >>, >?, >>? <,  <<,  <?,
  <<?, |, &...)  See the DOMAIN System User's Guide for details.

  Internal Commands

  Flags           VON, VOFF, XON, XOFF, BON, BOFF, EON, EOFF

  Variables       READC, READ, READLN, EXISTVAR, LVAR, DLVAR, SETVAR, EXPORT

  Control Structures
                  IF, WHILE, SELECT, FOR
                  EQS, EXISTF, RETURN, EXIT, NEXT, SOURCE, SET, ABTSEV, NOT

  Miscellaneous   ARGS, CSR, RDYM, HLPVER, INLIB, UMASK

  Expressions     TRUE, FALSE
                  :=, OR, AND, =, <, >, <=, >=, <>, +, =, *, /, MOD, **,  (,  ),
                  NOT


RELATED TOPICS

  More information is available.  Type:

  - HELP SHELL
   for general information about the Shell.

  - HELP SHELL COMMANDS
   for an index of Shell commands.

  - HELP SHELL I_O
   for a description of the Shell input/output redirection operators.

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