home *** CD-ROM | disk | FTP | other *** search
/ Amiga GigaPD 3 / Amiga_GigaPD_v3_3of3.iso / fred_fish / fish_601-700_lha / fish_624.lha / CSH / csh519.lha / csh.doc < prev    next >
Text File  |  1992-02-25  |  91KB  |  2,632 lines

  1.  
  2.         INSTRUCTIONS FOR C-SHELL VERSION: 5.19  January 1992
  3.         ====================================================
  4.  
  5.   Contents
  6.   --------
  7.  
  8.     O.    Installation
  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.    Functions
  19.     XI.    Miscellaneous
  20.     XII.    Example source files
  21.     XIII.    Default values
  22.     XIV.    Object oriented features
  23.     XV.    Keymaps
  24.  
  25.  
  26.  
  27. O.  Installation
  28. ----------------
  29.  
  30. For  online  help  inside  csh, assign CSH:  somewhere and put csh.doc there.
  31. Then  you  can use the 'man' command for any desired command.  Press the HELP
  32. key for a command list.
  33.  
  34. You  can  simply  invoke  csh  from  the  command  line or at the end of your
  35. startup-sequence,  because  csh  is, from the AmigaDOS standpoint, not a true
  36. shell  like  l:shell-seg.   Nevertheless,  csh is 'pure', so if your archiver
  37. forgot to set the 'p' bit, do it right now.
  38.  
  39. Proposed final setup:  If you want to make csh resident, do the following:
  40.  
  41.  
  42. - Kickstart 1.3
  43.  
  44.   1. Copy csh anywhere on your (hard)disk, e.g. dh1:tools
  45.   2. Make sure your s:startup-sequence contains:
  46.     Resident CLI L:Shell-Seg SYSTEM PURE ADD
  47.     Resident dh1:tools/csh ADD
  48.     NewShell FROM s:csh-startup
  49.     EndCLI
  50.   3. Put the following in s:csh-startup
  51.     Stack 8000
  52.     csh -r s:firstlogin.sh
  53.   4. In s:firstlogin.sh, put any commands to be called only once, like setmap,
  54.     assign, setclock. This is a shell script, use # for comments, and 
  55.     don't use .key type commands. At the end of this file, add
  56.     source s:login.sh
  57.   5. In s:login.sh, you put any commands that need to be executed on every
  58.     invocation, like 'alias', 'set' and so on.
  59.   6. Put the following the s:cli-startup and s:shell-startup, so csh will be
  60.     started in any window opened by NewCLI, NewShell or from workbench.
  61.     csh s:login.sh
  62.  
  63.  
  64. - Kickstart 1.3 plus existing ARP shell:
  65.  
  66.   Not recommended anymore, since the ARP shell is not 2.0 compatible and
  67.   each csh invocation takes 55K of memory instead of 30K then. You best 
  68.   remove the ARP shell, maybe retaining some ARP commands.
  69.  
  70.  
  71. - Kickstart 2.0
  72.  
  73.   1. Copy csh anywhere on your (hard)disk, e.g. dh1:tools
  74.   2. Make sure your s:startup-sequence contains:
  75.     Stack 8000
  76.     Resident dh1:tools/csh ADD
  77.     csh s:firstlogin.sh
  78.   3. Proceed from step 4 in kickstart 1.3
  79.  
  80.  
  81. Additionally,  I  recommend  to  assign CSH:  somewhere and put your docs and
  82. CShell  scripts there.  You can do the assign from inside the shell, it's not
  83. needed at startup.
  84. The file s:.login is executed on every startup if it exists.
  85.  
  86.  
  87. I.  DESCRIPTION
  88. ---------------
  89.  
  90. This version of Shell is the successor of:
  91.     Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
  92.     Shell V2.04M-V2.07M by Steve Drew
  93.     Shell V2.08MI, V3.xxA and V4.xxA by Carlo Borreo & Cesare Dieni
  94.     Shell V5.xxL by U. Dominik Mueller
  95.  
  96. If you have any wishes, bug reports or beer bottles, send them to:
  97.  
  98.        FIDONET :  Urban Mueller@2:302/906 (AUGL)
  99.        INTERNET:  umueller@iiic.ethz.ch
  100.                   umueller@amiga.physik.unizh.ch
  101. or
  102.        U. Dominik Mueller
  103.        Schulhausstrasse 83
  104.     CH-6312 Steinhausen
  105.        SWITZERLAND
  106.  
  107. Any sign of intelligent life welcome! German, English and French spoken.
  108.  
  109. Please  check  the  'restrictions'  chapter before reporting any bugs and add
  110. your CShell version and a description of your configuration.  The support BBS
  111. is  AUGL  (2:302/906),  +41  75  8 20 19, +41 75 8 20 18, +41 75 2 15 87 (all
  112. lines USRobotics HST or V.32), login='cshell', password='support'.
  113.  
  114. You may distribute this program unmodified and for non-profit only.
  115.    *** YOU MAY NOT MODIFY THIS PROGRAM AND REDISTRIBUTE IT ***
  116. Please contact me if you want to make changes.
  117.  
  118.  
  119. AVAILABILITY
  120. ------------
  121.  
  122. CShell can always be downloaded at the AUGL BBS.  Some additionals parts
  123. (French documentation) are available there, too.
  124.  
  125. For those who want to get it per FIDO file request, the archive is always
  126. named like 'csh513.lzh' for CShell 5.13 and 'csh513s.lzh' for its source.
  127.  
  128. For FTP or bitnet file requests at ab20.larc.nasa.gov [128.155.23.64], the
  129. archive names are the same, and they're sited either in the directory
  130. /incoming/amiga or in /amiga/utils/system/cli/shells.
  131.  
  132. You can get the French doc from AUGL or order it for 20 French Francs at:
  133.     BUGSS
  134.     4, Place de L'Aube
  135.     33170 GRADIGNAN
  136.     FRANCE
  137. Direct any questions to berger@geocub.greco-prog.fr .
  138.  
  139.  
  140. CREDITS
  141. -------
  142.  
  143. Arexx is a program by William Hawes.
  144. Cygnus Ed Professional (C) 1988 CygnusSoft Software.
  145. ARP is copyrighted by the authors.
  146.  
  147. Thanks to:
  148.  
  149. Matt  Dillon,  Steve  Drew,  Calro  Borreo  and Cesare Dieni for the previous
  150. versions of Csh.
  151.  
  152. Eddy Carroll, Gary Duncan, Randell Jesup, Steve Koren, Tim MacKenzie, Axel
  153. Roebel, Mike Schwartz for their code contributions and suggestions.
  154.  
  155. Michael Beer, Carl Johan Block, Hubert Feyere, Magnus Heldestad, Carsten
  156. Heyl, Alex Liu, Declan McArdle, Svante Eriksson, Luke Mewburn, Peter Orbaek,
  157. Allard Siemelink, Roddi Walker, Shimon Weissman and the unknown Swedish guy
  158. who found the double-LF bug for their bug reports amd feedback.
  159.  
  160. Roy Haverman, Martin Horneffer, Hans-Christian Huerlimann, Daniel Pfulg,
  161. Patrizio Rusconi, Christian Schneider and especially Markus Illenseer for the
  162. German translation of the doc.
  163.  
  164. Olivier Berger for the French translation of the doc.
  165.  
  166.  
  167. II. OVERVIEW
  168. ------------
  169.  
  170. Shell provides a convenient AmigaDos alternative command interface.  All its
  171. commands are internal and thus it does not rely on the c:  commands for any
  172. functionality.
  173.  
  174. Major features include:
  175.     - freely programmable command line editing
  176.     - simple history
  177.     - piping
  178.     - aliases with arguments
  179.     - variables & variable handling (embedded variables)
  180.     - file name expansion via wild carding ('?', '*' and more)
  181.     - conditionals (if/else etc..)
  182.     - source files  (w/ gotos and labels)
  183.     - tab file name completion
  184.     - object oriented features (file classes, actions)
  185.     - many built in commands to speed things up
  186.     - full functionality on VT terminals
  187.  
  188. CShell  runs  on minimum stack, for recursive aliases and source files better
  189. increase stack to 8K or more.
  190.  
  191. If you use CShell for the first time, remember the following:
  192.     - CShell internal commands must be lowercase & can be abbreviated
  193.     - AmigaDOS command 'Execute' causes some trouble. You cannot redirect
  194.       it, you must not rename it, and you get no return code.
  195.       You can also use 'source' to start your scripts, but you'll have
  196.       to rewrite them a bit. Besides the '.key'-type commands, 'source' 
  197.       is downward compatible with 'Execute'.
  198.     - You can always get more information on a command if csh.doc is
  199.       in the current directory or in csh: (you will be able to modify 
  200.       this) and you enter 'man <command>'
  201.     - The wild card #? doesn't work. Use *
  202.  
  203.  
  204. III. RESTRICTIONS
  205. -----------------
  206.  
  207. The following applies only to the V36 version of Kickstart 2.0:  The INTERNAL
  208. commands cannot be started.  The same is true for the commands in C:  if they
  209. were  made  resident  using  the  AmigaDOS  'Resident' command (with cshell's
  210. 'resident' they work).  Thus, you should disable the INTERNAL residents using
  211. the -i0 startup option if you have a V36 Kickstart.
  212.  
  213. Under  1.3, you can't start AmigaDOS residents directly.  But you can use the
  214. -r  startup  option,  which  will  copy the AmigaDOS resident list to the ARP
  215. resident  list once (and make those residents unremovable).  I'll try to find
  216. a better solution.
  217.  
  218. The  best  choice  under  both kickstarts is to make only csh itself AmigaDOS
  219. resident, all other commands, if any, ARP resident.  Under 1.3, you can start
  220. the  shell  (as any other commands) from the resident list only after you did
  221. 'resident CLI l:Shell-seg' and 'newcli'.
  222.  
  223. The  c:Execute command cannot be redirected, does not return error codes, and
  224. might cause other problems.  It will not work at all if it has been renamed.
  225.  
  226. The  VDK:  handler and Frank Seidel's BootRam-Handler have a bug with setting
  227. file  dates,  so  when  using  the  copy command you should try the -d and -p
  228. switches, otherwise your file date will be bad.  (This is not a shell bug)
  229.  
  230. If using it with conman you may consider starting shell with the -a switch to
  231. turn  off shell's command line editing and use conmans instead.  You'll lose,
  232. however, many shell features like file name completion.
  233.  
  234. CB-handler  (a  tool that installs a scrollbar in the CLI window) is not 100%
  235. compatible  with  cshell.   The log will not always represent the real screen
  236. contents.
  237.  
  238.  
  239. IV. NOTES ON PIPES
  240. ------------------
  241.  
  242.     PIPES
  243.     PIPES  have  been implemented using temporary T:  files.  Thus, you
  244.     should be  careful  when  specifying  a 't:*' expansion as it might
  245.     include the temporary files. These files are deleted on completion
  246.     of the pipe segment.
  247.  
  248.     The file names used are completely unique, even with multiple shell
  249.     running simultaneously.
  250.  
  251.     My  favorite  new  feature is the fact that you can now redirect to
  252.     and  from,  and pipe internal commands.  'echo charlie >ram:x', for
  253.     instance.  Another favorite:
  254.  
  255.     echo "echo mem | csh" | csh
  256.  
  257.     No BCPL program should be output-append redirected (>>).
  258.  
  259.  
  260. V.  COMMAND PRE-PROCESSOR
  261. -------------------------
  262.  
  263.     PREPROCESSING
  264.     Preprocessing is done on the command line before it is passed on to
  265.     an internal or external routine:
  266.  
  267.     ^c    where c is a character is converted to that control character.
  268.         Thus, say '^l' for control-l.
  269.  
  270.     \233    insert character code 233 octal. Do not use values between
  271.         200o and 232o, as they have special meanings. \240 is the
  272.         word separator.
  273.  
  274.     $name    where name is a variable name.  Variable names can consist of
  275.         0-9, a-z, A-Z, and underscore (_).  The contents of the
  276.         specified variable is used.  If the shell variable doesn't 
  277.         exist, csh tries to find and ENV: variable of the same name.
  278.         If that fails, too, "$name" is inserted..  That is, if the 
  279.         variable 'i' contains 'charlie', then '$i' -> 'charlie'.  If 
  280.         the variable 'i' doesn't exist, then '$i'->'$i' .
  281.  
  282.     ;    delimits commands.   echo charlie ; echo ben.
  283.  
  284.     ' '    (a space). Spaces delimit arguments.
  285.  
  286.     "string" a quoted string. Trailing quotes are optional. For instance,
  287.         if you want to echo five spaces and an 'a':
  288.  
  289.         echo      a       -> a
  290.         echo "    a"      ->      a
  291.  
  292.     \c    override the meaning of special characters.  '\^a' is a
  293.         circumflex and an a rather than control-a.  To get a backslash,
  294.         you must say '\\'.
  295.  
  296.         also used to overide alias searching for commands.
  297.  
  298.     >file    specify output redirection.  All output from the command is
  299.         placed in the specified file.
  300.  
  301.     >>file    specify append redirection (Does not work with BCPL programs).
  302.  
  303.     <file    specify input redirection. The command takes input from the
  304.         file rather than the keyboard (note: not all commands require
  305.         input; it makes no sense to say 'echo <charlie' since
  306.         the 'echo' command only outputs its arguments).
  307.  
  308.     |    PIPE specifier.  The output from the command on the left becomes
  309.         the input to the command on the right.  The current SHELL
  310.         implimentation uses temporary files to store the data.
  311.  
  312.     !!    execute the previously executed command.
  313.     !nn    (nn is a number).  Insert the history command numbered n (see
  314.         the HISTORY command)
  315.     !partial search backwards through the history list for a command which
  316.         looks the same as 'partial', and execute it.
  317.  
  318.     #    enter comment.  The rest of the line is discarded (note: \#
  319.         will, of course, overide the comment character's special
  320.         meaning)
  321.  
  322.     {e hi;e ho} executes two commands as one, so they can be redirected
  323.         together (see ALIAS command). The trailing curly brace is 
  324.         optional.
  325.  
  326.     $(foo)    insert the stdout of the command 'foo' at this position of
  327.         the command line. Every line of the output will count as one
  328.         argument. The closing parenthesis is optional.
  329.  
  330.     `foo`    insert the stdout of the command 'foo' at this position of
  331.         the command line. Every blank separated word will count as
  332.         one argument. Leading, trailing and multiple blanks will be
  333.         removed. The trailing backtick is optional.
  334.  
  335.     --    stop option parsing here. Works for internal commands only.
  336.         Example: rm -- -x will remove the file '-x'
  337.  
  338.     Please note the subtle differences between
  339.         alias count {echo one;echo two}
  340.         alias count "echo one;echo two
  341.     The first form will create an alias that contains a local alias. The
  342.     other will create a plain alias. Also, things within braces will not
  343.     be parsed more than once, therefore a backslash needs not be pre-
  344.     ceded by a pair of backslashes. Thus the commands look the same as
  345.     if they were to be typed in at the prompt. To echo lots of '#', 
  346.     either use:
  347.         forever {echo \#
  348.         forever "echo \\\#
  349.     A block can spread over several lines. Refer to the SOURCE command.
  350.  
  351.  
  352. VI. COMMAND LINE EDITING
  353. ------------------------
  354.  
  355.     o The command line can be up to 255 chars.
  356.     o Inserts  and  deletes  are handled correctly over multiple lines.
  357.     o The script 'menu.sh' installs an intuition menu that contains most 
  358.       editing functions
  359.  
  360.     EDITING
  361.  
  362.     -- MOVING --
  363.     Left Arrow      One character left
  364.     Right Arrow      One character right
  365.     Shift-Left Arrow  One word left
  366.     Shift-Right Arrow One word right
  367.     ESC-Left Arrow      Beginning of line (^A) (^Z)
  368.     ESC-Right Arrow      End of line       (^E)
  369.     -- DELETING --
  370.     Backspace      Previous character
  371.     Del          Character under cursor
  372.     ESC-Backspace      Previous word     (^W)
  373.     ESC-Del          Next word    
  374.     ESC-x-Backspace      To start of line  (^B)
  375.     ESC-x-Del      To end of line    (^K)
  376.     ESC-d          Entire line       (^X)
  377.     -- HISTORY --
  378.     Up Arrow      Recall previous commands
  379.     Down Arrow      Recall commands
  380.     Shift-Up Arow      Get history from partial (or number)
  381.     Shift-Down Arrow  Go below last command of history
  382.     ESC-Up Arrow      Get start of history
  383.     ESC-Down Arrow      Get end of history
  384.     ESC-!          Get history from partial (or number)
  385.     ^T          Insert tail (all but first word) of previous line
  386.     ^P          Duplicate previous word (useful for mv)
  387.     -- COMPLETION --
  388.     TAB          Inserts first matching file name
  389.     Shift-TAB      Inserts longest common substring
  390.     ESC-TAB          Inserts all matching file names (also ESC-*)
  391.     ESC-c          Does a quick cd on left word (TAB for cycling)
  392.     ESC-~          Inserts the last current directory
  393.     ^D          Shows all files that match a pattern (also ESC-=)
  394.     -- EXECUTING LINE --
  395.     Return          Executes line
  396.     ESC-Return      Executes this line of history & brings up next one
  397.     ^N          Next line. Don't exec this one but store history
  398.     ^\          EOF (directly exits)
  399.     -- MISCELLANEOUS --
  400.     ^L          Retype current line.
  401.     ^O          Echo a ^O
  402.     ^R          Repeat last command (don't play with this)
  403.     ^U          Undo/Redo last edit 
  404.     ESC-i          Toggle Insert/Overwrite
  405.     f1-f10          Execute command if variable exists.
  406.     F1-F10          More commands (Shifted f keys).
  407.     Help          Invokes help command
  408.  
  409. Whenever  the cursor is placed on or directly after an incomplete file name
  410. and   you  press  TAB,  CShell  inserts  for  the  first  filename  (sorted
  411. alphabetically)  that  matches  the name part already typed.  Any wildcards
  412. are allowed here, if none are given, '*' is appended.  Immediately pressing
  413. TAB  again  brings  up  the  next  file  name  that  matched the substring.
  414. Shift-TAB  will  only  insert  the  as  much as is common to all files that
  415. matched  your  abbreviation.  If  pressed  again,  behaves  just  like TAB.
  416. ESC-Tab  inserts  the  name  of the directory where you would have ended up
  417. with a quick cd to that substring.
  418.  
  419. Note  that  ^D  now  means  'quit  batchfile' like under AmigaDOS and is no
  420. longer used for quitting CShell. If you want it back, enter 'keymap 0 4=41'
  421.  
  422. The  CTRL  keys FGVY are unset, feel free to map them to any function (see
  423. chapter XV).  You can also remap all preset keys.
  424.  
  425. VII. FUNCTION KEYS
  426. ------------------
  427.  
  428.     FUNKEY
  429.     Function keys now insert text to the current position on the command
  430.     line. They maybe terminated with a ^M (return). f1 would be non shifted
  431.     where as F1 is shifted.
  432.     Most of functions key have a default definition, but it may be changed.
  433.  
  434.         $ set f1 dir df0:^M
  435.  
  436.     will add the text 'dir df0:<return>' to the current line.
  437.  
  438.         $ set f1 dir
  439.  
  440.     would only add 'dir' you could then enter ' df0:<return>'
  441.  
  442.  
  443. VIII. SHELL COMMANDS
  444. --------------------
  445.  
  446.     STARTUP OPTIONS
  447.     First to start shell from a CLI:
  448.  
  449.     csh [-abcCfiknstv] [-c command;command]
  450.     csh [-abcCfiknstv] [batchfile1 ... batchfileN]
  451.  
  452.      -a  AUX: mode. No command line editing and text highlighting
  453.      -b  starts shell in background, which means only task priority -1.
  454.      -c  allows execution of one command line and then exits out
  455.          of  shell.   This  is  useful for running an internal shell
  456.          commands in the background or from an external application:
  457.         run csh -c "dir df0:; copy -r df0: df1: >nil:; echo Done"
  458.      -C  same as -c, but the command line is not parsed twice. This
  459.          allows passing of file names with blanks within.
  460.         run csh -C rm "Ram Disk:tempfile"
  461.      -f  starts shell in foreground, which means only task priority 1.
  462.          you might reset this prioritiy to 0 at the end of your .login
  463.      -i0 disables INTERNAL residents. For V36 kickstarts.
  464.      -k  sets _nobreak before doing anything
  465.      -n  suppresses starting of s:.login
  466.      -r  copies the Amiga resident list to the ARP resident list. You
  467.          can't remove them anymore. No copying when under kick 2.0 or
  468.          if ARP residents present.
  469.      -s  globally enables the asterisk * as alias for #? in AmigaDOS 2.0.
  470.          This means you can use * inside file requesters as well.
  471.      -t  terminal mode. You can use command line editing and text high-
  472.          lighting on a VT100 compatible terminal. To swap backspace
  473.          and DEL, refer to the 'keymap' command
  474.      -v  sets _verbose to 'hs' before doing anything.
  475.  
  476.     Under 1.3, the best thing you can do is to make csh resident using
  477.     the AmigaDOS Resident command in the startup-sequence, then start
  478.     it with the option -r, so you can start another resident csh from
  479.     inside csh. NOTE: Residents copied using -r cannot be removed! I
  480.     advise you to use the internal resident command for all but csh
  481.     itself.
  482.  
  483.     COMMAND EXECUTION
  484.  
  485.     Internal shell commands are case sensitive and may be abbreviated.
  486.  
  487.    The first argument is the command-name... here is (in order) how Shell
  488.    tries to execute it:
  489.  
  490.     1)  The alias list is searched for an alias with an exactly 
  491.         matching name.
  492.     2)  Internal commands list is scanned for a command even partially
  493.         matching name (so you can, for instance, say resi for resident;
  494.         however, you should specify enough of a command to be unique).
  495.     3)  Then, the list of functions is scanned for a command that
  496.         matches completely. If one is found, the result of the function
  497.         is echoed to stdout.
  498.     4)  Now the command is assumed to be external. Arguments with blanks,
  499.         semicolons or empty strings will be surrounded by quotes.
  500.     5)  If the file is a directory, a 'cd <file>' will be performed to
  501.         it.
  502.     6)  AmigaDOS and ARP resident list are scanned for it (you can use
  503.         Shell's 'resident' command to add/remove a file in the ARP list).
  504.     7)  If the file is in the current directory and it's executable, it
  505.         is started.
  506.     8)  Then it is searched in the AmigaDOS path and c: (NOTE: Path
  507.         assigns to C: under Kickstart 2.0 don't work; use 'path')
  508.     9)  Now, the shell path ($_path) is searched. If it's found and 
  509.         executable, it's started. If it has the 's' bit set, it will
  510.         be executed using the appropriate shell. See FOREIGN SHELLS
  511.     10) If there exists a file with the suffix '.sh' and the same root
  512.         in the current directory or in the shell path, it is 'source'd.
  513.     11) Then the variable _rxpath is examined. If there exists a file
  514.         with the suffix '.rexx' and the same root in the current direc-
  515.         tory or in '$_rxpath', 'RX <file>' will be performed.
  516.     12) If all failed, an 'exec' action is sent to the file. See chapter
  517.         XIV for more info on classes and actions.
  518.  
  519.     To enforce that the external 'dir'-command is used, enter 'Dir'. It
  520.     is a good habit to uppercase the first letter of all external com-
  521.     mands, even if this is not necessary.
  522.  
  523.     AUTOMATIC SOURCING may be accomplished by naming shell scripts with
  524.     a  .sh  suffix.   Thus,  if you say 'stuff' and the file 'stuff.sh'
  525.     exists in your current or anywhere in Shell search path (NOTE: won't
  526.     be found in the AmigaDOS path), it will be SOURCED  with all arguments
  527.     you  have given placed  in  the  $_passed variable. This is equivalent
  528.     to typing 'source stuff.sh'
  529.  
  530.     FOREIGN SHELLS are supported through key characters at the beginning
  531.     of their scripts. If a file in $_path has the s-bit set, the first
  532.     few bytes are read. If the first two are either '#!' or ';!', the
  533.     rest of the first line will be interpreted as the name of the shell 
  534.     that is supposed to execute the script. If they are '/*', the command
  535.     'RX' is used, if none of the above, 'c:Execute'.
  536.     Example:
  537.       #!SKsh -c source
  538.  
  539.     WILDCARDS
  540.     Most shell commands will accept multiple arguments that can
  541.     be as a result of wild card expansion.  Also when calling
  542.     an external command shell will first expand any wild cards
  543.     to separate arguments.  If you wish to have the external command
  544.     handle it's own wild carding you will need to insert quotes
  545.     around the special wild card characters or use an alias (see
  546.     explanation of 'alias')
  547.  
  548.     eg.
  549.         arc a new.arc *.txt    - shell will expand and pass to arc
  550.         arc a new.arc "*.txt"    - let arc expand the wild cards.
  551.         alias arc "*a Arc $a"    - now shell will never expand
  552.  
  553.     Wildcards allowed:
  554.  
  555.     ?    match any single character
  556.     *    match any string
  557.     .../*    recursive search down ALL sub directories from current level
  558.     ~    exclude pattern matching specifier
  559.     !    synonym for ~, supported for compatibility
  560.     &    prefixed to patterns, ask confirmation for each file
  561.     []    character class
  562.     ~    the previous current directory (if separated)
  563.     Note that a pattern must contain a '?' or a '*', otherwise the other
  564.     special characters are not recognized. Furthermore, you cannot spe-
  565.     cify a single '?' as a pattern in the first argument to a command,
  566.     as this will be passed on to the command in order to show its usage.
  567.     If pattern.library is present it LIBS:, it will be used for the
  568.     matching.
  569.  
  570.     Examples:
  571.  
  572.     df0:.../*    all files in all directories on df0:
  573.     df0:.../!*.info    full directory tree of df0: but exclude
  574.             any ugly .info files.
  575.     !*.o !*.c    will result in ALL files matching since what
  576.             doesn't match the !*.o will match the !*.c
  577.     df1:&*        all files in root of df1:, but ask 
  578.             confirmation for each
  579.     *.[co]        all files ending in .c or .o
  580.     ~*.[co]        all files NOT ending in .c nor in .o
  581.     ~        the previous current directory
  582.     ~/*.c        all .c files in the previous current directory
  583.     ~//        the parent of the previous current directory
  584.     .        the current directory
  585.     ./foo.c        the same as foo.c
  586.     ..        the parent of the current directory
  587.     ../foo.c    the file foo.c in the parent directory
  588.  
  589.     Note that some commands prevent wild card expansion. These are:
  590.       - dir, rpn, whereis, window
  591.     Those commands will expand the wild cards themselves. This is why
  592.       dir @without( *.? , *.o )
  593.     will not work. Instead use:
  594.       set arg @without( *.? , *.o );dir $arg
  595.  
  596.     There is one exception to the rules given above: A single '?' as
  597.     the first argument will *not* expand in order to allow you to get
  598.     the usage of CLI and csh commands easily.
  599.  
  600.     The   following   symbols  are  not  yet  supported  by  wild  card
  601.     expansions, but are accepted in search -w and @match( ):
  602.  
  603.     ( | )    OR matching
  604.     #    0 or more times the pattern following
  605.  
  606.     Examples:
  607.  
  608.     "k#a"        matches ka, kaa, kaaa, etc.
  609.     "hel(lo|p)"    matches hello or help.
  610.  
  611.  
  612. LIST OF COMMANDS:
  613. -----------------
  614.  
  615.     ABORTLINE
  616.     Usage    : abortline
  617.     Example    : echo a;abort;echo b
  618.     Results    : a
  619.  
  620.     Causes the rest of the line to be aborted. Intended for use in
  621.     conjunction with exception handling.
  622.  
  623.     ACTION
  624.     Usage    : action [-a] actionname file [arguments]
  625.     Example : action extr csh515.lzh csh.doc
  626.  
  627.     Sends an action to a file. See chapter XIV CLASSES
  628.     Options:
  629.      -a (abort) returns 0 if failed and 1 if successful. Otherwise,
  630.                 normal error codes (10 or 11) are returned
  631.  
  632.     ADDBUFFERS
  633.     Usage    : addbuffers drive buffers [drive buffers ...]
  634.     Example    : addbuffers df0: 24
  635.  
  636.     Just like AmigaDOS addbuffer command, causes new buffers to be
  637.     allocated for disk I/O. Each buffer costs 512 bytes of memory,
  638.     CHIP memory if a disk drive.
  639.  
  640.     ALIAS
  641.     Usage    : alias [name [command string] ]
  642.     Example    : alias vt "echo Starting VT100;run sys:tools/vt100"
  643.  
  644.     Sets a name to be a string. You can alias a single name to a set
  645.     of commands if you enclose them in quotes as above. By simply
  646.     typing vt, the command line above would be executed.
  647.     Aliases may call each other, but direct recursion is prohibited,
  648.     so the following works: alias ls "ls -s"
  649.     To prevent alias replacement, enter: \ls
  650.  
  651.     By typing "alias name", you will get the alias for that name, while
  652.     with "alias" you get a list of all alias.
  653.  
  654.     ARGUMENT PASSING TO AN ALIAS:
  655.  
  656.     Usage    : alias name "%var[%var...] [ command_string ]"
  657.           alias name "*var[%var...] [ command_string ]"
  658.     Example    : alias xx "%q%w echo hi $q, you look $w
  659.           xx Steve great today
  660.     Results    : hi Steve, you look great today
  661.  
  662.     The second form of the alias command allows passing of arguments
  663.     to any position within the command string via use of a variable
  664.     name. To pass arguments to the end of a command string this method
  665.     is actually not necessary. These variables are local, so they don't
  666.     destroy another variable with the same name.
  667.     If you specify multiple arguments, every argument will be assigned
  668.     one word, and the last argument will be assigned the rest of the
  669.     command line.
  670.  
  671.     Using a '*' instead of the first '%' prevents wild card expansion:
  672.         alias zoo "*a zoo $a
  673.     To expand the wild cards after you got them, use
  674.         exec set a $a
  675.  
  676.     IMPLICIT ALIASES:
  677.  
  678.     Usage    : {command;command}
  679.           {%var command;command} arg arg
  680.     Example    : {%tmp echo $tmp $tmp} hello    --> hello hello
  681.  
  682.     Curly braces define temporary aliases. They can be redirected as
  683.     a whole, can have arguments and local variables. They count as
  684.     one argument, even if there are blanks inside (as with quotes), and
  685.     they may be nested. Complex alias definitions can use the braces
  686.     instead of quotes, although this will add some calling overhead.
  687.     The closing curly brace is optional if at the end of line.
  688.     Example:
  689.  
  690.     alias assert {e "Are you sure? ";input -s sure
  691.  
  692.     ASCII
  693.     Usage    : ascii
  694.           ascii string
  695.  
  696.     If called without arguments, ascii outputs a complete ASCII table.
  697.     Given a string, shows each character in ASCII. Options:
  698.       -h shows numbers in hexadecimal
  699.       -o shows numbers in octal
  700.  
  701.     ASET
  702.     Usage    : aset name value
  703.     Example    : aset INCLUDE include:
  704.  
  705.     Set a variable in a way that is compatible with ARP/old Aztec set
  706.     command; this is completely different from ENV: Shell variable.
  707.     This is obsolete. Use setenv instead.
  708.  
  709.     ASSIGN
  710.     Usage    : assign
  711.           assign logical
  712.           assign [-lnp] logical1 physical1 [logical2 physical2 ... ]
  713.  
  714.     The first form shows all assigns.
  715.     The second form kills one assign.
  716.     The third form assigns logical1 to physical1 and so on. Options:
  717.      -l creates a late-binding assign under kick 2.0, normal otherwise
  718.      -n creates a non-binding assign under kick 2.0, normal otherwise
  719.      -p creates a path-assign under kick 2.0, cancelled otherwise
  720.     For definition of late/nonbinding, refer to your AmigaDOS manual.
  721.  
  722.     BASENAME
  723.     Usage    : basename var path [path ...]
  724.     Example    : basename x df0:c/Dir    # sets x to "Dir"
  725.  
  726.     Sets var specified to basenames of paths.
  727.  
  728.     CAT
  729.     Usage    : cat [-n][file file....]
  730.     Example    : cat foo.txt
  731.  
  732.     Type the specified files onto the screen.  If no file is specified,
  733.     STDIN in used (note: ^\ is EOF).  CAT is meant to output text files
  734.     only. Specifying -n option you will output numbered lines.
  735.  
  736.     CD
  737.     Usage    : cd [path]
  738.           cd -g device1 [device2 [device3 ...]]
  739.  
  740.     Change your current working directory.  You may specify '..' to go
  741.     back one directory (this is a CD specific feature, and does not
  742.     work with normal path specifications).
  743.  
  744.     In most cases, you'll no more have to use the CD command. Just type
  745.     the desired directory at the prompt (very handy in conjunction with
  746.     file name completion). Typing a ~ alone on a command line cd's
  747.     to previous current directory.
  748.  
  749.     There are two situations left when you still need it:
  750.  
  751.     Entering 'cd *tem' will cd to the first name matched.
  752.  
  753.     The second form generates a list (an ASCII file) of all direc-
  754.     tories on the given devices. It will be stored in the file given
  755.     in $_qcd (default: 'csh:csh-qcd'). Note that this ASCII file will
  756.     not be merged but overwritten. Once you have generated this file,
  757.     you can cd to any directory on your harddisk(s) even if it's not
  758.     in the current directory.
  759.     If you have two directories of the same name and you use one of
  760.     them more, move the more important one to the beginning of the
  761.     qcd file. You might also sort the file.
  762.     It is legal to type just an abbreviation of the directory name
  763.     you want to cd to. No asterisk '*' necessary. If you end up in
  764.     the wrong directory, cd to the same directory again (best done
  765.     by Cursor-Up + RETURN). You will cycle through all directories
  766.     that matched the given abbreviation. The other possibility is to
  767.     specify the full name of the parent directory: cd devs/keym
  768.     You may also add devices and assigns, so if 'PageStream:' is one
  769.     line in the qcd-file, a cd to 'page' is successful.
  770.  
  771.     CD without any arguments displays the path of the directory you
  772.     are currently in.
  773.  
  774.     CLASS
  775.     Usage    : [-n] name {type=param} [ "actions" {action=command} ]
  776.     Example : class zoo offs=20,dca7c4fd ext=.zoo actions view="zoo l"
  777.  
  778.     Defines a new class of files and the actions to be taken on them
  779.     in various cases, or shows old definitions if given no arguments.
  780.     See section XIV: OBJECTS
  781.     Options:
  782.       -n (new)  forgets old definitions
  783.  
  784.  
  785.     CLOSE
  786.     Usage    : close [filenumber]
  787.  
  788.     Close the specified file opened by open. Without filenumber, closes
  789.     all open files. See open and flist for more info.
  790.  
  791.     CLS
  792.     Usage    : cls
  793.  
  794.     This is an alias. It only clears the screen, but also works on a
  795.     terminal (echo ^L doesn't).
  796.  
  797.     COPY
  798.     Usage    : copy [-udfpm]  file file
  799.     or    : copy [-udfpm]  file1 file2...fileN dir
  800.     or    : copy [-rudfp] dir1...dirN file1...fileN dir
  801.  
  802.     Options    :
  803.      -r recursive, copy all subdirectories as well.
  804.      -u update, if newer version exists on dest, don't copy
  805.      -f freshen, if file doesn't exist on dest or newer, don't copy
  806.      -q suppresses 'not newer' and 'not there' messages in -u and -f
  807.      -d don't set destination file date to that of source.
  808.      -p don't set destination protection bits to those of source.
  809.      -m erases the original. does not work with -r
  810.      -o overwrites write/delete-protected, reads read-protected
  811.  
  812.     Example    : copy -r df0: df1:
  813.  
  814.     Copy files or directories. When copying directories, the -r option
  815.     must be specified to copy subdirectories as well.  Otherwise, only
  816.     top level files in the source directory are copied.
  817.  
  818.     All files will be displayed as they are copied and directory's
  819.     displayed as they are created. This output can be suppressed by
  820.     redirecting to nil: eg. copy -r >nil: df0: df1:
  821.  
  822.     Copy will abort after current file on Control-C.
  823.  
  824.     Copy by default sets the date of the destination file to that of
  825.     the source file. To overide this feature use the -d switch.
  826.  
  827.     Similarly, it sets protection bits (flags) to those of source and
  828.     any file comment will be copied. To avoid this use -p. The archive
  829.     bit is always cleared.
  830.  
  831.     Another useful option is the -u (update) mode where copy will not
  832.     copy any files which exists already in the destination directory
  833.     if the destination file is newer or equal to the source file.
  834.     This is useful when developing code say in ram: eg. 'copy *.c ram:'
  835.     when done you can copy -u ram: df1: and only those modules you have
  836.     modified will be copied back.
  837.  
  838.     Copy command will now create the destination directory if it does
  839.     not exist when specified as 'copy [-r] dir dir'. If you specify
  840.     copy file file file dir, then 'dir' must already exist.
  841.  
  842.     CP
  843.     Equivalent to copy.
  844.  
  845.     DATE
  846.     Usage    : date [-sr] [new date and/or time]
  847.     Example    : date Wednesday  # this refers to NEXT wed, of course
  848.  
  849.     Options:
  850.       -s stores the current time internally
  851.       -r shows time relative to last stored in secs and hundredths
  852.  
  853.     Used to read or set system date and/or time. All standard options
  854.     may be used (yesterday, tomorrow, monday, etc.).
  855.     Leading zero's are not necessary.
  856.     Without parameters shows Dddddd DD-MMM-YY HH:MM:SS.
  857.  
  858.     DEC
  859.     Usage    : dec varname [value]
  860.     Example    : dec abc
  861.  
  862.     Decrement the numerical equivalent of the variable with specified
  863.     value (default: 1) and place the ASCII-string result back into
  864.     that variable.
  865.  
  866.     DELETE
  867.     Usage    : delete [-p][-r][-q] file file file...
  868.     Example    : delete foo.txt test.c
  869.  
  870.     Remove (delete) the specified files.  Remove always returns
  871.     errorcode 0.  You can remove empty directories.  The '-r' option
  872.     will remove non-empty directories by recursively removing all sub
  873.     directories.
  874.     You can remove delete-protected files specifying -p option.
  875.     If you specify any wildcard deletes the files will be listed as
  876.     they are deleted. This can be suppressed by redirecting to nil:
  877.     If you specify -q, no error message will be supplied if the file
  878.     to be removed didn't exist or couldn't be deleted.
  879.  
  880.     DIR
  881.     Usage    : dir [-abcdfhiklnoqstuv] [-z lformat] [path path ... ]
  882.     Example    : dir -ts downloads:
  883.           dir -lz "%7s %-.16n %m" *.c
  884.     Options:
  885.      -d list directories only
  886.      -f list files only
  887.      -h list only files which not start with a dot, end with '.info' or
  888.         have the h-flag set. Adds an 'i' bit to the flags which tells
  889.         if an according .info file exists.
  890.      -s short multi(4) column display.
  891.      -c don't change colors for directories
  892.      -q quiet display. does not show length in blocks
  893.      -o display file nOtes
  894.      -n display names only
  895.      -p display full path names and suppress directory titles
  896.      -a shows the age of all files in the format  days hours:minutes
  897.      -i identifies every file, shows the type instead of the date.
  898.         See chapter XIV CLASSES
  899.      -v (viewdir) recursively sums up lengths of the files in a dir
  900.      -l sorts the files by their length, longest first.
  901.      -t sorts the files by their time, most recent first.
  902.      -k sorts the files by their class (klass)
  903.      -b sorts the files backwards.
  904.      -g prints directories at the beGinning
  905.      -e prints directories at the End
  906.      -u must be given exactly two directories. Shows files only in
  907.         the first directory, files in both and files in the second.
  908.      -z custom format
  909.  
  910.     Displays a directory of specified files. Default output shows
  911.     date, protection, block size, byte size and total space used.
  912.     Protections flags include new 1.2/1.3 flags (see under protect),
  913.     plus a 'c' flag which indicates that this file has a comment.
  914.     Files are alphabetically sorted, without case sensitivity, and
  915.     directories are in red pen (unless you use -c). Dir takes in
  916.     account the width of your window.
  917.  
  918.     The lformat string is used to create your own directory format.
  919.     It will override all else and may contain the following codes:
  920.      %a age               %l LF if comment      %t time
  921.      %b size in blocks    %m multi column       %u size in K
  922.      %c flag c (comment)  %n name               %v dir size in eng.
  923.      %d date              %o filenote (comment) %w dir size in K
  924.      %e flag i (.info)    %p name w/ path       %x translated date
  925.      %f flags hsparwed    %q name w/ slash      %+ flag i as '+' or ' '
  926.      %i flag d (dIr)      %r size in eng.
  927.      %k class             %s size
  928.  
  929.     Between the '%' and the identifying letter, there may be an optional
  930.     field width. If the number is preceded by a '-', the field contents
  931.     will be left adjusted. If by a dot, the contents will be cut down
  932.     to match the field width if they are longer.
  933.     If the format string contains a %m, cshell will try to print more
  934.     than one entry on one line. The column width is the field width of
  935.     the %m entry. If omitted, it's assumed to be the one of the first 
  936.     file. If a file is longer, it will use two columns.
  937.  
  938.     DISKCHANGE
  939.     Usage    : diskchange drive
  940.  
  941.     Like AmigaDOS diskchange.
  942.  
  943.     ECHO
  944.     Usage    : echo [-en] string
  945.     Example    : echo hi there
  946.     Results    : hi there
  947.  
  948.     Echo the string given. If -n switch given no newline is
  949.     appended. If -e is on, echo to stderr.
  950.  
  951.     ELSE
  952.     Usage    : else ; command
  953.     Usage    : if -f foo.c ; else ; echo "Not there" ; endif
  954.  
  955.     Else clause, must follow an IF statement.
  956.  
  957.     ENDIF
  958.     Usage    : endif
  959.  
  960.     The end of an if statement.
  961.  
  962.     Note: if you return from a script file with unterminated IF's
  963.     and the last IF was false, prompt will be changed to an
  964.     underscore ('_') and no commands will be executed until
  965.     'endif' is typed.
  966.  
  967.     ERROR
  968.     Usage    : error n
  969.  
  970.     Generates return code n.
  971.  
  972.     EXEC
  973.     Usage    : exec [-i] command [args]
  974.     Example    : set cmdline "dir ram:"
  975.           exec $cmdline        # would not work without exec
  976.  
  977.     Execute the command specified; exec command is equivalent to
  978.     command, only you can use variables to specify command name.
  979.     Note that the command line is parsed TWICE! Examples:
  980.      set a dir ram:; exec $a              # right
  981.      set a mkdir; exec $a "My directory"  # wrong! creates 2 directories
  982.  
  983.     Exec returns the return code of the command executed unless option -i
  984.     (ignore) is set, in which case always 0 is returned.
  985.  
  986.     FAULT
  987.     Usage    : fault error1 .. errorN
  988.     Example    : fault 205 212
  989.  
  990.     Like AmigaDOS fault, prints specified error messages.
  991.  
  992.     FILENOTE
  993.     Usage    : filenote file1 .. fileN  note
  994.           filenote -s file1...fileN
  995.  
  996.     The first form sets AmigaDOS comment of the specified file.
  997.     The second form displays the file notes of the given files.
  998.  
  999.     FLIST
  1000.     Usage    : flist
  1001.  
  1002.     Lists the filenumbers of files opened by open.
  1003.     See open and close for more info.
  1004.  
  1005.     FLTLOWER
  1006.     Usage    : fltlower
  1007.     Example    : dir | fltlower
  1008.     Or    : fltlower <readme
  1009.  
  1010.     This is a filter command, i.e. it reads from stdin and writes to
  1011.     stdout. The more natural way to use it is a pipe, or it can be
  1012.     redirected.
  1013.     Its purpose is to convert all alphabetic to lower case.
  1014.  
  1015.     FLTUPPER
  1016.     The same of fltlower, only this converts to upper case.
  1017.  
  1018.     FOREACH
  1019.     Usage    : foreach [-v] varname ( strings ) command
  1020.     Example    : foreach i ( a b c d ) "echo -n $i;echo \" ha\""
  1021.     Result    : a ha
  1022.           b ha
  1023.           c ha
  1024.           d ha
  1025.  
  1026.     'strings' is broken up into arguments.  Each argument is placed in
  1027.     the local variable 'varname' in turn and 'command' executed. Put
  1028.     the command(s) in quotes.
  1029.  
  1030.     Foreach is especially useful when interpreting passed arguments in
  1031.     an alias.
  1032.  
  1033.     eg.
  1034.         foreach i ( *.pic ) viewilbm $i
  1035.     assuming a.pic and b.pic in current directory the following commands
  1036.     will occur:
  1037.         viewilbm a.pic
  1038.         viewilbm b.pic
  1039.  
  1040.     Flag -v causes arguments to be displayed every time command is
  1041.     executed. All 'for...' commands can be interrupted using CTRL-D.
  1042.  
  1043.     FOREVER
  1044.     Usage    : forever command
  1045.     or    : forever "command;command;command..."
  1046.  
  1047.     The specified commands are executed over and over again forever.
  1048.  
  1049.     Execution stops if you hit ^C or ^D, or if the commands return with
  1050.     an error code.
  1051.  
  1052.     FORLINE
  1053.     Usage    : forline var filename command
  1054.     or    : forline var filename "command;command..."
  1055.     Example    : forline i RAM:temp "echo line $_linenum=$i"
  1056.  
  1057.     For each ASCII line of file specified commands are executed and
  1058.     var points to line content. You can check system variable _linenum
  1059.     to find the number of the line currently read.
  1060.     If STDIN (case sensitive) is specified as input file, the lines are
  1061.     read from standard input.
  1062.  
  1063.     FORNUM
  1064.     Usage    : fornum [-v] var n1 n2 command
  1065.     or    : fornum [-v] -s var n1 n2 step command
  1066.     Example    : fornum -v x 1 10 echo $x
  1067.     or    : fornum -s x 10 1 -1 echo $x # counts backwards
  1068.  
  1069.     Executes  command(s)  for  all numerical values of x between n1 and
  1070.     n2.   If  more  than  one  command  is  specified,  or  command  is
  1071.     redirected, include command(s) in quotes.
  1072.     Switch -v (verbose) causes printing of progressive numbers.
  1073.     Switch  -s  allows  you to specify a step; if this is negative, the
  1074.     count will be backwards.
  1075.  
  1076.     GETENV
  1077.     Usage    : getenv [shellvar] envvar
  1078.  
  1079.     Gets the value of an ARP or ENV: variable (ARP list searched first)
  1080.     and stores it in the shell variable 'shellvar'. If shellvar is
  1081.     omitted, the value of the ENV: variable is printed to stdout.
  1082.     This command is obsolete since ENV: variables can be retrieved
  1083.     by writing $envvar anywhere on the command line.
  1084.  
  1085.     GOTO
  1086.     Usage    : goto label
  1087.     Example    :
  1088.           label start
  1089.             echo "At start"
  1090.             dir ram:
  1091.             goto start
  1092.  
  1093.     Goto  the specified label name.  You can only use this command from
  1094.     a  source  file.   Labels  may  be  forward or reverse from current
  1095.     position. It is legal to jump out of if's.
  1096.  
  1097.     HEAD
  1098.     Usage    : head filename [num]
  1099.     Example    : head readme 20
  1100.  
  1101.     Display  first "num" lines of "filename".  If num is not specified,
  1102.     10 is assumed.
  1103.  
  1104.     HELP
  1105.     Usage    : help
  1106.     Example    : help
  1107.  
  1108.     Simply  displays  all  the  available  commands.   The commands are
  1109.     displayed in search-order.  That is, if you give a partial name the
  1110.     first  command  that  matches  that  name  in  this list is the one
  1111.     executed.   Generally,  you  should  specify enough of a command so
  1112.     that it is completely unique.
  1113.  
  1114.     HISTORY
  1115.     Usage    : history [-nr] [partial_string]
  1116.     Example    : history
  1117.     Options    :
  1118.      -n omits line numbering
  1119.      -r reads history from stdin
  1120.  
  1121.     Displays  the  enumerated  history  list.   The size of the list is
  1122.     controlled  by  the  _history  variable.   If you specify a partial
  1123.     string, only those entries matching that string are displayed.
  1124.  
  1125.     HOWMANY
  1126.     Usage    : howmany
  1127.  
  1128.     This  command  tells you how many instances of Shell are running in
  1129.     your system.
  1130.  
  1131.     HTYPE
  1132.     Usage    : htype [-r] file1 .. filen
  1133.  
  1134.     Displays the specified files in hex and ASCII, just like the system
  1135.     command 'Type file opt h'.  Especially suitable for binary files.
  1136.     If -r is specified, htype displays all files in a directories.
  1137.  
  1138.     IF
  1139.     Usage    : if [-n] argument conditional argument [then]
  1140.     or    : if [-n] argument
  1141.     or    : if [-n] -f file    or   -e file
  1142.     or    : if [-n] -d file/dir
  1143.     or    : if [-n] -m
  1144.     or    : if [-n] -t file file1 .. fileN
  1145.     or    : if [-n] -r rpnexpression
  1146.     or    : if [-n] -v varname
  1147.     or    : if [-n] -o char arg ... arg
  1148.  
  1149.     Makes the following instructions up to the next endif conditinal.
  1150.     The 'then' is optional. The if clause must be followed by a semi-
  1151.     colon if instructions follow on the same line.
  1152.  
  1153.     If a single argument is something to another argument.  Conditional
  1154.     clauses allowed:
  1155.  
  1156.     <, >, =, ! and combinations.  Thus != is not-equal, >= larger or 
  1157.     equal, etc...
  1158.  
  1159.     If arguments are not numeric, they are compared as strings.
  1160.  
  1161.     Usually the argument is either a constant or a variable ($varname).
  1162.  
  1163.     The second form if IF is conditional on the existence of the argument.
  1164.     If the argument is a "" string, then FALSE, else TRUE.
  1165.  
  1166.     The third form of IF used by -f switch checks for existance of
  1167.     the specified file. -e is the same as -f
  1168.  
  1169.     Switch -d tests the type of the object specified: if it is a
  1170.     directory, then TRUE; if it is a file (or it doesn't exist)
  1171.     then FALSE.
  1172.  
  1173.     Switch -m is used to test if FAST memory is present.
  1174.     Example (to be included in a login.sh file):
  1175.     if -m; resident -d lc1 lc2 blink; endif
  1176.  
  1177.     Using -t form compares the date and time of the first file with
  1178.     all the others; if the first is younger than ALL the others, then
  1179.     FALSE, else TRUE. If a file doesn't exists, it is considered as
  1180.     being older.
  1181.     This feature is especially useful for building makefiles without
  1182.     using any MAKE utility.
  1183.     Example:
  1184.     if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif
  1185.  
  1186.     Option -r evaluates a given RPN expression (see under RPN for more
  1187.     info): if value on top of stack is 0, then FALSE, else TRUE.
  1188.  
  1189.     Option -o tests for option 'char' in the rest of the arguments.
  1190.     Example: if -o r -rp ram:comm1.c     will yield TRUE.
  1191.  
  1192.     Switch -n (NOT) reverses the result.
  1193.  
  1194.     To test if a given variable is defined, use if -v varname.
  1195.  
  1196.     When using 'IF' command interactively if you are entering commands
  1197.     following an 'IF' that was false, the prompt will be set to a
  1198.     underscore '_ ' to indicate all commands will be ignored until
  1199.     an 'ELSE' or 'ENDIF' command is seen.
  1200.  
  1201.     INC
  1202.     Usage    : inc varname [value]
  1203.     Example    : inc abc 5
  1204.  
  1205.     Increment the numerical equivalent of the variable with specified
  1206.     value (default: 1) and place the ASCII-string result back into
  1207.     that variable.
  1208.  
  1209.     INFO
  1210.     Usage    : info [path1 path2 ... pathN]
  1211.  
  1212.     If called without arguments, info gives you the drive information
  1213.     on all devices. If one or more paths are specified, only infor-
  1214.     mation on those drives will be displayed.
  1215.  
  1216.     INPUT
  1217.     Usage    : input [-s] var var ... var
  1218.     Example    : input abc
  1219.  
  1220.     Input from STDIN (or a redirection, or a pipe) to a variable.  The
  1221.     next input line is broken up in words (unless quoted) and placed in
  1222.     the variable. If -s is turned on, the whole line is read in as one
  1223.     word, including spaces. -r puts the console to single character mode
  1224.     before reading (ie. does not wait for RETURN to be pressed). Use
  1225.     this with care.
  1226.  
  1227.     JOIN
  1228.     Usage    : join [-r] file1..fileN destfile
  1229.     Example    : join part1 part2 part3 total
  1230.  
  1231.     Joins the specified files to get destfile. If destfile already
  1232.     exists, an error message is generated and operation is aborted,
  1233.     unless you specify -r (replace) option.
  1234.  
  1235.     KEYMAP
  1236.     Usage    : keymap [number {key=function}]
  1237.     Example    : keymap 0 1030=4 1032=12
  1238.  
  1239.     Defines one keymap for the csh command line editing. See chapter XV.
  1240.  
  1241.     LABEL
  1242.     Usage    : label name
  1243.  
  1244.     Create a program label right here. Used in source files, you can
  1245.     then GOTO a label.
  1246.  
  1247.     LINECNT
  1248.     Another filter. Counts the number of lines of its stdin and writes
  1249.     it to stdout.
  1250.  
  1251.     LOCAL
  1252.     Usage: local [var...var]
  1253.  
  1254.     Creates one or more local variables. Those variables disappear
  1255.     at the end of their alias or source file, and cannot be accessed
  1256.     from inside other aliases or source files.
  1257.     With no arguments, shows all top level variables and their values.
  1258.  
  1259.     LS
  1260.     Equivalent to dir.
  1261.  
  1262.     MD
  1263.     Equivalent to mkdir.
  1264.  
  1265.     MAN
  1266.     Usage    : man command(s)
  1267.     Example    : man mkdir
  1268.  
  1269.     Get  info about a Shell command, or others keywords.  These include
  1270.     all  special  _variables, plus various keywords:  WILDCARDS, PIPES,
  1271.     EDITING, STARTUP and more.
  1272.     See special alias manlist to get a list of ALL keywords supported
  1273.     by man.
  1274.     You  must set _man to the paths of your .doc files:
  1275.        set _man dh1:docs/aliases.doc dh1:docs/csh.doc
  1276.  
  1277.     To create your own .doc files, precede all your keywords by four
  1278.     blanks. 'man' will then display lines until the first character
  1279.     of a line is alphanumeric or has four leading blanks.
  1280.  
  1281.     MEM
  1282.     Usage    : mem [-cfqu]
  1283.  
  1284.     Options:
  1285.       -c shows the free chip mem only
  1286.       -f shows the free fast mem only
  1287.       -q outputs just a number without titles
  1288.       -s stores current free memory
  1289.       -r shows memory used relative to last stored 
  1290.       -l flushes all unneeded memory
  1291.  
  1292.     MENU
  1293.     Usage    : menu [-n] [ title item...item ]
  1294.     Example    : menu Shell   JrComm,,j   Rename,"rename ",r  quit
  1295.  
  1296.     Appends one pull down in the current console window. Up to six
  1297.     menus with 16 items every can be installed.
  1298.  
  1299.     If the item is just a string, that string will be in the menu item.
  1300.     When you select it, it will be put into the prompt and executed.
  1301.  
  1302.     If there is a comma and after that comma a second string, this
  1303.     will be the command will be inserted at the prompt. This time you
  1304.     have to add the ^M yourself if you want the command to be executed.
  1305.  
  1306.     If there is a second comma, the letter after that comma will be
  1307.     the keyboard shortcut for that menu item. (This will be case 
  1308.     sensitive some day, use lowercase).
  1309.  
  1310.     If for any reason your current menu is corrupt, just enter an
  1311.     empty 'menu' command.
  1312.  
  1313.     To clear all existing menus use option -n.
  1314.  
  1315.     MKDIR
  1316.     Usage    : mkdir name name name...
  1317.     Example    : mkdir df0:stuff
  1318.  
  1319.     Create the specified directories.
  1320.  
  1321.     MV
  1322.     Equivalent to rename.
  1323.  
  1324.     OPEN
  1325.     Usage    : open filename filemode filenumber
  1326.     Example    : open RAM:data w 1
  1327.  
  1328.     This  allows you to open a file, redirect to it as many commands as
  1329.     you like, then close it.
  1330.     Filename is any valid AmigaDOS filename, filemode is either "r" for
  1331.     read or "w" for write, filenumber is a number between 1 and 10.
  1332.     To  redirect  a  program to or from an open file, use as your redir
  1333.     filename a dot followed by the filenumber.
  1334.     Here is a complete example:
  1335.  
  1336.         open RAM:data w 1
  1337.         echo -n 2+2= >.1
  1338.         rpn 2 2 + . CR >.1
  1339.         close 1
  1340.         type RAM:data    # will display 2+2=4
  1341.  
  1342.     See also close, flist.
  1343.  
  1344.     PATH
  1345.     Usage    : path [-r] [dir...dir]
  1346.  
  1347.     Without arguments, lists AmigaDOS path. Otherwise adds given directories
  1348.     to the path, preventing duplicate entries.
  1349.     Options:
  1350.      -r Resets the path
  1351.  
  1352.     PRI
  1353.     Usage    : pri clinumber pri
  1354.     Example    : pri 3 5    # set priority of cli #3 to 5
  1355.  
  1356.     Change the priority of the specified task (use PS command to
  1357.     determine clinumber). If you specify 0 as clinumber you can
  1358.     change priority of "this" task (the one executing shell).
  1359.  
  1360.     PROTECT
  1361.     Usage    : protect file1 ... filen [+|-|=][flags]
  1362.     Example    : protect myfile +rwe
  1363.  
  1364.     Set AMIGADOS file protection flags for the file specified. Valid
  1365.     flags are h, s, p, a, r, w, e, d. x ist the same as e. Modes:
  1366.       +  Set specified bits, leave all others
  1367.       -  Clear specified bits, leave all others
  1368.       =  Set specified bits, clear all others
  1369.     Specifying no mode is equal to '='. Archive bit cleared by default.
  1370.  
  1371.     PS
  1372.     Usage    : ps [commandname...commandname]
  1373.  
  1374.     Gives status of CLI processes.  eg:
  1375.  
  1376.     Proc Command Name        CLI Type    Pri.  Address  Directory
  1377.     * 1  csh            Initial CLI   0      97b0  Stuff:shell
  1378.       2  clock            Background  -10    2101a8  Workdisk:
  1379.       3  emacs            Background    0    212f58  Stuff:shell
  1380.       4  VT100            Background    0    227328  Workdisk:
  1381.  
  1382.     Address is the address of the task, directory is the process
  1383.     currently CD'd directory. My default, only the BaseNames of
  1384.     the commands are shown. Your own CLI will be marked by an
  1385.     asterisk in the first column.
  1386.     Options:
  1387.      -l shows full pathnames of commands
  1388.      -e excludes the given command names from the list
  1389.  
  1390.     PWD
  1391.     Usage    : pwd
  1392.  
  1393.     Rebuild _cwd by backtracing from your current directory.
  1394.  
  1395.     QSORT
  1396.     Usage   : qsort [-r] <in >out
  1397.  
  1398.     Quick sorts from stdin to stdout. -r causes reverse sorting.
  1399.  
  1400.     QUIT
  1401.     Usage    : quit
  1402.  
  1403.     Quit out of Shell back to CLI.
  1404.  
  1405.     RBACK
  1406.     Usage    : rback command
  1407.  
  1408.     Start a new process executing the specified command, but can't do
  1409.     input/output. Equivalent to 'run command >NIL: <NIL:'. Instead of
  1410.     using rback, you can add a '&' at the end of the command line. The
  1411.     variable Under 1.3, $_newproc will hold the cli number of the newly 
  1412.     created process.
  1413.     Note: rback cannot start builtin commands. You have to start a
  1414.           subshell: rback csh -c "copy ram:temp prt:;rm ram:temp
  1415.  
  1416.     READFILE
  1417.     Usage    : readfile varname [filename]
  1418.  
  1419.     Completely reads an ASCII file and assigns it to a variable. Each
  1420.     line becomes one word in the resulting string. Embedded blanks
  1421.     are no problem. If file name is omitted, stdin is used. See also
  1422.     'writefile', @subfile and @flines
  1423.  
  1424.     RENAME
  1425.     Usage    : rename from to
  1426.     or    : rename from from from ... from todir
  1427.  
  1428.     Allows you to rename a file or move it around within a disk.
  1429.     Allows you to move 1 or more files into a single directory.
  1430.     The archive bit of the file(s) will be cleared.
  1431.  
  1432.     RESIDENT
  1433.     Usage    : resident [-r][-d] [files]
  1434.     Example    : resident lc1 lc2 blink    # load these as resident
  1435.           resident -d lc1 lc2 blink    # defer load when needed
  1436.           resident -r lc1 lc2 blink    # remove these
  1437.           resident            # list resident programs
  1438.  
  1439.     This is ARP resident. Commands are searched by Shell in resident
  1440.     list BEFORE of searching on any external device.
  1441.     Only PURE programs can run as resident, see ARP docs for more info.
  1442.     Option -d is very useful: you can say, in your startup file,
  1443.     resident -d file...file; programs will not be loaded immediately,
  1444.     but only when you will try to load them. This way, you will not
  1445.     waste memory and startup time if you don't use the programs.
  1446.     Old option -a has no more effect.
  1447.  
  1448.     RETURN
  1449.     Usage    : return [n]
  1450.     Example    : return 10
  1451.  
  1452.     Exit from a script file, or quit from shell with optional
  1453.     exit code.
  1454.  
  1455.     RM
  1456.     Equivalent to delete.
  1457.  
  1458.     RPN
  1459.     Usage    : rpn expression
  1460.     Example    : rpn 3 7 *    # Prints the value 21
  1461.  
  1462.     Evaluate an RPN expression, using 32-bit values. In older versions
  1463.     of Shell RPN contained string functions too, but now that strings
  1464.     are handled by specifical commands, these are no more needed.
  1465.     At end of evaluation, RPN prints values on stack, so you can
  1466.     say for instance "rpn $x 2 * | input x" to double the value of
  1467.     variable x.
  1468.     Functions implemented are:
  1469.  
  1470.         + - * /    Obvious meaning; / means integer division, of course
  1471.         %        Module operator e.g. "rpn 7 3 %" answers 1
  1472.         & | ~    Bitwise and, or, not operators
  1473.         > < ==    Tests for greater-than, lower-than, equal. To get
  1474.             a test for >= (or <=), you can use < ! (or > !)
  1475.         !        Logical not operator
  1476.         DUP        Duplicate value on top of stack
  1477.         DROP    Drop value on top of stack
  1478.         SWAP    Swap two values on top of stack
  1479.  
  1480.     To avoid confusion with redirections, > and < operators must be
  1481.     enclosed in quotes e.g.
  1482.  
  1483.         3 2 ">"        # Prints 1
  1484.  
  1485.     RUN
  1486.     Usage    : run prgm args
  1487.     Example    : run emacs test.c
  1488.  
  1489.     Start a new process executing the specified command. This command is not
  1490.     fully reliable: use at your own risk. Under 1.3, $_newproc will hold the 
  1491.     cli number of the new process. See also rback.
  1492.  
  1493.     RXREC
  1494.     Usage    : rxrec [portname]
  1495.  
  1496.     Create an AREXX-compatible port of the specified name (defaults to
  1497.     "rexx_csh"), then puts Shell to sleep waiting for messages on it.
  1498.  
  1499.     CAUTION: the only way to exit from this status is to send to the port
  1500.     the message "bye".
  1501.  
  1502.     Example:
  1503.     Open two Shell's in two separate CLI's. From the first, type:
  1504.  
  1505.         rxrec
  1506.  
  1507.     Now first Shell doesn't respond to keyboard input; instead, it waits
  1508.     for messages on a port called "rexx_csh". Now, from the other, type:
  1509.  
  1510.         rxsend rexx_csh "dir df0:"
  1511.  
  1512.     You will see the listing of df0: in the first Shell. Experiment as you
  1513.     like, then:
  1514.  
  1515.         rxsend rexx_csh bye
  1516.  
  1517.     And all will return to normal.
  1518.  
  1519.     RXSEND
  1520.     Usage    : rxsend [-lr] portname command...command
  1521.  
  1522.     Send commands to any program with an AREXX-compatible port. Be aware
  1523.     that every word is sent as a single command!
  1524.  
  1525.     You don't have to load anything to use these command (or rxrec):
  1526.     all you need is a program with the right port.
  1527.  
  1528.     An example is CygnusEdProfessional: here is, for instance, a command
  1529.     to wake it up, load the file test.c and jump to line 20:
  1530.  
  1531.         rxsend rexx_ced cedtofront "open test.c" "jmp to line 20"
  1532.         # rexx_ced is the name of AREXX port for CygnusEd
  1533.  
  1534.     The option -r sets the variable _result to the result string
  1535.     of the AREXX command.
  1536.     The option -l send the whole line as *one* command.
  1537.  
  1538.     Refer to your application manual for details and for the names
  1539.     of the commands and the port.
  1540.  
  1541.     SEARCH
  1542.     Usage    : search [-abcefnqrvw] file...file string
  1543.  
  1544.     Search specified files for a string. Only lines containing the
  1545.     specified strings are displayed.
  1546.  
  1547.     If the filename is STDIN (in uppercase), the standard input is
  1548.     used, so you can use search as the destination for a pipe.
  1549.     Example:
  1550.         strings myprog * | search STDIN .library
  1551.     Lists all libraries used in "myprog".
  1552.  
  1553.     Search is very fast if none of the options -w, -e and STDIN was
  1554.     specified and the file fits into memory.
  1555.  
  1556.     Options:
  1557.       -a (abort)   stops search as soon as the pattern was found once
  1558.       -b (binary)  shows only byte offsets instead of lines. If combined
  1559.                    with -n, shows naked numbers. 
  1560.       -c (case)    turns ON case sensitivity
  1561.       -e (exclude) lists lines NOT containing the pattern
  1562.       -f (files)   causes only the names of the files in which the pat-
  1563.                    tern was found to be displayed.
  1564.       -l (left)    pattern must be at beginning of line (this is faster
  1565.                    than using a wild card)
  1566.       -n (number)  turns off line numbering
  1567.       -o (only)    finds only whole words
  1568.       -q (quiet)   suppresses printing of file names.
  1569.       -r (recurse) if you specify any directory, all files in that di-
  1570.                    rectory are recursively searched.
  1571.       -v (verbose) shows each file name on a single line. this is auto-
  1572.                    matically turned on if search is redirected
  1573.       -w (wild)    wild card matching. see notes below
  1574.  
  1575.     Notes to wild card matching;
  1576.     - Uses Shell standard matching.
  1577.     - All standard ARP wildcards are allowed * ? [] () | ~ ' #
  1578.     - The WHOLE line must match the string, not only a substring.
  1579.     - String MUST be enclosed in quotes to avoid wildcard expansion
  1580.  
  1581.     Examples:
  1582.         search -cr df0:include ACCESS
  1583.     Find all occurrences of ACCESS (in uppercase) in all files
  1584.     contained in include directory.
  1585.         search -w shell.h "'#define*"
  1586.     Lists only lines of file beginning with (not simply containing)
  1587.     #define. Note the use of ' to escape the special symbol #.
  1588.  
  1589.     SET
  1590.     Usage    : set [name] [=] [string]
  1591.     Example    : set abc hello
  1592.  
  1593.     Set with no args lists all current variable settings.
  1594.     Set with one arg lists the setting for that particular variable.
  1595.     Specifying name and string, stores the string into variable name.
  1596.  
  1597.     Also see the section on special _variables.
  1598.  
  1599.     SETENV
  1600.     Usage    : setenv envvar value
  1601.  
  1602.     Sets an ENV: variable to the given value. The value must be
  1603.     enclosed in quotes if it contains spaces. To retrieve an ENV:
  1604.     variable, just use $envvar anywhere on a command line.
  1605.  
  1606.     SLEEP
  1607.     Usage    : sleep timeout
  1608.     Example    : sleep 10
  1609.  
  1610.     Sleep for 'timeout' seconds, or until ^C typed.
  1611.  
  1612.     SPLIT
  1613.     Usage    : split srcvar dstvar...dstvar
  1614.  
  1615.     Assigns one word of srcvar to every dstvar, the rest of srcvar to
  1616.     the last dstvar.
  1617.     Note: You enter variable NAMES, not variables.
  1618.  
  1619.     STACK
  1620.     Usage    : stack [number]
  1621.     Example    : stack 8000
  1622.  
  1623.     Changes the default stack for this CLI. Without arguments, prints
  1624.     it.
  1625.  
  1626.     STRHEAD
  1627.     Usage    : strhead varname breakchar string
  1628.     Example    : strhead x . foobar.bas    # Will set x to "foobar"
  1629.  
  1630.     Remove everything after and including the breakchar in 'string' and
  1631.     place in variable 'varname'.
  1632.  
  1633.     STRINGS
  1634.     Usage    : strings file1..fileN minlength
  1635.     Example    : strings c:dir c:list shell 7
  1636.  
  1637.     Prints strings contained in specified files (usually binary)
  1638.     with length >= minlength.
  1639.  
  1640.     STRLEFT
  1641.     Usage    : strleft varname string n
  1642.     Example    : strleft x LongString 5    # Will set x to "LongS"
  1643.  
  1644.     Place leftmost n chars of string in variable varname.
  1645.  
  1646.     STRLEN
  1647.     Usage    : strlen varname string
  1648.     Example    : strlen x Hello        # Will set x to "5"
  1649.  
  1650.     Puts len of string in variable varname.
  1651.  
  1652.     STRMID
  1653.     Usage    : strmid varname string n1 [n2]
  1654.     Example    : strmid x LongString 5 3    # Will set x to "Str"
  1655.  
  1656.     Places n2 chars from string, starting at n1, in variable varname.
  1657.     By omitting n2, you get all chars from n1 to end of string.
  1658.  
  1659.     STRRIGHT
  1660.     Usage    : strright varname string n
  1661.     Example    : strright x LongString 5    # Will set x to "tring"
  1662.  
  1663.     Place rightmost n chars of string in variable varname.
  1664.  
  1665.     STRTAIL
  1666.     Usage    : strtail varname breakchar string
  1667.     Example    : strtail x . foobar.bas    # Will set x to "bas"
  1668.  
  1669.     Remove everything before and including the breakchar in 'string' and
  1670.     place in variable 'varname'.
  1671.  
  1672.     SOURCE
  1673.     Usage    : source file [arguments]
  1674.     Example    : source mymake.sh all
  1675.     Result    : batch file 'mymake.sh' called with var _passed = 'all'
  1676.  
  1677.     Execute commands from a file.  You can create SHELL programs in
  1678.     a file and then execute them with this command.  Source'd files
  1679.     have the added advantage that you can have loops in your command
  1680.     files (see GOTO and LABEL).  You can pass SOURCE files arguments
  1681.     by specifying arguments after the file name.  Arguments are passed
  1682.     via the _passed variable (as a single string, a set of words).
  1683.     See _failat variable for script aborting.
  1684.  
  1685.     Long lines may be split by appending a backslash (\) at end of
  1686.     first part. One single line must be shorter than 512 bytes, but
  1687.     the concatenated line can be as long as you want. There is no 
  1688.     limit on the length of the concatenated line.
  1689.  
  1690.     Automatic 'sourcing' is accomplished by appending a .sh suffix to
  1691.     the file (no need to set the s-bit) and executing it as you would 
  1692.     a C program:
  1693.  
  1694.     --------- file hello.sh ---------
  1695.     foreach i ( $_passed ) "echo yo $i"
  1696.     ---------------------------------
  1697.  
  1698.     $ hello a b c
  1699.     yo a
  1700.     yo b
  1701.     yo c
  1702.  
  1703.     If the last character of a line in a source file is '{', all
  1704.     following lines will appended to the current one and separated
  1705.     by semicolons until the last character of a line is '}'. Those 
  1706.     blocks may be nested. You may use comments and unterminated 
  1707.     strings within.
  1708.  
  1709.     --------- file login.sh ---------
  1710.     alias complex {
  1711.       echo -n "this alias
  1712.       echo " works!"
  1713.     }
  1714.     ---------------------------------
  1715.  
  1716.     $ login
  1717.     $ complex
  1718.     this   alias   works!
  1719.  
  1720.  
  1721.     TACKON
  1722.     Usage    : tackon var pathname filename
  1723.     Example    : tackon x df0:c Dir    # sets x to "df0:c/Dir"
  1724.     or    : tackon x df0: Preferences #sets x to "df0:Preferences"
  1725.  
  1726.     Correctly  adds  a  filename  to a pathname, and puts the result in
  1727.     variable specified.
  1728.  
  1729.     TAIL
  1730.     Usage    : tail filename [num]
  1731.     Example    : tail readme 20
  1732.  
  1733.     Display  last  "num" lines of "filename".  If num is not specified,
  1734.     10 is assumed.
  1735.  
  1736.     TEE
  1737.     Usage    : tee [file]
  1738.     Example    : cc test.c | tee >error.list
  1739.  
  1740.     Copies stdin to stdout and the given file. If file is omitted, stderr
  1741.     is used.
  1742.  
  1743.     TOUCH
  1744.     Usage    : touch file1 .. fileN
  1745.  
  1746.     Sets DateStamp of the specified files to the current date & resets
  1747.     archive bit.
  1748.  
  1749.     TRUNCATE
  1750.     Usage    : truncate [n]
  1751.     Example : alias | qsort | truncate
  1752.  
  1753.     A filter that truncates the width of stdin to the specified number,
  1754.     trying to account for tab's and escape sequences. If the number is
  1755.     omitted, the current window width is used.
  1756.  
  1757.     TYPE
  1758.     Equivalent to CAT.
  1759.  
  1760.     UNALIAS
  1761.     Usage    : unalias name .. name
  1762.     Example    : unalias vt
  1763.  
  1764.     Delete aliases..
  1765.  
  1766.     UNIQ
  1767.     Usage    : uniq
  1768.  
  1769.     This is a  filter that removes consecutive, duplicated lines in a
  1770.     file.  It is most useful on a sorted file.
  1771.  
  1772.     UNSET
  1773.     Usage    : unset name .. name
  1774.     Example    : unset abc
  1775.  
  1776.     Unset one or more variables.  Deletes them entirely.
  1777.  
  1778.     USAGE
  1779.     Usage    : usage [command...command]
  1780.  
  1781.     If called without arguments, usage gives you a short information
  1782.     on the special characters used. Otherwise, usage shows you the
  1783.     usage of the given commands. Calling a command with a '?' as
  1784.     the only argument will show its usage, too.
  1785.  
  1786.     VERSION
  1787.     Usage    : version
  1788.  
  1789.     Show current version name, & authors.
  1790.  
  1791.     WAITFORPORT
  1792.     Usage    : waitforport portname [seconds]
  1793.     Example    : waitforport rexx_ced 5
  1794.  
  1795.     Waits for a port to come up. Default time is 10 seconds.
  1796.  
  1797.     WHEREIS
  1798.     Usage    : whereis [-r] filename [ device1...deviceN ]
  1799.  
  1800.     If just a file name is given, whereis searches all subdirectories of
  1801.     the current directory for that file. An asterisk '*' is appended to
  1802.     the file. Wild cards are allowed for the file (no asterisk will be
  1803.     appended then), but no path names. If additional arguments are
  1804.     given, whereis searches only these paths, not the current directory.
  1805.     whereis -r looks on all drives.
  1806.  
  1807.     WINDOW
  1808.     Usage    : window [-q][-f][-b][-l][-s] [dimensions]
  1809.     Options    :
  1810.         -f    (front) Window to front
  1811.         -b    (back)  Window to back
  1812.         -l    (large) Window to maximum size
  1813.         -s    (small) Window to minimum size
  1814.         -a    (activate)
  1815.         -q    (query) Lists screens and windows open
  1816.  
  1817.        Various  operations on CLI window.  If dimensions are specified,
  1818.     they must be in the form x y width height, with values separated by
  1819.     spaces.
  1820.        The  command  "window  -l" may be very useful on PAL machines to
  1821.     get  a  full  PAL  window  from  your login sequence, or if you use
  1822.     overscan WorkBench.
  1823.        Option  -q  gives,  for  each  Screen and Window currently open,
  1824.     title, left edge, top edge, width, height, (depth).
  1825.  
  1826.     WRITEFILE
  1827.     Usage: writefile varname
  1828.  
  1829.     Writes a set of words to stdout, one word per line. Note that the
  1830.     name of the variable (var) must be supplied, not the value ($var).
  1831.  
  1832.  
  1833. IX. SPECIAL VARIABLES
  1834. ---------------------
  1835.  
  1836. There are a number variables, the write variable, that have a side effect on
  1837. your system (e.g.  changing the title bar), and some others, the read
  1838. variables, that tell you something about your environment (e.g.  the current
  1839. shell version).  You can also overlay the write variables with a local
  1840. variable, so any change only takes place while the current context is
  1841. valid.
  1842.  
  1843.     _abbrev
  1844.     If set to 'n', internal commands can no longer be abbreviated.
  1845.  
  1846.     _bground
  1847.     True if the shell was started with a non-interactive input.
  1848.  
  1849.     _clinumber
  1850.     Contains the number (1-20) of current CLI.
  1851.  
  1852.     _cwd
  1853.     Holds a string representing the current directory we are in from
  1854.     root.  The SHELL can get confused as to its current directory if
  1855.     some external program changes the directory.  Use PWD to rebuild
  1856.     the _cwd variable in these cases.
  1857.  
  1858.     _debug
  1859.     Debug mode... use it if you dare.  must be set to some value
  1860.  
  1861.     _every
  1862.     Contains the name of a command that is to be executed every time 
  1863.     just before the prompt is printed. Do not use this to echo the prompt.
  1864.  
  1865.     _except
  1866.     See EXCEPTION
  1867.  
  1868.     _failat
  1869.     If a command returns with an error code higher than this, the 
  1870.     batch file aborts. The default is 20.
  1871.  
  1872.     _hilite
  1873.     Holds the font attributes used for highlighting. One letter for one
  1874.     attribute:
  1875.       b    for bold
  1876.       i    for italic
  1877.       u    for underlined
  1878.       r    for reverse
  1879.       c3   for foreground color 3
  1880.       c3,2 for foreground color 3 and background color 2
  1881.     Any combinations are allowed. _hilite defaults to "c7", in terminal
  1882.     mode to "r".
  1883.  
  1884.     _history
  1885.     This variable is set to a numerical value, and specifies how far
  1886.     back your history should extend. Set it to 0 to disable history,
  1887.     for example if you test your programs for memory leaks. Defaults
  1888.     to 50.
  1889.  
  1890.     _insert
  1891.     Sets the default for insert/overtype mode for command line editing.
  1892.     ESC-i toggles between, but after <RET> the default is set back as 
  1893.     indicated by this variable. By default _insert is 1, unsetting
  1894.     _insert will make overtype the default.
  1895.  
  1896.     _ioerr
  1897.     Contains the secondary error code for the last command. Will be
  1898.     changed after every external command and after a failed internal
  1899.     command. See @ioerr( )
  1900.  
  1901.     _kick2x
  1902.     True if dos.library V36 could be opened (which means that kickstart
  1903.     2.0 is around)
  1904.  
  1905.     _lasterr
  1906.     Return code of last command executed.  This includes internal
  1907.     commands as well as external comands, so to use this variables
  1908.     you must check it IMMEDIATELY after the command in question.
  1909.  
  1910.     _lcd
  1911.     Holds the name of the last directory. The builtin alias 'dswap'
  1912.     cd's to that directory. If called again, you're back where you
  1913.     were.
  1914.  
  1915.     _man
  1916.     The path and name of your .doc files. Defaults to 'csh:csh.doc'
  1917.  
  1918.     _maxerr
  1919.     The worst (highest) return value to date.  To use this, you usually
  1920.     set it to '0', then do some set of commands, then check it.
  1921.  
  1922.     _minrows
  1923.     Gives the minimum number of rows a window must have to turn on quick
  1924.     scrolling. Defaults to 34.
  1925.  
  1926.     _nobreak
  1927.     If set to some value, disables CTRL-C.
  1928.  
  1929.     _noreq
  1930.     If set to some value , disables system requesters ("Please insert
  1931.     volume ...."). Turned on in vt200 mode.
  1932.  
  1933.     _passed
  1934.     This variable contains the passed arguments when you SOURCE a file
  1935.     or execute a .sh file.  For instance:
  1936.  
  1937.     test a b c d
  1938.  
  1939.     -------- file test.sh ----------
  1940.     echo $_passed
  1941.     foreach i ( $_passed ) "echo YO $i"
  1942.     --------------------------------
  1943.  
  1944.     _path
  1945.     Tells CShell where to look for executable files. The current direc-
  1946.     tory and the AmigaDOS path will be searched first. The trailing
  1947.     slash for directories is not necessary anymore.  The entire path
  1948.     will be searched first for the <command>, then for <command>.sh
  1949.     (automatic shell script sourcing). Example:
  1950.         set _path ram:c,ram:,sys:system,dh1:tools,df0:c
  1951.     (This path has the advantage that these directories need not even
  1952.      exist, that you can access devices (AmigaDOS path only knows 
  1953.      volumes under Kick 1.3) and that no disk seeks happen at startup)
  1954.  
  1955.     _prompt
  1956.     This variable now can contain the following control characters:
  1957.      %c  for color change. This highlights your prompt. See _hilite
  1958.      %e  for elapsed time. The time the last command took to execute.
  1959.      %m  for memory. This shows your current memory in K
  1960.      %t  for time. This shows your current time in the format HH:MM:SS
  1961.      %d  for date. This shows the current date in the format DD-MMM-YY
  1962.      %p  for path. This inserts the current path
  1963.      %n  for number. This inserts the current process number
  1964.      %v  for version. This shows the version number of CShell
  1965.      %h  for history. This displays the current history number
  1966.      %f  for free store. This shows the free store on the current drive
  1967.      %r  for pRiority. Inserts the task priority of the current
  1968.      %s  for shells open. Inserts the result of 'howmany'
  1969.      %x  for external cmd return code. Yields the last error code
  1970.     The default for prompt is now "%c%p> "
  1971.     The  if  command  will  set the prompt to a '_ ' if commands are
  1972.     disabled while waiting for a 'endif' or 'else' command (interactive
  1973.     mode only).
  1974.  
  1975.     _pipe
  1976.     The directory where temporaries are stored. Default: 'T:'
  1977.  
  1978.     _qcd
  1979.     Holds the name of the file where the all directories on your hard 
  1980.     disk are stored. If not set, disables quick cd-ing.
  1981.  
  1982.     _rback
  1983.     Is the name of the command to be the prepended to the command line
  1984.     when '&' was added to it. Defaults to 'rback', can't be a multi
  1985.     word command yet.
  1986.  
  1987.     _rxpath
  1988.     The same as with _path, but this is where CShell looks for .rexx
  1989.     files. Defaults to REXX:
  1990.  
  1991.     _scroll
  1992.     Holds the number of lines to be scrolled at once when quick scrolling
  1993.     is used. If unset or <=1, quick scrolling is off. Defaults to 3.
  1994.  
  1995.     _terminal
  1996.     Indicates whether or not shell was started in terminal mode.
  1997.  
  1998.     _titlebar
  1999.     The same control characters as for the _prompt can be used for
  2000.     _titlebar, too. The only difference is that %c is ignored. The
  2001.     titlebar is updated every time before the prompt appears.
  2002.  
  2003.     _verbose
  2004.     If set to 's', turns on verbose mode for source files (every command
  2005.     will be displayed before being executed). If set to 'a', displays
  2006.     all substeps while alias substitution. 'h' will hilight the debug
  2007.     output. Any combination allowed: set _verbose sah
  2008.  
  2009.     _version
  2010.     Contains the version number of the shell, e.g. 510.
  2011.  
  2012.  
  2013. X.   FUNCTIONS
  2014. --------------
  2015.  
  2016.     FUNCTIONS
  2017.     Functions are preceded by an @-sign and may not be abbreviated
  2018.     They must be preceded by a blank and a blank must follow the opening
  2019.     and precede the closing parenthesis. There must be no blank between
  2020.     the function name an the opening parenthesis. Example:
  2021.        echo @info( df0: )
  2022.     (NOTE: Later versions of Shell might allow that functions need not
  2023.            be at the beginning of an argument, so quote any @-signs not
  2024.            used for functions)
  2025.  
  2026.     Functions may be nested. The function names themselves are case
  2027.     sensitive, but the operations (like strcmp) aren't.
  2028.  
  2029.     Functions can be used as commands. They will echo their return value
  2030.     to stdout. Note that they can't be abbreviated and that the function
  2031.     list is searched after the command list. Example:
  2032.         drives          ---> DF0: DH1: DH2: RAM: WB_2.x:
  2033.     Therefore, functions can also be used like this:
  2034.         echo $(drives)
  2035.  
  2036.     So far, functions are not user definable.
  2037.  
  2038.     Note the difference between sets of words and strings. After
  2039.       set var hello world
  2040.     $var is a wordset, but after
  2041.       set var "hello world"
  2042.     var is one string. Although they look the same if echoed, they
  2043.     behave different, for example in 'foreach i ( var ) "echo hi'. The
  2044.     functions @split and @concat convert the two forms.
  2045.  
  2046.  
  2047.     @abbrev( str1 str2 [len] )
  2048.     true if the first <len> chars of str1 are an abbreviation of str2
  2049.     @abs( num )
  2050.     returns absolute value of <num>
  2051.     @age( file )
  2052.     the age of that file in days, 99999 if file not found
  2053.     @appsuff( name suffix )
  2054.     appends an suffix ( .ZOO ) to a string if it's not already there
  2055.     @arg( arg ... arg )
  2056.     see @pickargs( )
  2057.     @availmem( [type] )
  2058.     returns free 'chip', 'fast' or otherwise total memory
  2059.     @basename( path ... path )
  2060.     returns the file name parts of the paths
  2061.     @center( word len )
  2062.     returns a string of length <len> with <word> centered in it
  2063.     @checkport( portname )
  2064.     indicates if given port exists
  2065.     @clinum( procname )
  2066.     returns the number of the cli identified by a name or a number
  2067.     @complete( abbrev word ... word )
  2068.     returns the first word <abbrev> is an abbreviation of
  2069.     @concat( word word ... word )
  2070.     concats all words in one blank separated string, see @split
  2071.     @confirm( title item ... item )
  2072.     asks for confirmation of every item and returns the confirmed ones
  2073.     @console( STDIN|STDOUT )
  2074.     tells whether stdin or stdout are interactive (not redirected)
  2075.     @dectohex( number )
  2076.     returns a string representing <number> in hex
  2077.     @delword( word word ... word n )
  2078.     returns a string with the n-th word deleted.
  2079.     @delwords( word word ... word n m )
  2080.     deletes the next m words from the n-th.
  2081.     @dirname( path )
  2082.     strips the base name from a path, just returns the directory
  2083.     @dirs( name name name name )
  2084.     returns the directories among the given file names, see @files
  2085.     @dirstr( lformat file )
  2086.     returns any info (size, date, file comment) about a file
  2087.     @drive( path )
  2088.     outputs the drive ( device ) name associated to <path>
  2089.     @drives( )
  2090.     outputs all available drives
  2091.     @exists( file )
  2092.     tells whether a file exists or not
  2093.     @fileblks( file file ... file )
  2094.     returns the # of blocks needed for the files, incl. dir blocks
  2095.     @filelen( file file ... file )
  2096.     count the total number of bytes of the given files
  2097.     @fileprot( file )
  2098.     returns a string like ---arwed
  2099.     @filereq( title path&pattern filename )
  2100.     brings up the ARP file requester and returns the selected file name
  2101.     @files( file file ... file )
  2102.     gives you the files among those names, no directories. see @dirs
  2103.     @flines( varname )
  2104.     counts the number of lines in a readfile-file (faster than @words)
  2105.     @freebytes( path )
  2106.     the number of free bytes on the given path
  2107.     @freeblks( path )
  2108.     the number of free blocks on the given path
  2109.     @freestore( path )
  2110.     the amount of free store on that path, given in K, M and G
  2111.     @getenv( varname )
  2112.     returns the value of the named env: variable
  2113.     @getclass( file )
  2114.     returns the class (type) of the file. See chapter XIV
  2115.     @howmany( )
  2116.     indicates the # of shells running
  2117.     @index( string pattern )
  2118.     returns the index of pattern in string (starting at 1), 0 if not found
  2119.     @info( path )
  2120.     the corresponding line from the 'info' command, each entry a word
  2121.     @intersect( word1 word2 word3 , word4 word5 word6 )
  2122.     returns all words which are in both lists. see @union, @member
  2123.     @ioerr( num )
  2124.     returns the corresponding error string to num
  2125.     @lookfor( file paths )
  2126.     looks for a file in the current directory and the paths. See $_path
  2127.     @lower
  2128.     lowercases its arguments. see @upper
  2129.     @match( word ... word "pattern" )
  2130.     returns the words in the list that match the ARP-pattern
  2131.     @max( num num ... num )
  2132.     computes the maximum of all given numbers
  2133.     @megs( number )
  2134.     expresses a number in K, M and G (-bytes), rounded correctly
  2135.     @member( word1 word word ... word )
  2136.     tells you if word1 is among the remaining words
  2137.     @min( num num ... num )
  2138.     computes the minimum of all given numbers
  2139.     @mix( arg1 ... argn )
  2140.     randomly mixes its arguments
  2141.     @mounted( device )
  2142.     returns a boolean indicating whether the specified device is mounted
  2143.     @nameext( filename )
  2144.     returns all after the last dot of <filename>.
  2145.     @nameroot( filename )
  2146.     returns all before the LAST dot of <filename>.
  2147.     @opt( arg ... arg )
  2148.     see @pickopts( )
  2149.     @pathname( path )
  2150.     obsolete. use @dirname
  2151.     @pickargs( arg ... arg )
  2152.     picks of its arguments those which don't start with a '-'
  2153.     @pickopts( arg ... arg )
  2154.     picks of its arguments those which start which a '-'
  2155.     @rnd( )
  2156.     returns a 32 bit random number
  2157.     @rpn( expression )
  2158.     computes the rpn expression. See rpn command
  2159.     @scrheight( )
  2160.     outputs the current height of the screen the shell is running in
  2161.     @scrwidth( )
  2162.     outputs the current width of the screen the shell is running in
  2163.     @sortargs( name ... name )
  2164.     sorts its arguments alphabetically
  2165.     @sortnum( number ... number )
  2166.     sorts its arguments numerically
  2167.     @split( string )
  2168.     makes each blank separated part of @string a word, see @concat
  2169.     @strcmp( name name )
  2170.     returns -1, 0 or 1 depending of alphabetical comparison
  2171.     @strhead( breakchar string )
  2172.     see strhead command
  2173.     @strleft( string number )
  2174.     see strleft command
  2175.     @strmid( string n1 n2 )
  2176.     see strmid command
  2177.     @strright( string n )
  2178.     see strright command
  2179.     @strtail( breakchar string )
  2180.     see strtail command
  2181.     @subfile( varname n m )
  2182.     like @subwords, but acts on a readfile-file and is faster
  2183.     @subwords( word ... word n m )
  2184.     returns the next m words word of the given list starting from n
  2185.     @tackon( path file )
  2186.     see tackon command
  2187.     @trim( word word word )
  2188.     removes all leading and trailing blanks from the words
  2189.     @unique( word ... word )
  2190.     sorts the arguments and makes each of them unique
  2191.     @union( name ... name , name ... name )
  2192.     returns all names that are in either list. See @intersect, @member
  2193.     @upper( word ... word )
  2194.     upper cases the given words. see @lower
  2195.     @volume( path )
  2196.     returns the volume name in that path or ""
  2197.     @wincols( )
  2198.     returns the number of columns in the current shell window
  2199.     @winheight( )
  2200.     outputs the height of your window in pixels
  2201.     @winleft( )
  2202.     returns the left edge of your window
  2203.     @winrows( )
  2204.     returns the number of lines in the current shell window
  2205.     @wintop( )
  2206.     returns the top edge of your window
  2207.     @winwidth( )
  2208.     outputs the width of your window in pixels
  2209.     @without( name ... name , name ... name )
  2210.     returns all names of list 1 that are not in list 2
  2211.     @word( name ... name n )
  2212.     picks the n-th word from the list.
  2213.     @words( name ... name )
  2214.     returns the number of words in the list.
  2215.  
  2216.  
  2217. XI. MISCELLANEOUS
  2218. -----------------
  2219.  
  2220.     CShell now allows to do quick scrolling in large windows. Quick 
  2221.     scrolling means that whenever the cursor reaches the bottom of 
  2222.     the window, the text jumps up 3 or more lines at once. However,
  2223.     only the following commands support this:
  2224.         dir, cat, htype, strings, search, truncate, tee
  2225.     You can choose the number of lines to scroll at once by setting
  2226.     the variable _scroll. Unsetting it or setting it to a value <=1
  2227.     completely disables quick scrolling.
  2228.     You can also choose the number lines a window must at least have
  2229.     to turn on the quick scrolling by setting the _minrows variable.
  2230.     (Defaults to 34). Quick scrolling is automatically disabled when
  2231.     the command is redirected. By piping any command to cat, you can
  2232.     force it to quick scroll. Example:  List | cat
  2233.  
  2234.     CShell now can be terminated using the closing gadget in the
  2235.     AmigaDOS 2.0 shell window. Don't execute c:ENDCLI while using
  2236.     the shell. This can cause problems with external commands. The
  2237.     closing button provides a 'quit' command. You can define
  2238.       alias quit "Endcli;\\quit
  2239.     to assert that the CLI window closes when you click the button.
  2240.  
  2241.  
  2242.     EXCEPTIONS
  2243.     If  no  _except variable exists, any command which fails causes the
  2244.     rest of the line to abort as if an ABORTLINE had been executed.  If
  2245.     the _except variable exists, it is of the form:
  2246.  
  2247.     "nnn;commands..."
  2248.  
  2249.     where  nnn  is  some  value  representing  the  minimum return code
  2250.     required  to  cause  an  error.   Whenever a command returns a code
  2251.     which  is  larger  or  equal  to  nnn,  the commands in _except are
  2252.     executed  before  anything.   WHEN _except EXISTS, THE COMMAND LINE
  2253.     DOES  NOT  ABORT AUTOMATICALLY.  Thus, if you want the current line
  2254.     being executed to be aborted, the last command in _except should be
  2255.     an "abortline".
  2256.  
  2257.     Exception  handling  is  disabled  while  in the exception handling
  2258.     routine (thus you can't get into any infinite loops this way).
  2259.  
  2260.     Thus if _except = ";", return codes are completely ignored.
  2261.  
  2262.     Example:
  2263.  
  2264.     set _except "20;abortline"
  2265.  
  2266.  
  2267. XII. EXAMPLE SOURCE FILES
  2268. -------------------------
  2269.  
  2270. If from a CLI or the startup-script you say 'SHELL filename', that file is
  2271. sourced first.
  2272.  
  2273. ### compat.sh ###
  2274.  
  2275. # this makes sure that your old abbreviations don't call new commands
  2276.  
  2277. alias as  aset
  2278. alias cl  close
  2279. alias g   goto
  2280. alias h   help
  2281. alias he  help
  2282. alias m   md
  2283. alias q   quit
  2284. alias re  rename
  2285. alias w   window
  2286.  
  2287. alias kr  "rm -r ram:* >NIL:
  2288.  
  2289. ### End of compat.sh ###
  2290.  
  2291.  
  2292. Moreover, if you have a file called S:.login, it will be sourced for every
  2293. Shell you run. This is useful for aliases and setting that you want in ALL
  2294. Shells.
  2295.  
  2296.  
  2297. ### Example S:.login ###
  2298.  
  2299. Here is an example .login file:
  2300.  
  2301. set F5 "cdir WORK:"^M
  2302. set f9 "ed s:login.sh"^M
  2303. set F9 "ed df0:s/startup-sequence"^M
  2304.  
  2305. alias toram  "%q foreach i ( $q ) \"cp -r $i: ram:$i >NIL:;assign $i: ram:$i
  2306. alias ramop  "md RAM:op; assign OP: ram:op
  2307. alias noop   "assign OP: ; rm -r ram:op
  2308. alias newop  "rm -r OP:*
  2309. alias dc     "dfc df0: to df1:
  2310. alias go     "%q assign WORK: Boot:$q; cd WORK:; source startme.sh
  2311. alias get    "%q cp $q RAM: >NIL:
  2312. alias filter "%a%b%c exec $b \\<$a \\>$c
  2313.     # reads $a, filters it with $b and writes result to $c
  2314.  
  2315. alias rm     "%q \\rm @confirm( Remove $q )
  2316.  
  2317. #alias rm     "%a set f @pickargs( $a );set opts @pickargs( $a );\
  2318. # e -n OK to delete @words( @files( $f ) ) file(s) and @words( @dirs( $f ) )\
  2319. # directories\"? \";input b;if $b = y;\\rm $opts $f;endif 
  2320. #        # for the anxious among us: confirmed rm
  2321.  
  2322. set _prompt   "%c%p> "
  2323.     # this puts the path highlighted in the prompt
  2324.  
  2325. # this one puts cli number, free mem, date and time in title bar
  2326. set _titlebar "Shell %n    Mem %m     Date %d    Time %t
  2327.  
  2328. # This file will be sourced for every Shell you start
  2329.  
  2330. ### End of example .login ###
  2331.  
  2332. ****************************************************************************
  2333.  
  2334. If you are a CLI user, your startup-sequence may be as simple as:
  2335.  
  2336.     C:csh S:startup.sh
  2337.  
  2338. Here's a startup code:
  2339.  
  2340. ### Example S:startup.sh ###
  2341.  
  2342. wind -l    # if you are on a PAL machine, or use overscan
  2343.     # note that commands may be abbreviated (wind=window)
  2344.  
  2345. assign LC: Stuff:c  INCLUDE: Stuff:include   LIB: Boot:lib   QUAD: RAM:
  2346.  
  2347. rback C:FaccII; sleep 1
  2348.     # after spawning a process, it is always better to allow it
  2349.     # to load the command, to avoid excessive drive head movement
  2350.  
  2351. resident -d blink lc1 lc2 >NIL:    #defer loading
  2352.  
  2353. C:PopCli 300 C:Newcli         #using full pathname loads faster
  2354. C:FF -1 Siesta.font >NIL:
  2355. C:Patch_1 >NIL:
  2356. stack 8000            # lc1 and lc2 need this
  2357.  
  2358. source S:setdate.sh        # this is listed next 
  2359.  
  2360. ### End of example startup.sh ###
  2361.  
  2362. ****************************************************************************
  2363.  
  2364. The following is an example source file to set date and time; it may be
  2365. used at startup if you don't have an internal clock.
  2366.  
  2367. ### setdate.sh ###
  2368.  
  2369. open CON:200/100/440/80/SetDate write 1
  2370. echo >.1 -n "Current date is "
  2371. date >.1
  2372. echo >.1 -n "Please enter date: "
  2373. input <.1 d
  2374. close 1
  2375. strlen len $d
  2376. if $len > 1 ; date $d ; endif
  2377. echo -n "New date: " ; date
  2378.  
  2379. ### End of setdate.sh ###
  2380.  
  2381. ***************************************************************************
  2382.  
  2383. Next comes a makefile that needs no Make program: may be executed from
  2384. Shell directly!!!
  2385.  
  2386. ### make.sh ###
  2387.  
  2388. if -t Shell.syms Shell.h; cc +HShell.syms Shell.h; rm shell.o; endif
  2389. if -t RAM:Shell.syms Shell.syms; cp -d Shell.syms RAM:; endif
  2390.  
  2391. foreach i ( main comm1 comm2 comm3 execom globals rawconsole run set \
  2392.  sub ) "if -t $i.o $i.c; echo Compile $i...;cc +IRAM:shell.syms $i.c; endif"
  2393.  
  2394. # we used line continuation for better visibility. this is not necessary,
  2395. # you can type it all in one line. no more limit of 256 bytes per line
  2396.  
  2397. if -t Shell run.o main.o comm1.o comm2.o comm3.o execom.o \
  2398. set.o sub.o globals.o rawconsole.o
  2399.     ln  +q -m -o Shell run.o main.o comm1.o comm2.o comm3.o\
  2400.     execom.o set.o sub.o globals.o rawconsole.o -la -lc
  2401. endif
  2402.  
  2403. ### End of make.sh ###
  2404.  
  2405.  
  2406. XIII.  Default Values
  2407. --------------------
  2408.  
  2409. Some aliases are predefined whenever you start a new Shell. These are:
  2410.  
  2411.     CDIR
  2412.     Use "cdir directory" to clear the screen, set CD to directory,
  2413.     and list it.
  2414.  
  2415.     CLS
  2416.     Simply clear the screen.
  2417.  
  2418.     DSWAP
  2419.     Exchanges current and the previous current directory. For use in
  2420.     scripts as the symbol for last current directory may change.
  2421.  
  2422.     EXIT
  2423.     Leave Shell and exit CLI.
  2424.  
  2425.     MANLIST
  2426.     Display  a list of possible arguments to man.
  2427.  
  2428.     RX
  2429.     Executes a REXX script. Prevents unwanted starting of 'rxrec'.
  2430.  
  2431. Moreover, many variables have default values, and many function keys are
  2432. predefined. You can use set command to determine all of these.
  2433.  
  2434.  
  2435. XIV.  Object oriented features
  2436. ------------------------------
  2437.  
  2438. File classes are good for two things: Identifying files and command over-
  2439. loading. The latter means that the same command with files of different
  2440. type performs completely different actions.
  2441.  
  2442.     CLASSES OF FILES
  2443.  
  2444.     You can define a class of files using several 'class' commands.
  2445.     Here a simple example:
  2446.  
  2447.       class picture  suff=.pic suff=.iff suff=.ilbm 
  2448.       class anim     suff=.anim
  2449.  
  2450.     From now on, everything with the suffix .pic, .iff or .ilbm will
  2451.     be identified as a picture. Please note that there may be no blanks
  2452.     between the names and the '=', and that blanks inside the names
  2453.     must be put in quotes. So these are the ways to identify a file:
  2454.  
  2455.       suff=.doc        True if the suffix of the file is .doc
  2456.       name=readme      True if the file is "readme"
  2457.       name="mod.*"     True if the name starts with 'mod.'
  2458.       offs=14,DC..C4FD True if the bytes starting at $14 are $DC,
  2459.                        anything, $C4, $FD  (all numbers hexadecimal!). 
  2460.                        Each pair of dots means one byte ignored.
  2461.       chars            True if 90% of the bytes in the file are 32..127
  2462.                        or 9..13
  2463.       default          Always true, used to define the default type
  2464.  
  2465.     Note that only the first character is examined, so 's' = 'suff'.
  2466.     One class can be identified by more than one 'class' statement.
  2467.     They are looked at in the same sequence they were entered. So to
  2468.     make sure that an zoo archive misnamed as .lzh is identified
  2469.     correctly, use the following 'class' statements:
  2470.  
  2471.       class zoo offs=14,DCA7C4FD
  2472.       class lzh offs=2,2D6C68..2D
  2473.       class zoo suff=.zoo
  2474.       class lzh suff=.lzh
  2475.  
  2476.     Moreover, there is a builtin class 'dir', which means directory.
  2477.     Now we know many file types. But what to do with them? This is
  2478.     where we define 'actions'.
  2479.  
  2480.     ACTIONS ON CLASSES
  2481.  
  2482.     There may be one or more 'class' commands that define what actions
  2483.     need to be taken in various cases for that specific class:
  2484.  
  2485.       class zoo actions view="zoo -list" extr="zoo -extract"
  2486.       class lzh actions view="lz l"      extr="lz e"
  2487.  
  2488.     Whenever somebody tries to 'view' a test.zoo, the command
  2489.     'zoo -list test.zoo' will be issued, but if he tries to
  2490.     view test.lzh, then 'lz l test.lzh' will be executed. Note
  2491.     that any command supplied here goes through the normal csh
  2492.     parser, so AmigaDOS and csh paths will be searched. Aliases
  2493.     with arguments are allowed here, too, so whatever the user
  2494.     typed will be stored in the variable after the '%'.
  2495.  
  2496.     How do I tell a file that I want to 'view' it? There comes the
  2497.     second command used for object oriented features:
  2498.  
  2499.       action view test.zoo
  2500.  
  2501.     will first identify the type of that file and then apply, if
  2502.     possible, the 'view' action to it. Of course, this works best
  2503.     inside an alias:  alias v "action view" will define a v-command
  2504.     that views all types of files known to cshell. Similarly, you
  2505.     can define   alias xtr "action extr" and use this command to
  2506.     extract files from any type of archive.
  2507.     There is one action that will be sent to every file that you
  2508.     try to start but is not executable. This action is 'exec'. 
  2509.     Assume you have defined the class 'picture', then after
  2510.  
  2511.       class picture actions view=Mostra exec=Mostra
  2512.  
  2513.     you can display a picture using Mostra by just typing its name.
  2514.     More builtin actions like 'rm' and 'dir' may be implemented,
  2515.     so don't use command names for action names.
  2516.  
  2517.     The batch file class.sh defines a few useful classes.
  2518.  
  2519.     SUPERCLASSES
  2520.  
  2521.     Assume you have a class for .c files, one for .h files, and
  2522.     one for .asm files. You might want to make the difference 
  2523.     between them when identifying them, but in the end, they're
  2524.     all ASCII, aren't they? You can stat this with the command
  2525.  
  2526.       class c_source suff=.c is=ascii
  2527.  
  2528.     Now whenever an action on a file of the type c_source fails,
  2529.     the file is interpreted as of type ascii, and the same 
  2530.     action is attemted again. This goes on until a class has no
  2531.     more superclass.
  2532.  
  2533.  
  2534. XV.     Keymaps
  2535. ---------------
  2536.  
  2537.     You define a keymap as a collection of key/function pairs. Both
  2538.     are given as numbers. There can be several keymaps which activate
  2539.     each other, but at first we only edit keymap 0, which is active
  2540.     at the beginning. All keys you define will eventually overwrite
  2541.     the old definitions in an existing keymap. Everything marked with
  2542.     a (*) is not yet implemented.
  2543.  
  2544.     KEYCODES
  2545.  
  2546.     1..255    The corresponding ASCII character
  2547.     256      Up Arrow
  2548.     257      Down Arrow
  2549.     258      Right Arrow
  2550.     259      Left Arrow
  2551.     260      Help
  2552.     261..270  F1..F10  (unshifted)
  2553.  
  2554.  
  2555.     Modifiers (add them to the key code)
  2556.  
  2557.     512       SHIFT (only necessary for arrows and fkeys)
  2558.     1024      ESC   (was pressed & released before this key)
  2559.  
  2560.     EDITFUNCTIONS
  2561.  
  2562.     - Movement      Move cursor...
  2563.      0  CursLeft    1 left
  2564.      1  CursRight   1 right
  2565.      2  WordLeft    1 word left
  2566.      3  WordRight   1 word right
  2567.      4  BegOfLine   to beginning of line
  2568.      5  EndOfLine   to end of line
  2569.  
  2570.     - Deleting      Delete...
  2571.     10  Backspace   char left from cursor
  2572.     11  Delete      char right from cursor
  2573.     12  BkspcWord   word left from cursor
  2574.     13  DelWord     word right from cursor
  2575.     14  DeleteToSOL to start of line
  2576.     15  DeleteToEOL to end of line
  2577.     16  DeleteLine  whole line
  2578.  
  2579.     - History insert
  2580.     20  Back        Move one line back in history
  2581.     21  Forward     Move one line forward in history
  2582.     22  Beg         Move to first line in history
  2583.     23  End         Move to last line in history
  2584.     24  Complete    History retrieve like '!'
  2585.     25  Exec        Execute history line & bring up next
  2586.     26  Tail        Insert previous line except first word
  2587.     27  Bottom      Go below last history command
  2588.     28  DupWord     Duplicates the last word on this line
  2589.  
  2590.     - Completion
  2591.     30  Normal      Insert first matching file (or cycle)
  2592.     31  Partial     Insert common substring of all matching files
  2593.     32  All         Insert all matching files
  2594.     33  Directory   Find dir in quick cd list
  2595.     34  LastCD      Insert last current directory
  2596.     35  Show        Shows all matching files
  2597.  
  2598.     - Special
  2599.     40  Insert      Toggle Insert/Overwrite
  2600.     41  Quit        Silently perform 'quit'
  2601.     42  Help        Silently perform 'help'
  2602.     43  Refresh     Redraw current line
  2603.     44  Execute     Execute current line
  2604.     45  Leave       Edit new line, store this in hist
  2605.     46  EOF         Terminate shell
  2606.     47  NOP         Do nothing
  2607.     48  Echo^O      Echoes a ^O
  2608.     49  Beep        Echoes a ^G
  2609.  
  2610.     - Other
  2611.     50  Fkey        Execute command associated to last fkey
  2612.     51  Menu        Execute command associated to last menu
  2613.     52  Undo        Undoes last edit
  2614.     53  Repeat      Repeats last function
  2615.     54  SwapChar    Swaps the two chars left of cursor
  2616.  
  2617.  
  2618.     Command types
  2619.  
  2620.     0   +x      Editing function x, see above descriptions
  2621.     512 +x      Setmap x,     x=0..7
  2622.     1024+x      Insert key x, x=1..255
  2623.     1536+x      Macro x       x=1..15         (*)
  2624.     2048+x      String x      x=1..15         (*)
  2625.  
  2626.     Examples:
  2627.  
  2628.     keymap 0    66=49    # the  B key will beep
  2629.     keymap 0     2=16    # ^B key will erase line
  2630.     keymap 0  1122=35    # ESC-b will show matching files
  2631.     keymap 0 9=31 521=30 # Swaps TAB and SHIFT-TAB
  2632.