home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk458.lzh / Csh / shell.doc < prev    next >
Text File  |  1991-02-15  |  47KB  |  1,540 lines

  1.  
  2.         INSTRUCTIONS FOR SHELL VERSION: 4.02A 18-Nov-90
  3.         ===============================================
  4.  
  5.   Contents
  6.   --------
  7.  
  8.     O.    Changes over old versions
  9.     I.    Description
  10.     II.    Overview of Major features
  11.     III.    Restrictions
  12.     IV.    PIPES
  13.     V.    Command Pre-processor
  14.     VI.    Command Line Editing
  15.     VII.    Function Keys
  16.     VIII.    Shell Commands
  17.     IX.    Special Set Variables
  18.     X.    Advanced Topics
  19.     XI.    Example source files
  20.     XII.    Default values
  21.     XIII.    Why ARP ?
  22.  
  23.  
  24.  
  25. O.  Changes over old versions
  26. -----------------------------
  27.  
  28. New to 4.02A:
  29. - Fixed bug that caused loss of memory on exit.
  30. - cp now copies protection bits; use -f switch if you want to avoid this.
  31. - Added  commands: man (and alias manlist), uniq, head, tail, tee.
  32. - This doc has been reformatted to work with man.
  33.  
  34. New to 4.01A:
  35.  
  36. - This version features mostly bug fixes and corrections:
  37.  * Window title is restored after quitting.
  38.  * rxrec now answers to the 'bye' message.
  39.  * rpn can now be redirected and piped; however, this causes
  40.     some problem (see rpn for info).
  41.  * resident list now works with ARP 1.3. To recompile source, you must
  42.     modify include file "libraries/arpbase.h".
  43.     Change definition of rpn_Usage in struct ResidentProgramNode from LONG
  44.     to WORD.
  45.  * pri no more assumes 20 CLI maximum.
  46.  * you can now split long lines in source files even into more than 2 lines.
  47. - Added much info in this doc about source files (chapter XI)
  48. - Added copyright notice (see under restrictions).
  49.  
  50. New to 4.00A:
  51.  
  52. - This version is called 4.00A because it is not 100% compatible with
  53.   previous versions. We choose to accept this in order to better support
  54.   the new ARP.library 1.3.
  55. - External commands are searched in a different order than before; Shell
  56.   path is now searched AFTER current directory, AmigaDOS path and C:.
  57. - ARP pattern matching has been implemented (in part for line arg expanding,
  58.   fully for search -w).
  59. - Internal changes for various optimizations.
  60. - Search command has been improved in several ways.
  61. - New commands: basename, tackon.
  62. - New options: if -v, resident -d, fornum -v -s, dir -n.
  63. - Fixed bugs with dir (some dirs remained locked), foreach -v, htype
  64.   (blanks were treated as binary), info (for devices > 32M).
  65. - rback command now works ok (run, however, doesn't).
  66. - Oh, I forgot: it also has an AREXX port... And you don't even have to get
  67.   AREXX to use it. See new commands rxsend, rxrec
  68.  
  69. New to 3.03A:
  70.  
  71. - New filter commands fltlower, fltupper.
  72. - Added configuration file feature: now if you have a file named S:.login,
  73.   it will be sourced for every Shell you start.
  74. - New option dir -c.
  75. - New editing feature: shift-left(right) arrow move cursor to previous(next)
  76.   word.
  77. - Bugs fixed: alias command wasn't listed in help; typing a number as a
  78.   command was interpreted like 'alias'.
  79.  
  80. New to 3.02A:
  81.  
  82. - New commands: fornum, forline, strleft, strright, strmid, strlen, exec.
  83. - Improved commands: foreach, pri.
  84. - New system variable _clinumber.
  85. - You can now split long lines in source files (see source for details).
  86. - window -q now lists also position of screens/windows, not only dimension.
  87. - Since strings are handled directly from Shell with new commands,
  88.   rpn is now used only for calculations; string commands are gone.
  89.   However, now RPN is really usable.
  90. - Changed rawgets() to fix some problems with function keys, multi-line
  91.   editing and window resizing; also, fixed bug with ^E.
  92. - cat now warns you if it can't find any file matching your pattern.
  93. - Now uses DOS packets to get ptr to CLI window; this fixes a bug that
  94.   caused problems if Shell was run on unactive windows.
  95. - Fixed minor bugs (htype printed some more ASCII bytes, some commands
  96.   returned random values, history didn't print CR's).
  97. - Heavy mods to this file.
  98.  
  99.  
  100. I.  DESCRIPTION
  101. ---------------
  102.  
  103. This version of Shell is the follow of:
  104.     Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
  105.     Shell V2.04M-V2.07M by Steve Drew
  106.     Shell V2.08MI, V3.xxA and V4.xxA by Carlo Borreo & Cesare Dieni
  107.  
  108. Send suggestions/criticism/anything else to Carlo Borreo or Cesare Dieni at:
  109.  
  110.     BITNET:  PERUGIA@ICNUCEVM.BITNET
  111.     FIDONET: 2:332/602.0@FIDONET        # recently changed
  112.  
  113. or
  114.     Carlo Borreo        Cesare Dieni
  115.     Via G. Berio 34        Via G. Taddei 3
  116.     I-18100 Imperia        I-56100 Pisa
  117.     Italy            Italy
  118.  
  119. You may distribute this program unmodified and for non-profit only.
  120.  
  121. *** YOU MAY NOT MODIFY THIS PROGRAM AND REDISTRIBUTE IT ***
  122.  
  123. If everyone writes his own version of Shell and distributes it, we would be
  124. covered by Shell versions.
  125.  
  126. If you make a modification to Shell that you would like to share with other
  127. users, please send us a DIFF output, or a description of what you need.
  128.  
  129. ATTRIBUTIONS
  130. ------------
  131.  
  132. Arexx is a program by William Hawes.
  133. Cygnus Ed Professional (C) 1988 CygnusSoft Software.
  134.  
  135. II. OVERVIEW
  136. ------------
  137.  
  138. Shell provides a convient AmigaDos alternative command interface.
  139. All its commands are internal and thus does not rely on the c:
  140. commands for any functionality.
  141.  
  142. Major features include:
  143.  
  144.     -command line editing
  145.     -shell & Amigados search path support
  146.     -simple history
  147.     -redirection of any command
  148.     -piping
  149.     -aliases
  150.     -variables & variable handling (embedded variables)
  151.     -file name expansion via conventional wild carding ('?', '*' and more)
  152.     -conditionals (if/else ect..)
  153.     -source files  (w/ gotos and labels)
  154.     -many built in commands to speed things up
  155.  
  156.  
  157. III. RESTRICTIONS
  158. -----------------
  159.  
  160.    AmigaDos execute command will not work.  Alternative is to use shell own
  161. script language (which is more powerful) or to do a 'run execute'.
  162.    VDK  handler  has  a  bug with setting file dates so when using the copy
  163. command  and  VDK  you should use the -d switch otherwise your file date in
  164. vdk:  will be bad.  (This is not a bug with shell)
  165.    If  using  with  conman it may be best to start shell with the -a switch
  166. (shell  -a .login) to turn off shell's command line editing and use conmans
  167. instead.
  168.    You  can't  use  chars  with  code  >  127  (i.e., all national symbols,
  169. stressed  letters,  and  so  on).   8th bit is used internally for a lot of
  170. things in Shell.
  171.  
  172.  
  173. IV. NOTES ON PIPES
  174. ------------------
  175.  
  176.     PIPES
  177.     PIPES have been implemented using temporary RAM:  files.  Thus, you
  178.     should  be  careful when specifying a 'ram:*' expansion as it might
  179.     include the temp.  files.  These files are deleted on completion of
  180.     the pipe segment.
  181.  
  182.     The file names used are completely unique, even with multiple shell
  183.     running simultaneously.
  184.  
  185.     My  favorite  new  feature is the fact that you can now redirect to
  186.     and  from,  and pipe internal commands.  'echo charlie >ram:x', for
  187.     instance.  Another favorite:
  188.  
  189.     echo "echo mem | shell" | shell
  190.  
  191.     To accomplish these new features, I completely re-wrote the command
  192.     parser in execom.c
  193.  
  194.     NO BCPL program should be output-append redirected (>>).
  195.  
  196.  
  197. V.  COMMAND PRE-PROCESSOR
  198. -------------------------
  199.  
  200.     PREPROCESSING
  201.     Preprocessing is done on the command line before it is passed on to
  202.     an internal or external routine:
  203.  
  204.     ^c    where c is a character is converted to that control character.
  205.         Thus, say '^l' for control-l.
  206.  
  207.     $name    where name is a variable name.  Variable names can consist of
  208.         0-9, a-z, A-Z, and underscore (_).  The contents of the
  209.         specified variable is used.  If the variable doesn't exist,
  210.         the specifier is used.  That is, if the variable 'i' contains
  211.         'charlie', then '$i' -> 'charlie'.  If the variable 'i' doesn't
  212.         exist, then '$i'->'$i' .
  213.  
  214.     ;    delimits commands.   echo charlie ; echo ben.
  215.  
  216.     ' '    (a space). Spaces delimit arguments.
  217.  
  218.     "string" a quoted string.  For instance, if you want to echo five spaces
  219.         and an 'a':
  220.  
  221.         echo      a       -> a
  222.         echo "    a"      ->      a
  223.  
  224.     \c    overide the meaning of special characters.  '\^a' is a
  225.         circumflex and an a rather than control-a.  To get a backslash,
  226.         you must say '\\'.
  227.  
  228.         also used to overide alias searching for commands.
  229.  
  230.     >file    specify output redirection.  All output from the command is
  231.         placed in the specified file.
  232.  
  233.     >>file    specify append redirection (Does not work with BCPL programs).
  234.  
  235.     <file    specify input redirection. The command takes input from the
  236.         file rather than the keyboard (note: not all commands require
  237.         input; it makes no sense to say 'echo <charlie' since
  238.         the 'echo' command only outputs its arguments).
  239.  
  240.     |    PIPE specifier.  The output from the command on the left becomes
  241.         the input to the command on the right.  The current SHELL
  242.         implimentation uses temporary files to store the data.
  243.  
  244.     !!    execute the previously executed command.
  245.     !nn    (nn is a number).  Insert the history command numbered n (see
  246.         the HISTORY command)
  247.     !partial search backwards through the history list for a command which
  248.         looks the same as 'partial', and execute it.
  249.  
  250.     #    Enter comment.  The rest of the line is discarded (note: \#
  251.         will, of course, overide the comment character's special
  252.         meaning)
  253.  
  254.  
  255. VI. COMMAND LINE EDITING
  256. ------------------------
  257.  
  258.     EDITING
  259.     o Command line can be up to 255 chars.
  260.     o Inserts  and  deletes  are handled correctly over multiple screen
  261.     lines.
  262.     o Shell  will  keep  track  of the line width should the window get
  263.     resized.
  264.  
  265.     KEY DEFINITIONS:
  266.         Up Arrow    Recall previous commands
  267.         Down Arrow  Recall commands
  268.         Left Arrow  Move cursor about command line.
  269.         Right Arrow  "     "      "      "      "
  270.         Shift-Up Arrow    Get start of history
  271.         Shift-Down Arrow   "  end   "     "
  272.         Shift-Left Arrow  Moves cursor a word left
  273.         Shift-Right Arrow   "     "    "  "   right
  274.         ^A        Toggle insert/overtype mode.
  275.         ^D        EOF (exits Shell)
  276.         ^E        Put cursor at end of text.
  277.         ^K        Delete to end of line.
  278.         ^R        Retype current line.
  279.         ^U        Erase entire line.
  280.         ^X        Erase entire line.
  281.         ^Z        Put cursor at start of text.
  282.         f1 - f10    Execute command if variable exists.
  283.         F1 - F10    More commands (Shifted f keys).
  284.         Help        Invokes help command
  285.  
  286.  
  287. VII. FUNCTION KEYS
  288. ---- -------------
  289.  
  290.     FUNKEY
  291.     Function keys now insert text to the current position on the command
  292.     line. They maybe terminated with a ^M (return). f1 would be non shifted
  293.     where as F1 is shifted.
  294.     Most of functions key have a default definition, but it may be changed.
  295.  
  296.         $ set f1 dir df0:^M
  297.  
  298.     will add the text 'dir df0:<return>' to the current line.
  299.  
  300.         $ set f1 dir
  301.  
  302.     would only add 'dir' you could then enter ' df0:<return>'
  303.  
  304.  
  305. VIII. SHELL COMMANDS
  306. --------------------
  307.  
  308.     First to start shell from a CLI
  309.  
  310.         shell [-a] [-c command;command]
  311.  
  312.     where:
  313.         -a  disables  all  command  line editing features.  This is
  314.         useful  for  when running shell over AUX:, and necessary if
  315.         you are running CONMAN.
  316.  
  317.         -c  allows execution of one command line and then exits out
  318.         of  shell.   This  is  useful for running an internal shell
  319.         commands in the background or from an external application.
  320.  
  321.         eg:
  322.  
  323.         Run shell -c dir df0:; copy -r df0: df1: >nil:; echo Done
  324.  
  325.     If you 'Run' shell in the background without the -c switch shell
  326.     will detect this and imediately exit.
  327.  
  328.     Command execution:
  329.  
  330.     Internal shell commands maybe abreviated.
  331.  
  332.     The  first  argument is the command-name...  here is (in order) how
  333.     Shell tries to execute it:
  334.  
  335.     1) Alias list is searched for an alias exactly matching name.
  336.     2) Internal commands list is scanned for a command even partially
  337.        matching name (so you can, for instance, say resi for resident;
  338.        however, you should specify enough of a command to be unique).
  339.     3) ARP resident list is scanned (you can use Shell's resident
  340.        command to add/remove a file in this list).
  341.     4) At this point, command is supposed to be external (disk), and
  342.        is searched before in current directory, then in AmigaDOS
  343.        path, in C:, and finally in Shell path.
  344.     5) As a last chance, AUTOMATIC SOURCING is tried, first in
  345.        current directory, then in Shell path.
  346.  
  347.     AUTOMATIC SOURCING may be accomplished by naming shell scripts with
  348.     a  .sh  suffix.   Thus,  if you say 'stuff' and the file 'stuff.sh'
  349.     exists in your current or anywhere in Shell search path, it will be
  350.     SOURCED  with  any  arguments  you  have  placed  in  the  $_passed
  351.     variable. This is equivalent to typing 'source stuff.sh'
  352.  
  353.     WILDCARDS EXPANSION
  354.     Most shell commands will accept multiple arguments that can
  355.     be as a result of wild card expansion.  Also when calling
  356.     an external command shell will first expand any wild cards
  357.     to seperate arguments.  If you wish to have the external command
  358.     handle it's own wild carding you will need to insert quotes
  359.     around the special wild card characters.
  360.  
  361.     eg.
  362.         arc a new.arc *.txt    - shell will expand and pass to arc
  363.         arc a new.arc "*.txt"    - let arc expand the wild cards.
  364.  
  365.     Wildcards allowed:
  366.  
  367.     ?    match any single character
  368.     *    match any string
  369.     .../*    recursive search down ALL sub directories from current level
  370.     ~    exclude pattern matching specifier
  371.     !    synonim for ~, supported for compatibility
  372.     &    prefixed to patterns, ask confirmation for each file
  373.     []    character class
  374.  
  375.     Examples:
  376.  
  377.     df0:.../*        all files in all directories on df0:
  378.     df0:.../!*.info     full directory tree of df0: but exclude
  379.                 any ugly .info files.
  380.     !*.o !*.c        will result in ALL files matching since what
  381.                 doesn't match the !*.o will match the !*.c
  382.     df1:&*            all files in root of df1:, but ask 
  383.                 confirmation for each
  384.     *.[co]            all files ending in .c or .o
  385.     ~*.[co]            all files NOT ending in .c nor in .o
  386.  
  387.  
  388.     The   following   symbols  are  not  yet  supported  by  wild  card
  389.     expansions, but are accepted in search -w.
  390.  
  391.     ( | )    OR matching
  392.     #    0 or more times the pattern following
  393.  
  394.     Examples:
  395.  
  396.     k#a        matches ka, kaa, kaaa, etc.
  397.     hel(lo|p)    matches hello or help.
  398.  
  399.  
  400. LIST OF COMMANDS:
  401. -----------------
  402.  
  403.     ABORTLINE
  404.     Usage    : abortline
  405.     Example    : echo a;abort;echo b
  406.     Results    : a
  407.  
  408.     Causes the rest of the line to be aborted. Intended for use in
  409.     conjunction with exception handling.
  410.  
  411.     ADDBUFFERS
  412.     Usage    : addbuffers drive buffers
  413.     Example    : addbuffers df0: 24
  414.  
  415.     Just like AmigaDOS addbuffer command, causes new buffers to be
  416.     allocated for disk I/O. Each buffer costs 512 bytes of CHIP memory.
  417.  
  418.     ALIAS
  419.     Usage    : alias [name [command string] ]
  420.     Example    : alias vt "echo Starting VT100;run sys:tools/vt100"
  421.  
  422.     Sets a name to be a string. You can alias a single name to a set
  423.     of commands if you enclose them in quotes as above. By simply
  424.     typing vt, the command line above would be executed.
  425.  
  426.     Argument Passing to an Alias:
  427.  
  428.     Usage    : alias name "%var [command string]"
  429.     Example    : alias xx "%q echo hi $q, how are ya."
  430.           xx Steve
  431.     Results    : hi Steve, how are ya.
  432.  
  433.     The second form of the alias command allows passing of arguments
  434.     to any position within the command string via use of a variable
  435.     name. To pass arguments to the end of a command string this method
  436.     is actually not necessary.
  437.  
  438.     Typing "alias name" you will get the alias for that name, while with
  439.     "alias" you get a list of all alias.
  440.  
  441.     ASET
  442.     Usage    : aset name value
  443.     Example    : aset INCLUDE include:
  444.  
  445.     Set a variable in a way that is compatible with Aztec SET command;
  446.     this is completely different from Shell variable.
  447.     May even be used to set ARP variables.
  448.  
  449.     ASSIGN
  450.     Usage    : assign [logical [physical] ]
  451.     Example    : assign C: df1:c
  452.  
  453.     Use it like AmigaDOS assign command to set, remove or list
  454.     assignments of logical names to directories.
  455.  
  456.     BASENAME
  457.     Usage    : basename var path
  458.     Example    : basename x df0:c/Dir    # sets x to "Dir"
  459.  
  460.     Sets var specified to basename of path.
  461.  
  462.     CAT
  463.     Usage    : cat [-n][file file....]
  464.     Example    : cat foo.txt
  465.  
  466.     Type the specified files onto the screen.  If no file is specified,
  467.     STDIN in used.  CAT is meant to output text files only.
  468.     Specifying -n option you will get numbered lines.
  469.  
  470.     CD
  471.     Usage    : cd [path]
  472.     Example    : cd df0:devs/printers
  473.  
  474.     Change your current working directory.  You may specify '..' to go
  475.     back one directory (this is a CD specific feature, and does not
  476.     work with normal path specifications).
  477.  
  478.     CD without any arguments displays the path of the directory you
  479.     are currently in.
  480.  
  481.     CLOSE
  482.     Usage    : close filenumber
  483.  
  484.     Close the specified file opened by open.
  485.     See open and flist for more info.
  486.  
  487.     COPY (CP)
  488.     Usage    : copy [-u][-d][-f] file file
  489.     or    : copy [-u][-d][-f] file1 file2...fileN dir
  490.     or    : copy [-r][-u][-d][-f] dir1 dir2...dirN dir
  491.     options    :
  492.         -r    recursive, copy all subdirectories as well.
  493.         -u    update, if newer version exist on dest, don't copy
  494.         -d    don't set destination file date to that of source.
  495.         -f    don't set destination file bits to those of source.
  496.  
  497.     Example    : copy -r df0: df1:
  498.  
  499.     Copy files or directories. When copying directories, the -r option
  500.     must be specified to copy subdirectories as well.  Otherwise, only
  501.     top level files in the source directory are copied.
  502.  
  503.     All files will be displayed as they are copied and directory's
  504.     displayed as they are created. This output can be suppessed by
  505.     redirecting to nil: eg. copy -r >nil: df0: df1:
  506.  
  507.     Copy will abort after current file on Control-C.
  508.  
  509.     Copy by default sets the date of the destination file to that of
  510.     the source file. To overide this feature use the -d switch.
  511.  
  512.     Similarly, it sets protection bits (flags) to those of source.
  513.     To avoid this use -f.
  514.  
  515.     Another useful option is the -u (update) mode were copy will not
  516.     copy any files which exists already in the destination directory
  517.     if the destination file is newer or equal to the source file.
  518.     This is useful when developing code say in ram: eg. 'copy *.c ram:'
  519.     when done you can copy -u ram: df1: and only those modules you have
  520.     modified will be copied back.
  521.  
  522.     Copy command will now create the destination directory if it does
  523.     not exist when specified as 'copy [-r] dir dir'. If you specify
  524.     copy file file file dir, then 'dir' must already exist.
  525.  
  526.     CP
  527.     Equivalent to copy.
  528.  
  529.     DATE
  530.     Usage    : date [new date and/or time]
  531.     Example    : date Wednesday  # this refers to NEXT wed, of course
  532.  
  533.     Used to read or set system date and/or time. All standard options
  534.     may be used (yesterday, tomorrow, monday, etc.).
  535.     Leading zero's are not necessary.
  536.     Without parameters shows Dddddd DD-MMM-YY HH:MM:SS.
  537.  
  538.     DEC
  539.     Usage    : dec varname [value]
  540.     Example    : dec abc
  541.  
  542.     Decrement the numerical equivalent of the variable with specified
  543.     value (default: 1) and place the ASCII-string result back into
  544.     that variable.
  545.  
  546.     DELETE (RM)
  547.     Usage    : delete [-p][-r] file file file...
  548.     Example    : delete foo.txt test.c
  549.  
  550.     Remove (delete) the specified files.  Remove always returns
  551.     errorcode 0.  You can remove empty directories.  The '-r' option
  552.     will remove non-empty directories by recursively removing all sub
  553.     directories.
  554.     You can remove delete-protected files specifying -p option.
  555.     If you specify any wildcard deletes the files will be listed as
  556.     they are deleted. This can be suppressed by redirecting to nil:
  557.  
  558.     DIR (LS)
  559.     Usage    : dir [-sdfcn] [path path ... ]
  560.     Example    : dir df0:
  561.     options    :
  562.         -s  short multi(4) column display.
  563.         -d  list directories only
  564.         -f  list files only
  565.         -c  don't change colors for directories (useful to printer)
  566.         -n  display names only
  567.  
  568.     Displays a directory of specified files. Default output shows
  569.     date, protection, block size, byte size and total space used.
  570.     Protections flags include new 1.2/1.3 flags (see under protect).
  571.     Files are alphabetically sorted, without case sensitivity, and
  572.     directories are in red pen (unless you use -c).
  573.  
  574.     DISKCHANGE
  575.     Usage    : diskchange drive
  576.  
  577.     Like AmigaDOS diskchange.
  578.  
  579.     ECHO
  580.     Usage    : echo [-n] string
  581.     Example    : echo hi there
  582.     Results    : hi there
  583.  
  584.     Echo the string given. If -n switch given no newline is
  585.     appended.
  586.  
  587.     ELSE
  588.     Usage    : else ; command
  589.     Usage    : if -f foo.c ; else ; echo "Not there" ; endif
  590.  
  591.     Else clause, must follow an IF statement.
  592.  
  593.     ENDIF
  594.     Usage    : endif
  595.  
  596.     The end of an if statement.
  597.  
  598.     Note: if you return from a script file with unterminated IF's
  599.     and the last IF was false, prompt will be changed to an
  600.     underscore ('_') and no commands will be executed until
  601.     'endif' is typed.
  602.  
  603.     EXEC
  604.     Usage    : exec command
  605.     Example    : set util SYS:sytem/utilities
  606.           exec $util/make    # would not work without exec
  607.  
  608.     Execute the command specified; exec command is equivalent to
  609.     command, only you can use variables to specify command name.
  610.  
  611.     FAULT
  612.     Usage    : fault error1 .. errorN
  613.     Example    : fault 205 212
  614.  
  615.     Like AmigaDOS fault, prints specified error messages.
  616.  
  617.     FILENOTE
  618.     Usage: filenote file1 .. filen  note
  619.  
  620.     Set AMIGADOS comment of the specified file. This is not very useful,
  621.     since in current implementation of Shell file comments are not listed
  622.     in directory, but it was so easy to implement...
  623.  
  624.     FLIST
  625.     Usage    : flist
  626.  
  627.     Lists the filenumbers of files opened by open.
  628.     See open and close for more info.
  629.  
  630.     FLTLOWER
  631.     Usage    : fltlower
  632.     Example    : dir | fltlower
  633.     Or    : fltlower <readme
  634.  
  635.     This is a filter command, i.e. it reads from stdin and writes to
  636.     stdout. The more natural way to use it is a pipe, or it can be
  637.     redirected.
  638.     Its purpose is to convert all alphabetic to lower case.
  639.  
  640.     FLTUPPER
  641.     The same of fltlower, only this converts to upper case.
  642.  
  643.     FOREACH
  644.     Usage    : foreach [-v] varname ( strings ) command
  645.     Example    : foreach i ( a b c d ) "echo -n $i;echo \" ha\""
  646.     Result    : a ha
  647.           b ha
  648.           c ha
  649.           d ha
  650.  
  651.     'strings' is broken up into arguments.  Each argument is placed in
  652.     the variable 'varname' in turn and 'command' executed.  To execute
  653.     multiple commands, place them in quotes.
  654.  
  655.     Foreach is especially useful when interpreting passed arguments in
  656.     an alias.
  657.  
  658.     eg.
  659.         foreach i ( *.pic ) viewilbm $i
  660.     assuming a.pic and b.pic in current directory the following commands
  661.     will occur:
  662.         viewilbm a.pic
  663.         viewilbm b.pic
  664.  
  665.     Flag -v causes arguments to be displayed every time command is
  666.     executed.
  667.  
  668.     FOREVER
  669.     Usage    : forever command
  670.     or    : forever "command;command;command..."
  671.  
  672.     The specified commands are executed over and over again forever.
  673.  
  674.     -Execution stops if you hit ^C
  675.     -If the commands return with an error code.
  676.  
  677.     FORLINE
  678.     Usage    : forline var filename command
  679.     or    : forline var filename "command;command..."
  680.     Example    : forline i RAM:temp "echo line $_linenum=$i"
  681.  
  682.     For each ASCII line of file specified commands are executed and
  683.     var points to line content. You can check system variable _linenum
  684.     to find the number of the line currently read.
  685.  
  686.     FORNUM
  687.     Usage    : fornum [-v] var n1 n2 command
  688.     or    : fornum [-v] -s var n1 n2 step command
  689.     Example    : fornum -v x 1 10 echo $1
  690.     or    : fornum -s x 10 1 -1 echo $i # counts backwards
  691.  
  692.     Executes  command(s)  for  all numerical values of x between n1 and
  693.     n2.   If  more  than  one  command  is  specified,  or  command  is
  694.     redirected, include command(s) in quotes.
  695.     Switch -v (verbose) causes printing of progressive numbers.
  696.     Switch  -s  allows  you to specify a step; if this is negative, the
  697.     count will be backwards.
  698.  
  699.     GOTO
  700.     Usage    : goto label
  701.     Example    :
  702.           label start
  703.             echo "At start"
  704.             dir ram:
  705.             goto start
  706.  
  707.     Goto  the specified label name.  You can only use this command from
  708.     a  source  file.   Labels  may  be  forward or reverse from current
  709.     position.
  710.  
  711.     HEAD
  712.     Usage    : head filename [num]
  713.     Example    : head readme 20
  714.  
  715.     Display  first "num" lines of "filename".  If num is not specified,
  716.     10 is assumed.
  717.  
  718.     HELP
  719.     Usage    : help
  720.     Example    : help
  721.  
  722.     Simply  displays  all  the  available  commands.   The commands are
  723.     displayed in search-order.  That is, if you give a partial name the
  724.     first  command  that  matches  that  name  in  this list is the one
  725.     executed.   Generally,  you  should  specify enough of a command so
  726.     that it is completely unique.
  727.  
  728.     HISTORY
  729.     Usage    : history [partial_string]
  730.     Example    : history
  731.  
  732.     Displays  the  enumerated  history  list.   The size of the list is
  733.     controlled  by  the  _history  variable.   If you specify a partial
  734.     string, only those entries matching that string are displayed.
  735.  
  736.     HOWMANY
  737.     Usage    : howmany
  738.  
  739.     This  command  tells you how many instances of Shell are running in
  740.     your system.
  741.  
  742.     HTYPE
  743.     Usage    : htype file1 .. filen
  744.  
  745.     Displays the specified files in hex and ASCII, just like the system
  746.     command Type file opt h.  Especially suitable for binary files.
  747.  
  748.     IF
  749.     Usage    : if [-n] argument conditional argument ;
  750.     or    : if [-n] argument
  751.     or    : if [-n] -f file
  752.     or    : if [-n] -d file/dir
  753.     or    : if [-n] -m
  754.     or    : if [-n] -t file file1 .. fileN
  755.     or    : if [-n] -r rpnexpression
  756.     or    : if [-n] -v varname
  757.  
  758.     If a single argument is something to another argument.  Conditional
  759.     clauses allowed:
  760.  
  761.     <, >, =, and combinations (wire or).  Thus <> is not-equal, >=
  762.     larger or equal, etc...
  763.  
  764.     If arguments are not numeric, they are compared as strings.
  765.  
  766.     Usually the argument is either a constant or a variable ($varname).
  767.  
  768.     The second form if IF is conditional on the existance of the argument.
  769.     If the argument is a "" string, then FALSE, else TRUE.
  770.  
  771.     The third form of IF used by -f switch checks for existance of
  772.     the specified file.
  773.  
  774.     Switch -d tests the type of the object specified: if it is a
  775.     directory, then TRUE; if it is a file (or it doesn't exist)
  776.     then FALSE.
  777.  
  778.     Switch -m is used to test if FAST memory is present, i.e. wheter
  779.     more than 512K RAM are available.
  780.     Example (to be included in a login.sh file):
  781.     if -m; resident -d lc1 lc2 blink; endif
  782.  
  783.     Using -t form compares the date and time of the first file with
  784.     all the others; if the first is younger than ALL the others, then
  785.     FALSE, else TRUE. If a file doesn't exists, it is considered as
  786.     being older.
  787.     This feature is especially useful for building makefiles without
  788.     using any MAKE utility.
  789.     Example:
  790.     if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif
  791.  
  792.     Option -r evaluates a given RPN expression (see under RPN for more
  793.     info): if value on top of stack is 0, then FALSE, else TRUE.
  794.  
  795.     Switch -n (NOT) reverses the result.
  796.  
  797.     To test if a given variable is defined, use if -v varname.
  798.  
  799.     When using 'IF' command interactively if you are entering commands
  800.     following an 'IF' that was false, the prompt will be set to a
  801.     underscore '_ ' to indicate all commands will be ignored until
  802.     an 'ELSE' or 'ENDIF' command is seen.
  803.  
  804.     INC
  805.     Usage    : inc varname [value]
  806.     Example    : inc abc 5
  807.  
  808.     Increment the numerical equivalent of the variable with specified
  809.     value (default: 1) and place the ascii-string result back into
  810.     that variable.
  811.  
  812.     INFO
  813.     Usage    : info
  814.  
  815.     Display Device statistics for all the disk-type devices in system
  816.     (DFk:, HDk, JHk:, RAM:, RDk: ...), just like the system command
  817.     info. Gives block used/free, % used, errs, status and volume name.
  818.  
  819.     INPUT
  820.     Usage    : input var var ... var
  821.     Example    : input abc
  822.  
  823.     Input from STDIN (or a redirection, or a pipe) to a variable.  The
  824.     next input line is placed in the variable.
  825.  
  826.     JOIN
  827.     Usage    : join [-r] file1..fileN destfile
  828.     Example    : join part1 part2 part3 total
  829.  
  830.     Joins the specified files to get destfile. If destfile already
  831.     exists, an error message is generated and operation is aborted,
  832.     unless you specify -r (replace) option.
  833.  
  834.     LABEL
  835.     Usage    : label name
  836.  
  837.     Create a program label right here. Used in source files, can then
  838.     GOTO a label.
  839.  
  840.     LS
  841.     Equivalent to dir.
  842.  
  843.     MD
  844.     Equivalent to mkdir.
  845.  
  846.     MAN
  847.     Usage    : man command(s)
  848.     Example    : man mkdir
  849.  
  850.     Get  info about a Shell command, or others keywords.  These include
  851.     all  special  _variables, plus various keywords:  WILDCARDS, PIPES,
  852.     EDITING, and more.
  853.     See special alias manlist to get a list of ALL keywords supported
  854.     by man.
  855.     You  must  assign DOC:  to the directory containing Shell.doc (this
  856.     file) to use this command.
  857.  
  858.     MEM
  859.     Usage    : mem
  860.  
  861.     Display  current  memory statistics for CHIP memory and FAST memory
  862.     (if any installed).
  863.  
  864.     MKDIR (MD)
  865.     Usage    : mkdir name name name...
  866.     Example    : mkdir df0:stuff
  867.  
  868.     Create the specified directories.
  869.  
  870.     MV
  871.     Equivalent to rename.
  872.  
  873.     OPEN
  874.     Usage    : open filename filemode filenumber
  875.     Example    : open RAM:data w 1
  876.  
  877.     This  allows you to open a file, redirect to it as many commands as
  878.     you like, then close it.
  879.     Filename is any valid AmigaDOS filename, filemode is either "r" for
  880.     read or "w" for write, filenumber is a number between 1 and 10.
  881.     To  redirect  a  program to or from an open file, use as your redir
  882.     filename a dot followed by the filenumber.
  883.     Here is a complete example:
  884.  
  885.         open RAM:data w 1
  886.         echo -n 2+2= >.1
  887.         rpn 2 2 + . CR >.1
  888.         close 1
  889.         type RAM:data    # will display 2+2=4
  890.  
  891.     See also close, flist.
  892.  
  893.     PATH
  894.     Usage    : path
  895.  
  896.     Used to list AmigaDOS path. In current version can't be used to
  897.     set it.
  898.  
  899.     PRI
  900.     Usage    : pri clinumber pri
  901.     Example    : pri 3 5    # set priority of cli #3 to 5
  902.  
  903.     Change the priority of the specified task (use PS command to
  904.     determine clinumber). If you specify 0 as clinumber you can
  905.     change priority of "this" task (the one executing shell).
  906.  
  907.     PROTECT
  908.     Usage    : protect file1 ... filen [flags]
  909.     Example    : protect myfile rwe
  910.  
  911.     Set AMIGADOS file protection flags for the file specified. Valid
  912.     flags are h, s, p, a, r, w, e, d.
  913.     If you don't specify the flags, all flags are cleared.
  914.     Bit 'a' is new to WorkBench 1.2, while 'h', 's', 'p' are new to 1.3.
  915.  
  916.     PS
  917.     Usage    : ps
  918.  
  919.     Gives status of DOS processes.  eg:
  920.  
  921.     Proc Command Name    CLI Type    Pri.  Address  Directory
  922.      1   SHELL        Initial CLI   0      97b0  Stuff:shell
  923.      2   sys:c/clockmem    Background  -10    2101a8  Workdisk:
  924.      3   c:emacs        Background    0    212f58  Stuff:shell
  925.      4   sys:c/VT100    Background    0    227328  Workdisk:
  926.  
  927.     Address is the addres of the task, directory is the process
  928.     currently CD'd directory.
  929.  
  930.     PWD
  931.     Usage    : pwd
  932.  
  933.     Rebuild _cwd by backtracing from your current directory.
  934.  
  935.     QUIT
  936.     Usage    : quit
  937.  
  938.     Quit out of Shell back to CLI.
  939.  
  940.     RBACK
  941.     Usage    : rback command
  942.  
  943.     Start a new process executing the specified command, but can't do
  944.     input/output. Equivalent to 'run command >NIL: <NIL:'.
  945.  
  946.     RENAME (MV)
  947.     Usage    : rename from to
  948.     or    : rename from from from ... from todir
  949.  
  950.     Allows you to rename a file or move it around within a disk.
  951.     Allows you to move 1 or more files into a single directory.
  952.  
  953.     RESIDENT
  954.     Usage    : resident [-r][-d] [files]
  955.     Example    : resident lc1 lc2 blink    # load these as resident
  956.           resident -d lc1 lc2 blink    # defer load when needed
  957.           resident -r lc1 lc2 blink    # remove these
  958.           resident            # list resident programs
  959.  
  960.     This is ARP resident. Commands are searched by Shell in resident
  961.     list BEFORE of searching on any external device.
  962.     Only PURE programs can run as resident, see ARP docs for more info.
  963.     Option -d is very useful: you can say, in your startup file,
  964.     resident -d file...file; programs will not be loaded immediately,
  965.     but only when you will try to load them. This way, you will not
  966.     waste memory and startup time if you don't use the programs.
  967.     Old option -a has no more effect.
  968.  
  969.     RETURN
  970.     Usage    : return [n]
  971.     Example    : return 10
  972.  
  973.     Exit from a script file, or quit from shell with optional
  974.     exit code.
  975.  
  976.     RM
  977.     Equivalent to delete.
  978.  
  979.     RPN
  980.     Usage    : rpn expression
  981.     Example    : rpn 3 7 *    # Prints the value 21
  982.  
  983.     Evaluate an RPN expression, using 32-bit values. In older versions
  984.     of Shell RPN contained string functions too, but now that strings
  985.     are handled by specifical commands, these are no more needed.
  986.     At end of evaluation, RPN prints values on stack, so you can
  987.     say for instance "rpn $x 2 * | input x" to double the value of
  988.     variable x.
  989.     Functions implemented are:
  990.  
  991.         + - * /    Obvious meaning; / means integer division, of course
  992.         %        Module operator e.g. "rpn 7 3 %" answers 1
  993.         & | ~    Bitwise and, or, not operators
  994.         > < ==    Tests for greater-than, lower-than, equal. To get
  995.             a test for >= (or <=), you can use < ! (or > !)
  996.         !        Logical not operator
  997.         DUP        Duplicate value on top of stack
  998.         DROP    Drop value on top of stack
  999.         SWAP    Swap two values on top of stack
  1000.  
  1001.     To avoid confusion with redirections, > and < operators must be
  1002.     enclosed in quotes e.g.
  1003.  
  1004.         3 2 ">"        # Prints 1
  1005.  
  1006.     RUN
  1007.     Usage    : run prgm args
  1008.     Example    : run emacs test.c
  1009.  
  1010.     Start a new process executing the specified command.
  1011.     In current implementation run command can't be redirected.
  1012.     This command is not fully reliable: use at your own risk.
  1013.     See also rback.
  1014.  
  1015.     RXREC
  1016.     Usage    : rxrec [portname]
  1017.  
  1018.     Create an AREXX-compatible port of the specified name (defaults to
  1019.     "rexx_csh"), then puts Shell to sleep waiting for messages on it.
  1020.  
  1021.     CAUTION: the only way to exit from this status is to send to the port
  1022.     the message "bye".
  1023.  
  1024.     Example:
  1025.     Open two Shell's in two separate CLI's. From the first, type:
  1026.  
  1027.         rxrec
  1028.  
  1029.     Now first Shell doesn't respond to keyboard input; instead, it waits
  1030.     for messages on a port called "rexx_csh". Now, from the other, type:
  1031.  
  1032.         rxsend rexx_csh "dir df0:"
  1033.  
  1034.     You will see the listing of df0: in the first Shell. Experiment as you
  1035.     like, then:
  1036.  
  1037.         rxsend rexx_csh bye
  1038.  
  1039.     And all will return to normal.
  1040.  
  1041.     RXSEND
  1042.     Usage    : rxsend portname commands
  1043.  
  1044.     Send a command to any program with an AREXX-compatible port.
  1045.     You don't have to load anything to use these command (or rxrec):
  1046.     all you need is a program with the right port.
  1047.  
  1048.     An example is CygnusEdProfessional: here is, for instance, a command
  1049.     to wake it up, load the file test.c and jump to line 20:
  1050.  
  1051.         rxsend rexx_ced cedtofront "open test.c" "jmp to line 20"
  1052.         # rexx_ced is the name of AREXX port for CygnusEd
  1053.  
  1054.     Refer to your application manual for details and for the name of the
  1055.     port.
  1056.  
  1057.     SEARCH
  1058.     Usage    : search [-w][-c][-n][-r][-e][-q] filelist string
  1059.  
  1060.     Search specified files for a string. Only lines containing the
  1061.     specified strings are displayed.
  1062.  
  1063.     If the filename is STDIN (in uppercase) the standard input is
  1064.     used, so you can use search as the destination for a pipe.
  1065.     Example:
  1066.         strings myprog 8 | search STDIN .library
  1067.     Lists all libraries used in "myprog".
  1068.  
  1069.     If you specify any directory in filelist, and use the -r (recurse)
  1070.     switch, all files in directory are recursively searched.
  1071.  
  1072.     Lines are numbered by default; use -n (number) switch to turn off
  1073.     line numbering.
  1074.  
  1075.     Search is normally not case sensitive; use -c (case) flag to turn ON
  1076.     case sensitivity.
  1077.  
  1078.     By specifying -e (exclude) switch, only lines NOT containing the
  1079.     specified string are listed.
  1080.  
  1081.     Using -w (wild) flag, only the lines matching with the string are
  1082.     listed.
  1083.     Notes to wild card matching;
  1084.     - Uses Shell standard matching.
  1085.     - All standard ARP wildcards are allowed * ? [] () | ~ ' #
  1086.     - The WHOLE line must match the string, not only a substring.
  1087.     - String MUST be enclosed in quotes to avoid wildcard expansion
  1088.  
  1089.     Flag -q (quiet) suppresses printing of file names.
  1090.  
  1091.     Examples:
  1092.         search -cr df0:include ACCESS
  1093.     Find all occurrencies of ACCESS (in uppercase) in all files
  1094.     contained in include directory.
  1095.         search -w shell.h "'#define*"
  1096.     Lists only lines of file beginning with (not simply containing)
  1097.     #define. Note the use of ' to escape the special symbol #.
  1098.  
  1099.     SET
  1100.     Usage    : set [name] [string]
  1101.     Example    : set abc hello
  1102.  
  1103.     Set with no args lists all current variable settings.
  1104.     Set with one arg lists the setting for that particular variable.
  1105.     Specifying name and string, stores the string into variable name.
  1106.  
  1107.     Also See the section on special _variables.
  1108.  
  1109.  
  1110.     SLEEP
  1111.     Usage    : sleep timeout
  1112.     Example    : sleep 10
  1113.  
  1114.     Sleep for 'timeout' seconds, or until ^C typed.
  1115.  
  1116.     STACK
  1117.     Usage    : stack [number]
  1118.     Example    : stack 8000
  1119.  
  1120.     Changes the default stack for this CLI. Without arguments, prints
  1121.     it.
  1122.  
  1123.     STRHEAD
  1124.     Usage    : strhead varname breakchar string
  1125.     Example    : strhead x . foobar.bas    # Will set x to "foobar"
  1126.  
  1127.     Remove everything after and including the breakchar in 'string' and
  1128.     place in variable 'varname'.
  1129.  
  1130.     STRINGS
  1131.     Usage    : strings file1..fileN minlenght
  1132.     Example    : strings c:dir c:list shell 7
  1133.  
  1134.     Prints strings contained in specified files (usually binary)
  1135.     with lenght >= minlenght.
  1136.  
  1137.     STRLEFT
  1138.     Usage    : strleft varname string n
  1139.     Example    : strleft x LongString 5    # Will set x to "LongS"
  1140.  
  1141.     Place leftmost n chars of string in variable varname.
  1142.  
  1143.     STRLEN
  1144.     Usage    : strlen varname string
  1145.     Example    : strlen x Hello        # Will set x to "5"
  1146.  
  1147.     Puts len of string in variable varname.
  1148.  
  1149.     STRMID
  1150.     Usage    : strmid varname string n1 [n2]
  1151.     Example    : strmid x LongString 5 3    # Will set x to "Str"
  1152.  
  1153.     Places n2 chars from string, starting at n1, in variable varname.
  1154.     By omitting n2, you get all chars from n1 to end of string.
  1155.  
  1156.     STRRIGHT
  1157.     Usage    : strright varname string n
  1158.     Example    : strright x LongString 5    # Will set x to "tring"
  1159.  
  1160.     Place rightmost n chars of string in variable varname.
  1161.  
  1162.     STRTAIL
  1163.     Usage    : strtail varname breakchar string
  1164.     Example    : strtail x . foobar.bas    # Will set x to "bas"
  1165.  
  1166.     Remove everything before and including the breakchar in 'string' and
  1167.     place in variable 'varname'.
  1168.  
  1169.     SOURCE
  1170.     Usage    : source file [arguments]
  1171.     Example    : source mymake.sh all
  1172.     Result    : source file 'mymake.sh' called with var _passed = 'all'
  1173.  
  1174.     Execute commands from a file.  You can create SHELL programs in
  1175.     a file and then execute them with this command.  Source'd files
  1176.     have the added advantage that you can have loops in your command
  1177.     files (see GOTO and LABEL).  You can pass SOURCE files arguments
  1178.     by specifying arguments after the file name.  Arguments are passed
  1179.     via the _passed variable (as a single string).
  1180.  
  1181.     Long lines may be split by appending a backslash (\) at end of
  1182.     first half. However, even joined lines cannot be longer than
  1183.     ~255 chars. See example of source files.
  1184.  
  1185.     Automatic 'sourcing' is accomplished by placing a .sh extension on
  1186.     the file and executing it as you would a C program:
  1187.  
  1188.     --------- file hello.sh ---------
  1189.     foreach i ( $_passed ) "echo yo $i"
  1190.     ---------------------------------
  1191.  
  1192.     $ hello a b c
  1193.     yo a
  1194.     yo b
  1195.     yo c
  1196.  
  1197.     TACKON
  1198.     Usage    : tackon var pathname filename
  1199.     Example    : tackon x df0:c Dir    # sets x to "df0:c/Dir"
  1200.     or    : tackon x df0: Preferences #sets x to "df0:Preferences"
  1201.  
  1202.     Correctly  adds  a  filename  to a pathname, and puts the result in
  1203.     variable specified.
  1204.  
  1205.     TAIL
  1206.     Usage    : tail filename [num]
  1207.     Example    : tail readme 20
  1208.  
  1209.     Display  last  "num" lines of "filename".  If num is not specified,
  1210.     10 is assumed.
  1211.  
  1212.     TEE
  1213.     Usage    : tee
  1214.     Example    : cc test.c | tee >error.list
  1215.  
  1216.        This  one is a classic "pipe fitting":  it copies standard input
  1217.     both to standard output and standard error.
  1218.  
  1219.     TYPE
  1220.     Equivalent to CAT.
  1221.  
  1222.     TOUCH
  1223.     Usage    : touch file1 .. fileN
  1224.  
  1225.     Sets DateStamp on the specified files to the current date and time.
  1226.  
  1227.     UNALIAS
  1228.     Usage    : unalias name .. name
  1229.     Example    : unalias vt
  1230.  
  1231.     Delete aliases..
  1232.  
  1233.     UNIQ
  1234.     Usage    : uniq
  1235.  
  1236.     This  is  a  filter  commands, that removed consecutive, duplicated
  1237.     lines in a file.  It is most useful on a sorted file.
  1238.  
  1239.     UNSET
  1240.     Usage    : unset name .. name
  1241.     Example    : unset abc
  1242.  
  1243.     Unset one or more variables.  Deletes them entirely.
  1244.  
  1245.     VER
  1246.     Usage    : ver
  1247.  
  1248.     Show current version name, & authors.
  1249.  
  1250.     WINDOW
  1251.     Usage    : window [-q][-f][-b][-l][-s] [dimensions]
  1252.     Options    :
  1253.         -f    (front) Window to front
  1254.         -b    (back)  Window to back
  1255.         -l    (large) Window to maximum size
  1256.         -s    (small) Window to minimum size
  1257.         -a    (activate)
  1258.         -q    (query) Lists screens and windows open
  1259.  
  1260.        Various  operations on CLI window.  If dimensions are specified,
  1261.     they must be in the form x y width height, with values separated by
  1262.     spaces.
  1263.        The  command  "window  -l" may be very useful on PAL machines to
  1264.     get  a  full  PAL  window  from  your login sequence, or if you use
  1265.     overscan WorkBench.
  1266.        Option  -q  gives,  for  each  Screen and Window currently open,
  1267.     title, left edge, top edge, width, height.
  1268.  
  1269.  
  1270. IX. SPECIAL SET VARIABLES
  1271. -------------------------
  1272.  
  1273.     _prompt
  1274.        This  variable  is  set  to  the string you wish printed as your
  1275.     prompt.
  1276.        This  can  contain  escape  sequences  if  you  wish, or you can
  1277.     include a %p in path definition to get CD in your prompt.
  1278.        Default  prompt shows path specification in red pen, followed by
  1279.     a greater (>) sign and a space.
  1280.        The  if  command  will  set the prompt to a '_ ' if commands are
  1281.     disabled while waiting for a 'endif' or 'else' command (interactive
  1282.     mode only.
  1283.  
  1284.     _history
  1285.        This variable is set to a numerical value, and specifies how far
  1286.     back your history should extend.
  1287.  
  1288.     _debug
  1289.     Debug mode... use it if you dare.  must be set to some value
  1290.  
  1291.     _verbose
  1292.     Verbose mode (for source files).  display commands as they are
  1293.     executed.
  1294.  
  1295.     _maxerr
  1296.     The worst (highest) return value to date.  To use this, you usually
  1297.     set it to '0', then do some set of commands, then check it.
  1298.  
  1299.     _lasterr
  1300.     Return code of last command executed.  This includes internal
  1301.     commands as well as external comands, so to use this variables
  1302.     you must check it IMMEDIATELY after the command in question.
  1303.  
  1304.     _cwd
  1305.     Holds a string representing the current directory we are in from
  1306.     root.  The SHELL can get confused as to its current directory if
  1307.     some external program changes the directory.  Use PWD to rebuild
  1308.     the _cwd variable in these cases.
  1309.  
  1310.     _passed
  1311.     This variable contains the passed arguments when you SOURCE a file
  1312.     or execute a .sh file.  For instance:
  1313.  
  1314.     test a b c d
  1315.  
  1316.     -------- file test.sh ----------
  1317.     echo $_passed
  1318.     foreach i ( $_passed ) "echo YO $i"
  1319.     --------------------------------
  1320.  
  1321.     _path
  1322.     This variable contains the search path when the shell is looking
  1323.     for external commands.  The format is:  DIR,DIR,DIR  Each DIR must
  1324.     have a trailing ':' or '/'.  The current directory is always
  1325.     searched first.  The entire path will be searched first for the
  1326.     <command>, then for <command>.sh (automatic shell script sourcing).
  1327.  
  1328.     The default _path is set to
  1329.         ram:,ram:c/,df0:c/,df1:c/,df0:,df1:,sys:system/
  1330.  
  1331.     _insert
  1332.     Sets the default for insert/overtype mode for command line
  1333.     editing. ^A toggles between, but after <RET> the default is
  1334.     set back as indicated by this variable. By default _insert is 1
  1335.     indicating insert mode on setting to zero will make overtype
  1336.     the default.
  1337.  
  1338.     _titlebar
  1339.     Used to set window's title bar.
  1340.  
  1341.     _clinumber
  1342.     Contains the number (1-20) of current CLI.
  1343.  
  1344.     _except
  1345.     See EXCEPTION
  1346.  
  1347. X.  EXCEPTION PROCESSING
  1348. ------------------------
  1349.  
  1350.     EXCEPTION PROCESSING
  1351.     If  no  _except variable exists, any command which fails causes the
  1352.     rest of the line to abort as if an ABORTLINE had been executed.  If
  1353.     the _except variable exists, it is of the form:
  1354.  
  1355.     "nnn;commands..."
  1356.  
  1357.     where  nnn  is  some  value  representing  the  minimum return code
  1358.     required  to  cause  an  error.   Whenever a command returns a code
  1359.     which  is  larger  or  equal  to  nnn,  the commands in _except are
  1360.     executed  before  anything.   WHEN _except EXISTS, THE COMMAND LINE
  1361.     DOES  NOT  ABORT AUTOMATICALLY.  Thus, if you want the current line
  1362.     being executed to be aborted, the last command in _except should be
  1363.     an "abortline".
  1364.  
  1365.     Exception  handling  is  disabled  while  in the exception handling
  1366.     routine (thus you can't get into any infinite loops this way).
  1367.  
  1368.     Thus if _except = ";", return codes are completely ignored.
  1369.  
  1370.     Example:
  1371.  
  1372.     set _except "20;abortline"
  1373.  
  1374. XI. EXAMPLE SOURCE FILES
  1375. ------------------------
  1376.  
  1377. If from a CLI or the startup-script you say 'SHELL filename', that file is
  1378. sourced first.
  1379. Moreover, if you have a file called S:.login, it will be sourced for every
  1380. Shell you run. This is useful for aliases and setting that you want in ALL
  1381. Shells.
  1382.  
  1383.  
  1384. ### Example S:.login ###
  1385.  
  1386. Here is an example .login file:
  1387.  
  1388. set F5 "cdir WORK:"^M
  1389. set f9 "ed s:login.sh"^M
  1390. set F9 "ed df0:s/startup-sequence"^M
  1391. alias toram  "%q foreach i ( $q ) \"cp -r $i: ram:$i >NIL:;\
  1392.     assign $i: ram:$i\""
  1393. alias ramop  "md RAM:op; assign OP: ram:op"
  1394. alias noop   "assign OP: ; rm -r ram:op"
  1395. alias newop  "rm -r OP:*"
  1396. alias dc     "dfc df0: to df1:"
  1397. alias go     "%q assign WORK: Boot:$q; cd WORK:; source startme.sh"
  1398. alias get    "%q cp $q RAM: >NIL:"
  1399.  
  1400. #This one puts current directory and cli number on prompt !!!!!!
  1401. set _prompt ^[[33m[$_clinumber].%p>" "
  1402.  
  1403. # this one puts current directory on window titlebar !!!!!!
  1404. alias cd     "%q \\cd $q; set _titlebar CWD: $_cwd"
  1405.  
  1406. # This file will be sourced for every Shell you start
  1407.  
  1408. ### End of example .login ###
  1409.  
  1410. ****************************************************************************
  1411.  
  1412. If you are a CLI user, your startup-sequence may be as simple as:
  1413.  
  1414.     C:Shell S:startup.sh
  1415.  
  1416. Here is, my startup code:
  1417.  
  1418. ### Example S:startup.sh ###
  1419.  
  1420. wind -l    # if you are on a PAL machine, or use overscan
  1421.     # note that commands may be abbreviated (wind=window)
  1422.  
  1423. assign LC:    Stuff:c
  1424. assign INCLUDE:    Stuff:include
  1425. assign LIB:    Boot:lib
  1426. assign QUAD:    RAM:
  1427.  
  1428. rback C:FaccII; sleep 1
  1429.     # after spawning a process, it is always better to allow it
  1430.     # to load the command, to avoid excessive drive head movement
  1431.  
  1432. resident -d blink lc1 lc2 >NIL:
  1433.     #defer loading
  1434.  
  1435. C:PopCli 300 C:Newcli
  1436.     #using full pathname loads faster (even without Shell)
  1437. C:FF -1 Siesta.font >NIL:
  1438. C:Patch_1 >NIL:
  1439. stack 8000
  1440.     # lc1 and lc2 need this
  1441.  
  1442. source S:setdate.sh    # this is listed in next chapter
  1443.  
  1444. ### End of example startup.sh ###
  1445.  
  1446. ****************************************************************************
  1447.  
  1448. The following is an example source file to set date and time; it may be
  1449. used at startup if you don't have an internal clock.
  1450.  
  1451. ### setdate.sh ###
  1452.  
  1453. open CON:200/100/440/80/SetDate write 1
  1454. echo >.1 -n "Current date is "
  1455. date >.1
  1456. echo >.1 -n "Please enter date: "
  1457. input <.1 d
  1458. close 1
  1459. strlen len $d
  1460. if $len > 1 ; date $d ; endif
  1461. echo -n "New date: " ; date
  1462.  
  1463. ### End of setdate.sh ###
  1464.  
  1465. ***************************************************************************
  1466.  
  1467. Next comes a makefile that needs no Make program: may be executed from
  1468. Shell directely!!!
  1469.  
  1470. ### make.sh ###
  1471.  
  1472. if -t Shell.syms Shell.h; cc +HShell.syms Shell.h; rm shell.o; endif
  1473. if -t RAM:Shell.syms Shell.syms; cp -d Shell.syms RAM:; endif
  1474.  
  1475. foreach i ( main comm1 comm2 comm3 execom globals rawconsole run set \
  1476.  sub ) "if -t $i.o $i.c; echo Compile $i...;cc +IRAM:shell.syms $i.c; endif"
  1477.  
  1478. if -t Shell run.o main.o comm1.o comm2.o comm3.o execom.o \
  1479. set.o sub.o globals.o rawconsole.o
  1480.     ln  +q -m -o Shell run.o main.o comm1.o comm2.o comm3.o\
  1481.     execom.o set.o sub.o globals.o rawconsole.o -la -lc
  1482. endif
  1483.  
  1484. ### End of make.sh ###
  1485.  
  1486.  
  1487. XII.  Default Values
  1488. --------------------
  1489.  
  1490. To make things easier, some aliases are predefined whenever you start a
  1491. new Shell. These are:
  1492.  
  1493.     MANLIST
  1494.     Display  a list of possible arguments to man.  You can pipe this to
  1495.     sort to get a sorted output.
  1496.  
  1497.     CLS
  1498.     Simply clear the screen.
  1499.  
  1500.     CDIR
  1501.     Use "cdir directory" to clear the screen, set CD to directory,
  1502.     and list it.
  1503.  
  1504.     KR
  1505.     Deletes everything on RAM:. If you think this is dangerous,
  1506.     you can remove this alias.
  1507.  
  1508.     EXIT
  1509.     Leave Shell and exit CLI.
  1510.  
  1511.     LP
  1512.     List to printer one or more files.
  1513.  
  1514. Moreover, many variables have default values, and many function keys are
  1515. predefined. You can use set command to determine all of these.
  1516.  
  1517. XIII.  Why ARP ?
  1518. ----------------
  1519.  
  1520.     ARP
  1521.     For  those  of you curious enough, the A in "4.xxA" means ARP.  The
  1522.     most  recent versions of Shell use ARP.library.  This has been very
  1523.     useful in:
  1524.  
  1525.     -  Implementing  commands like ASET, ASSIGN, INFO, RESIDENT, RBACK,
  1526.        RUN.
  1527.     - Keeping executable code small.
  1528.  
  1529.     ARP.library  is  really public domain, so one can include it in any
  1530.     package,  both  commercial  or  public domain, like I am doing with
  1531.     Shell.   The  ARP  team  is trying to wipe out the BCPL from AMIGA.
  1532.     This  is  a  very good idea, I think.  And there is a lot of people
  1533.     hoping that Commodore will put ARP.library in ROM, before or after.
  1534.     This  would make the AMIGA a much more friendly computer to use and
  1535.     program.   I  encourage programmers to get ARP development package:
  1536.     you  can  find  it on many BBS, and is really public domain.  Users
  1537.     can  look  for  a  replacement  of  C:   commands from ARP (but, of
  1538.     course,  if  you use this Shell you won't need them anymore, except
  1539.     for ARUN).
  1540.