home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff331.lzh / Csh / shell.doc < prev    next >
Text File  |  1990-03-21  |  46KB  |  1,474 lines

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