home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 177_01 / shell.doc < prev    next >
Text File  |  1986-01-04  |  45KB  |  1,251 lines

  1.  
  2.  
  3.  
  4.                              -- DR. SHAW'S DOS SHELL --
  5.                         User's Reference Manual 01/01/86
  6.  
  7.         Introduction and Overview:
  8.              This  document  is meant to serve as a reference  guide  and 
  9.         tutorial for the use of the Shell.    It will be updated whenever 
  10.         any   of   the  planned  quarterly  modifications  are   actually 
  11.         implemented in the Shell.
  12.              If  you  want to get directly to "The Right Stuff"  in  this 
  13.         Manual  and  learn  how to start or use the Shell,  skip  to  the 
  14.         sections  "How  to Start the Shell" and "How to Use  the  Shell".   
  15.         Otherwise, read on.
  16.  
  17.         Acknowledgements:
  18.              There  are  a  number  of  people  without  whose   support, 
  19.         criticism and ideas the Shell would not have been possible.    It 
  20.         would  be impossible to name all of them here since some of  them 
  21.         are people whose works I have read or whose programs I have used, 
  22.         and  provided influences in strictly an inferential and  indirect 
  23.         manner.    I  would,  however,  like  to acknowledge those  whose 
  24.         suggestions  and ideas,  whether they realized it or not had  the 
  25.         most profound influence on the Shell's development:
  26.              
  27.              Bob Leder
  28.              Chuck Sites
  29.              Christine Groat
  30.              Leor Zolman
  31.              Rick Rump
  32.              Elliot McGuire
  33.              Timothy Landgrave
  34.              Felix Kagi
  35.              Mark DeSmet
  36.              Joel Farley
  37.  
  38.         Dedication:
  39.              To my friend,  mentor and colleague,  Bob Leder,  whose many 
  40.         suggestions I happily implemented, and who faithfully beta-tested 
  41.         quite  a  number  of early versions of  the  Shell,  this  User's 
  42.         Reference Manual is dedicated.
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                                         1
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         Philosophy and History:
  71.              Every  major  program  has its own  Philosophy,  or  set  of 
  72.         principles  upon which it stands.    The quality of a program  is 
  73.         usually  determined by how thoroughly those principles have  been 
  74.         defined  and how effectively they were  then  implemented.    The 
  75.         current  Shell  is the end result of two programs:  the  original 
  76.         idea, first attempted in late 1984, and the present result.
  77.              The  original idea was not very well defined.    I had grown 
  78.         used to Rick Rump's Microshell product for CP/M systems, and when 
  79.         I   moved  to  MS-DOS/PC-DOS,   I  found  the  DOS   command-line 
  80.         interpreter just as lacking as the original CP/M CCP,  upon which 
  81.         it was based.   The best capabilities I found in the DOS command-
  82.         line  interpreter  were  those drawn from  counterparts  on  UNIX 
  83.         systems.
  84.              I decided to try to write a simple command-line  interpreter 
  85.         that  would  allow  you  to issue more than one  command  on  the 
  86.         command-line.    I  did  NOT  envision then  writing  a  complete 
  87.         interface to the operating system.    As a result,  the  earliest 
  88.         incarnation  of  the  Shell was little more than  a  parser  that 
  89.         allowed multiple commands on the command-line, separated by semi-
  90.         colons.   It was originally written with the Mark Williams' MWC86 
  91.         C compiler in December 1984, and did NOT even allow proper use of 
  92.         conventional  DOS  commands  like DIR.    It was  only  good  for 
  93.         running programs, occasionally.
  94.              The  next revision,  the first really usable one,  was given 
  95.         birth around early February,  1985, and featured usage of all DOS 
  96.         commands,  with the Shell first checking to see if what you typed 
  97.         was a DOS command,  and failing that, attempting to execute it as 
  98.         a .COM, .EXE, or .BAT file respective (which is how DOS does it).   
  99.         It  also  allowed review and re-use of the last 20  command-lines 
  100.         thanks  to Bob Leder,  who added this touch one cold Saturday  in 
  101.         February,  while  I  took  his  son sledding  in  Cherokee  Park.   
  102.         Written with Mark DeSmet's C compiler (which I still use), it was 
  103.         with  this version that I actually began to use the Shell in  its 
  104.         own development.
  105.              There were over the next 6 months a number of revisions that 
  106.         included the UNIX-like commands, cp and ls, for copying files and 
  107.         viewing directories,  respectively.   Also, a number (in fact, as 
  108.         far  as  I  know nearly all) of the prominent  bugs  were  fixed, 
  109.         including one that would mysteriously crash the Shell after a few 
  110.         minutes,  or hours usage.    I slowly found them, the one bad one 
  111.         teaching  me  to hesitate to use  someone's  not-so-well-debugged 
  112.         public  domain  windows package (or any other  kind  of  code,  I 
  113.         subsequently wrote my own).
  114.              The next major breakthrough, though, was when I stripped cp, 
  115.         ls  and  several other commands out of the Shell  and  made  them 
  116.         external as opposed to internal commands.    Not only did it make 
  117.         the Shell more memory efficient (it still only uses 32-48k),  but 
  118.         I  was able to incorporate the alias feature that gives any  user 
  119.         of  the  Shell  the  opportunity  to implement  his  or  her  own 
  120.         commands,  with  the  same  priority that DOS gives  to  its  own 
  121.         commands, and to even rename commands.
  122.              This subsequently led to the office-menu capability and  the 
  123.         sprucing up of cp and ls, not to mention the inclusion of several 
  124.         new commands.   I look forward to other programmers in particular 
  125.  
  126.                                         2
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.         developing  new commands for the Shell,  and hope that they  will 
  136.         pass  these  back  to me for redistribution so that  we  can  all 
  137.         benefit from them.
  138.  
  139.                                -------------------
  140.  
  141.              The  whole  idea behind the Shell was to make DOS easier  to 
  142.         use,  not  harder!    At the same time,  I felt that  offering  a 
  143.         strict  menu-driven or icon-driven (like the Macintosh or  1-Dir) 
  144.         interface,  discouraged  the  advanced,  "Power - User" (a la  PC 
  145.         Magazine).    The Power-User is used to getting a lot done at one 
  146.         time, and usually knows the next two or three commands he's going 
  147.         to issue in advance.    Therefore,  the "single-step", "do this - 
  148.         stop - then do this" approach of Menu- or Icon- driven interfaces 
  149.         often  becomes cumbersome and unproductive.    Since it would  be 
  150.         nice to issue a whole series of commands to DOS, all at one time, 
  151.         that  was  the first feature of the Shell to be  implemented  and 
  152.         becomes  the most obvious,  immediate advantage to the new  Shell 
  153.         user.
  154.              The Shell, like DOS veriosn 2.00 and above, was written with 
  155.         the hard-disk user in mind;  this doesn't mean it won't work on a 
  156.         floppy disk system,  but just like DOS it runs infinitely  better 
  157.         on  a hard disk system.    With the price of hard disks what they 
  158.         are (internal 20 meg under $ 700),  I venture to say that the  2-
  159.         floppy-only system will become a thing of the past in a year.
  160.              I've tried to create an expandable ENVIRONMENT in the Shell, 
  161.         to  fit the needs every user of DOS.    The Shell doesn't get  in 
  162.         the  way (unless you have only 64K!),  but instead enhances  DOS.   
  163.         I  would  like  to see it enhanced further,  and  would  like  to 
  164.         release quarterly revisions, whenever feasable (not unforseeable, 
  165.         as  I seem to generate some kind of improvement every  couple  of 
  166.         weeks).
  167.              Anyway, I hope you like the Shell and find it as useful as I 
  168.         have.    I  hope you'll give me some constructive feedback  after 
  169.         you've used it.
  170.  
  171.  
  172.         TradeMark Acknowlegements:
  173.              Listed  below are the trademarks and their respective owners 
  174.         for products referred to in this Manual:
  175.                                Trademarks / Owner:
  176.                        Microshell / New Generation Systems
  177.                              CP/M / Digital Research
  178.                                MS-DOS / MicroSoft
  179.                                   PC-DOS / IBM
  180.                           UNIX / AT&T Bell Laboratories
  181.                           MWC86 / Mark Williams Company
  182.                                 DeSmet C / C Ware
  183.                         SideKick / Borland International
  184.                              dBASE III / Ashton-Tate
  185.                                   IBM-PC / IBM
  186.                             Compaq / Compaq Computer
  187.                         WordStar / MicroPro International
  188.  
  189.  
  190.  
  191.  
  192.                                         3
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.         A Word on Payware(tm), and User's obligations:
  204.              You'll  see  my Payware notice when you first bring  up  the 
  205.         Shell.    Like other user-distributed software, your obligation 
  206.         only  comes if you decide you want to use the Shell.    I suggest 
  207.         you try it, and it you like what it does, use it.   Then, send me 
  208.         the $ 25.00.    If you don't use it,  don't send me anything.   I 
  209.         don't  expect you to pay for software that is not  productive  to 
  210.         you.    You can,  however,  give a copy of it to anyone you wish.   
  211.         Just don't alter or remove the boot message (after all,  you  can 
  212.         go around it, I tell you how in this manual).
  213.              I  will  offer  paid users upgrades to  future  versions  at 
  214.         minimal  or  no  cost,   depending  on  the  feasibility  of  the 
  215.         distribution  and  the value of the upgrade.    I do expect  some 
  216.         nice  new features to be added by the end of the  first  quarter, 
  217.         1986.
  218.  
  219.  
  220.                    Hardware, Software and Memory Requirements
  221.              The Shell is designed to run on the IBM-PC, Compaq, or close 
  222.         ROM-BIOS compatibles.    It requires MS-DOS or PC-DOS version 2.0 
  223.         or  above.    It  uses  a maximum of 48k of memory  (verified  by 
  224.         executing  the MEM command,  loading another Shell on top of  the 
  225.         first,  executing  MEM again,  and subtracting the difference  in 
  226.         available memory from the two MEM commands).
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.                                         4
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.         How to Start the Shell:
  268.              There are only a few steps to starting the Shell.    If  you 
  269.         get  an archived,  squeezed or library version off of one of  the 
  270.         Electronic Bulletin Boards, you will need to unsqueeze it.   Some 
  271.         of the Bulletin Board versions provide .BAT files for  installing 
  272.         the Shell,  so you may need only to run the appropriate .BAT file 
  273.         to install everything.
  274.              Once  this has been done,  you will need to have the  actual 
  275.         Shell  program  file,  SH.EXE in your current directory or  in  a 
  276.         directory on the path (if you are not familiar with the DOS  PATH 
  277.         command, ask a cohort - barring this call me - barring that, last 
  278.         but not least, read the DOS manual).   It is also helpful to have 
  279.         the  file  CONFIG.SH  in  the  same  place  as  SH.EXE,  but  not 
  280.         essential.    If you don't you'll get a warning message,  but you 
  281.         can go on.   
  282.              I would suggest,  though,  that you study the file CONFIG.SH 
  283.         (you  can  use your favorite word processor or text  editor)  and 
  284.         become acquainted with its contents,  because it is a key to your 
  285.         being able to tailor the Shell and its commands to your needs and 
  286.         it will be a focal point of future Shell development.    I  cover 
  287.         this in more detail in the section "How to Use the Shell".
  288.              Anyway,  if  you don't have CONFIG.SH on your path or in the 
  289.         current  directory  when  you boot the  Shell,  put  the  Shell's 
  290.         utilities (cp,  ls, ...) in a directory on the path.  BUT, to get 
  291.         the  maximum  efficiency out of the Shell,  put the utilities  in 
  292.         their  own directory,  and make sure that the lines in  CONFIG.SH 
  293.         give  a complete path to the directory you put the utilities  in.   
  294.         For example,  if you put the utilities in a sub-directory of  the 
  295.         root directory,  called say,  \SHBIN,  then the line in CONFIG.SH 
  296.         for a utility like cp might be:
  297.              cp=c:\shbin\cp.exe
  298.              This  becomes  even more interesting if you use a RAM  disk.   
  299.         Load  all  of the utilities into RAM (probably drive D)  and  the 
  300.         line would read:
  301.  
  302.                 cp=d:\cp.exe    or  maybe     cp=d:\shbin\cp.exe
  303.  
  304.              if you have any sub-directories on the RAM disk.   
  305.              Whatever  you do,  just make sure that each  utility  listed 
  306.         with  a full path to where it is located if you are going to  use 
  307.         the CONFIG.SH file.
  308.              Then just boot it up:
  309.                   A>sh                or             C>sh
  310.  
  311.              If  you  must get out of the Shell at anytime (most  of  the 
  312.         time,  you  WON'T have to),  just type EXIT and you'll be back at 
  313.         good old (somewhat boring) DOS.
  314.  
  315.  
  316.  
  317.                           Before Bringing Up the Shell:
  318.              1.  Set up any environment variables (PATH,  etc.).  (Future 
  319.         versions will allow these to be changed from the Shell itself.)
  320.              2. Load any RAM-resident utilities.
  321.  
  322.  
  323.                                         5
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.         How to Use the Shell:
  334.  
  335.                       Multiple Commands on the Command-Line
  336.              First off, the Shell you can execute as many commands as you 
  337.         can fit on width of the screen.   For instance, instead of:
  338.  
  339.              C>dir
  340.              .
  341.              C>dir b:
  342.              .
  343.              C>ws
  344.              .
  345.              C>erase *.bak
  346.              .
  347.              C>cd\payroll
  348.              .
  349.              C>do payroll
  350.              .
  351.              C>cd\finances
  352.              .
  353.              C>lotus
  354.              
  355.              you can do the same with:
  356.         dir;dir b:;ws;del *.bak;cd\payroll;do payroll;cd\finances;lotus
  357.  
  358.              all  you  have  to  do is substitute  a  semi-colon  on  the 
  359.         command-line  everywhere  you would ordinarily type  a  Carriage-
  360.         Return.
  361.  
  362.                             Editing the Command-Line
  363.              Made a mistake typing in that line?   Editing is easy.   Use 
  364.         the  following wordprocessing control keys to make changes to the 
  365.         command line (the ^ represents the Ctrl key):
  366.              To move the cursor:
  367.                   left: <- or ^S    right: ^D  or -> 
  368.                   word left: ^A or ^<-      word right: ^F  or ^->
  369.              To edit the command line:
  370.                   delete character: ^G
  371.                   clear field to right of cursor: - ^T
  372.                   Backspace delete - Del
  373.                   Insert mode on/off - Ins or ^V            
  374.  
  375.                      Review and/or Re-edit the Command-Line
  376.              Or  if  you'd  like to re-use and/or edit  the  previous  19 
  377.         command  lines,  just browse through them with the up/down  arrow 
  378.         keys  (or ^E and ^X),  and press RETURN to run the selected line.   
  379.         This makes repetitive tasks and mistakes easy to correct.
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.                                         6
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.                                     Commmands
  400.              The  Shell  supports  most  of  the  standard  internal  DOS 
  401.         commands  directly  and in many instances has  been  observed  to 
  402.         perform  them  even faster than PC-DOS.    Among those  supported 
  403.         directly are: 
  404.           CLS, DEL/ERASE, REN/RENAME, RMDIR/RD, CHDIR/CD, and MKDIR/MD.
  405.              
  406.              Also, two additional commands have been added: 
  407.                 MEM - shows total installed memory and total memory free.
  408.                 RM - like erase or del.
  409.  
  410.              Other internal DOS commands such as:  COPY, DIR, DATE, TIME, 
  411.         VER,  VOL, <, >, and | are supported but use DOS to perform them.   
  412.         Many  of  these have counterparts among the Shell's  own  set  of 
  413.         external commands,  and these counterparts are often faster, more 
  414.         productive and more useful than the DOS originals.    Of  course, 
  415.         the  big  advantage is that you (or your programmer friends)  can 
  416.         add  your  own commands to the Shell,  in a  virtually  unlimited 
  417.         fashion.
  418.  
  419.              The  Shell  is distributed with a set of  external  commands 
  420.         that  more  than  take the place of the  original  DOS  versions.   
  421.         Among these are: 
  422.                   LS - for Listing fileS and directories
  423.                   MV - for renaming and/or moving a file to a different
  424.                        disk location.
  425.                   TYPE (or CAT) - for typing files 
  426.                   CP - for CoPying files
  427.                   UNIQ - for removing duplicate lines of a sorted file.
  428.                   CHMOD - for changing attributes of files to be:
  429.                        read-only, hidden, system, or archival.
  430.                   TEE  - for splitting the output of a pipe or filter  to 
  431.                        both the screen and wherever else you want.
  432.  
  433.              These are described in detail on the following pages.
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.                                         7
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.             LS  is  a  directory  listing  command,   that  is  far  more 
  465.         informative  and useful than DIR.    For instance,  here  is  the 
  466.         output  of  LS with the -l option for the directory I am  writing 
  467.         this manual in:     
  468.  
  469.         d----         0    Sep 09 10:09a 1985     [..]
  470.         d----         0    Sep 09 10:09a 1985     [.]
  471.         d----         0    Dec 13 01:24p 1985     [y]
  472.         ----a      1152    Sep 09 10:10a 1985     autobio
  473.         ----a         0    Jan 03 00:14a 1986     file
  474.         ----a     12288    Oct 18 09:09a 1985     leor
  475.         ----a      8832    Oct 22 08:20p 1985     leor2
  476.         ----a       384    Oct 24 11:14a 1985     plauger
  477.         ----a      7680    Dec 14 09:06p 1985     shell.doc
  478.         ----a      2304    Dec 11 06:26p 1985     shell
  479.         ----a     21632    Jan 03 00:04a 1986     shhelp.bak
  480.         ----a     21760    Jan 03 00:14a 1986     shhelp.txt
  481.         ----a       768    Sep 26 00:19a 1985     super.tl
  482.         ----a       317    Dec 13 10:04a 1985     x
  483.         ----a       122    Dec 13 01:25p 1985     z
  484.         # files: 15   # bytes:  77239  (90112)  Remaining space: 3860480
  485.  
  486.              The  items on the left are file attributes,  which show that 
  487.         the  first three files are directories (also obvious  because  LS 
  488.         puts directory names in [ ]),  and the remaining files can all be 
  489.         archived  by DOS's BACKUP.    Each entry shows the file  size  in 
  490.         bytes,  the  date and time of the last update along with the file 
  491.         name.    The  default  order  is  always  alphabetical  with  the 
  492.         directories 1st.   The "# bytes" is the space taken by the files.    
  493.         The  figure in parenthesis is the real space taken up on the disk 
  494.         (helpful  since the hard disk files always use space to the  next 
  495.         8k on DOS 2 and the next 2k on DOS 3;  and floppy files use space 
  496.         to the next 4k).   The remaining space is just that.
  497.              To use LS:
  498.  
  499.              ls -fil *.dbf *.dif x*.com
  500.  
  501.              where  "-fil"  is an example of the options for LS  and  the 
  502.         rest are files with or without wildcards.    Yes, you CAN give ls 
  503.         more than one filename at a time (the "Remaining Space" figure is 
  504.         based  on the drive implied by the first directory/file-spec in a 
  505.         list).   As to the options which can be combined considerably:
  506.              -f: files (non-directories) only    
  507.              -i: fast video,  should not be used in redirection, but for 
  508.         fast video output only (programmers: the 'i' is for int 10h)
  509.              -l:  long  format  listing (like above,  otherwise  you  get 
  510.         filenames only)
  511.              -t: sort by date/time of last update    
  512.              -r: reverse the selected sort order    
  513.              -s: single column (name only) listing
  514.              -d: directories only listing    
  515.              -c: columnar format    
  516.              -p: show a page at a time (beats using the MORE filter!)   
  517.              -?: message that shows how to use ls and the options
  518.  
  519.  
  520.                                         8
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.              Since  the  Shell  lets  you make up  and  create  your  own 
  530.         commands (listed in CONFIG.SH),  a number of versions of ls  have 
  531.         been  created without any effort at all and are referenced in the 
  532.         CONFIG.SH  file distributed with the Shell.    Each  one  becomes 
  533.         it's own independent command and does NOT require any programming 
  534.         or expertise:
  535.                 
  536.             l - like ls, but with filenames only. (ls -li)
  537.             lc - like l, but in columns. (ls -ci)
  538.             lr - l sorted in reverse time of update order (ls -lrit)
  539.                 (shows most recently updated files last)
  540.  
  541.              LS  is based on the UNIX command of the same name,  but some 
  542.         of  the more creative ideas in it came from Mike  Ouye's  version 
  543.         with  DeSmet C,  with tasty suggestions from Chuck Sites and  Bob 
  544.         Leder.
  545.                             -------------------------
  546.  
  547.              MV  is another useful Shell command,  that is primarily used 
  548.         to MoVe a file from one directory to another,  without having  to 
  549.         copy  it.    What  MV  does,  is rewrite  the  directory  entries 
  550.         associated with a file,  instead of making a copy of it elsewhere 
  551.         on the disk.   This saves the step of have to delete the original 
  552.         copy  of the file,  and is much faster.    It can also be used to 
  553.         rename  a file when a full pathname is  involved.    The  present 
  554.         version does NOT support wildcards.  To use it:
  555.  
  556.                      mv \oldpath\filename \newpath\filename
  557.  
  558.              which would move "filename" from the directory "oldpath"  to 
  559.         the directory "newpath".
  560.  
  561.                             -------------------------
  562.  
  563.              The TYPE command in DOS has 3 counterparts in the Shell:
  564.  
  565.              TYPE - just like the original, only faster.
  566.              TYP  - just like TYPE with the MORE filter in use,  in other 
  567.         words  TYPing  a file will only put up one screenful  at  a  time 
  568.         until you press a key to continue.
  569.              CAT - for the UNIX afficiandos, the same as TYPE.   
  570.  
  571.              all  of  which are found in CONFIG.SH file as variations  on 
  572.         the CAT command.
  573.              With  all three of these you can specify a sequence of files 
  574.         to be printed on the screen:
  575.  
  576.              type file1 file2....filen
  577.  
  578.              TYPE does not accept wildcards.
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.                                         9
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.              CP is an external Shell command that not only lets you  copy 
  596.         one  file to another file,  but also allows you to copy an entire 
  597.         list  of  files or directories at once.   You can  specify  which 
  598.         files  in a group you do NOT want to copy,  or you can give names 
  599.         of  directories whose files you want copied,  and CP will  expand 
  600.         the directory-name to include every file immediately accesable in 
  601.         that directory.
  602.              To just copy one file to another:
  603.                                  cp file1 file2
  604.              which will copy FILE1 to FILE2.   To copy more than one file 
  605.         in  a  list requires an understanding of what I  call  the  "last 
  606.         item" rule.
  607.              The  "last item" rule in using CP is that the "last item" in 
  608.         the list MUST be the destination,  that is, where you are copying 
  609.         the  files  to.    For instance if you want to  copy  the  files: 
  610.         AUTOBIO,  LEOR,  SHELL  in  the  directory  listing  above  to  a 
  611.         directory called \PAYROLL:
  612.  
  613.                          cp autobio leor shell \payroll
  614.  
  615.              The  only  time the "last item" rule is relaxed is when  you 
  616.         copy a single file specification to the current directory.   Like 
  617.         if you wanted to copy a file called EMPLOYEE.DAT from \PAYROLL to 
  618.         the  current directory,  in which case the "last item" is implied 
  619.         to be the current directory:
  620.  
  621.                             cp \payroll\employee.dat
  622.  
  623.              or  if  you wanted all of the .DAT files in \PAYROLL to  the 
  624.         current directory:
  625.                                 cp \payroll\*.dat
  626.  
  627.              Now  you  might think that to get ALL of the  files  in  the 
  628.         \PAYROLL directory, you would use: 
  629.                                  cp \payroll\*.*
  630.  
  631.              which  would  work,  but cp will expand a directory name  by 
  632.         itself to directory\*.*, so that 
  633.  
  634.                                    cp \payroll
  635.  
  636.              will do the same thing!
  637.  
  638.              This  means that if you want to copy all of the files listed 
  639.         in  the  first example above,  and all of the files in  the  sub-
  640.         directory  Y  (but  not  including its  own  sub-directories)  to 
  641.         \PAYROLL:
  642.                         cp autobio leor shell y \payroll
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.                                        10
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.              In fact, you could even copy the files in directories called 
  662.         \A, \B, and \C to a subdirectory of \PAYROLL called \D:
  663.  
  664.                              cp \a \b \c \payroll\d
  665.  
  666.              (remember  the  "last  item rule":  the  last  item  is  the 
  667.         destination  to  be  copied to).    If the  destination  you  are 
  668.         copying files to is the current directory and you have more  than 
  669.         one  file  in  the list use '.' or ".\" to  specify  the  current 
  670.         directory.   For instance, to copy the files in \A, \B, and \C to 
  671.         the current directory:
  672.  
  673.                                   cp \a \b \c .
  674.                                        or
  675.                                  cp \a \b \c .\
  676.  
  677.              CP supports the use of wildcards ("*.*",  "*" and "???") and  
  678.         lets you specify which files should NOT be copied.    Suppose you 
  679.         want  to  copy  all of the S*.TXT and L*.* files in  the  current 
  680.         directory (listed by LS above) to a directory called ..\LTRS, but 
  681.         you do NOT want to copy the file called LEOR2:
  682.  
  683.                           cp s*.txt l*.* !leor2 ..\ltrs
  684.              which  says:  "copy the s*.txt and l*.* files but NOT a file 
  685.         called leor2 to a directory called ..\ltrs".
  686.  
  687.              While it's copying CP will respond with:
  688.           copying shhelp.txt to ..\ltrs\shhelp.txt...completed
  689.           copying leor to ..\ltrs\leor...completed
  690.  
  691.              Notice  that  the "leor2" file (from the  directory  listing 
  692.         above) was not copied.    Again, the "!" says do NOT include this 
  693.         in the list even though you said "l*.*".  
  694.              One  big advantage to using CP in addition to being able  to 
  695.         get a whole bunch of files copied at once is that CP will use  as 
  696.         much  memory  as you have available on the machine  for  copying.   
  697.         It  will  often read into memory an entire  file  (even  300-400k 
  698.         files!) before writing the copy out to the disk, which means that 
  699.         copying with CP can be extraordinarily fast!
  700.              Although its roots are found in the UNIX  utility,  cp,  the 
  701.         spirit  of  the current program can be found in the version  that 
  702.         Leor Zolman distributes with BDS-C.
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.                                        11
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.              UNIQ  is  a filter that removes duplicate lines of a  sorted 
  728.         file,  and  should be used like MORE with pipes  or  redirection.   
  729.         For  instance,  in a batch file called MAKDIRS.BAT that Bob Leder 
  730.         wrote:
  731.             cd \
  732.             tree | find "Path: " | repl "Path: " "md " | sort | uniq > %1
  733.              
  734.              In this example, the output of the DOS TREE command is piped 
  735.         to FIND,  which looks for the phrase "Path:  " and tells REPL  (a 
  736.         filter that replaces every occurance of one phrase in a file with 
  737.         another) to replace every "Path: " with "md ", then calls SORT to 
  738.         sort the file,  and UNIQ to strip out any duplicate lines.    The 
  739.         end  result  is written to a file that you specify when  you  run 
  740.         MAKDIRS, for instance:
  741.  
  742.              C>MAKDIRS dirs.bat
  743.  
  744.              and  DIRS.BAT will now be capable of reproducing the  entire 
  745.         directory  structure  of  your hard disk on  another  hard  disk.   
  746.         That's a long winded example of how to use UNIQ (and four billion 
  747.         other things).
  748.                             -------------------------
  749.  
  750.              CHMOD  is  a  command  that  is  used  to  change  a  file's 
  751.         attributes  (the  same one's shown on the left in the LS  listing 
  752.         above).    With  CHMOD  you can set a file to be  read-only  (you 
  753.         can't  write over it),  system or hidden (not found  in  standard 
  754.         directory  searches),  or archival (able to be archived by  DOS).   
  755.         To use it:
  756.                          chmod [+ | -] [rhsa] [filename]
  757.  
  758.              where  a '+' means turn on the attribute,  and '-' means  to 
  759.         turn  an  attribute  off.    The  "rhsa"  are  the  various  file 
  760.         attribute combinations (r - read-only,  h - hidden, s - system, a 
  761.         - archival),  and  "filename"  is  the name  of  the  file  whose 
  762.         attributes you want to modify.
  763.              As to a couple of simple examples,  suppose you wanted (as I 
  764.         like  to  do) to make your copy of COMMAND.COM on your hard  disk 
  765.         read-only,  so  you won't accidently erase it,  or copy over  the 
  766.         wrong  version  (I  would  hate to smother  it  with  a  DOS  1.0 
  767.         version!).   You do this with:
  768.  
  769.                               chmod +r command.com
  770.  
  771.              or  perhaps  you  have a floppy disk formatted with  the  /s 
  772.         (system)  option,  and you want to free up the space used by  the 
  773.         hidden files: ibmbio.com and ibmdos.com (which you can see listed 
  774.         by LS):
  775.                              chmod -rhs a:ibmbio.com
  776.                              chmod -rhs a:ibmdos.com
  777.  
  778.              CHMOD does not accept wildcards.
  779.  
  780.  
  781.  
  782.  
  783.  
  784.                                        12
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.              TEE  is  a program that is used in pipes to display  on  the 
  794.         screen what is passing through the pipe.    In the example above, 
  795.         the  batch file MAKDIRS.BAT,  we can use TEE to display  what  is 
  796.         passing  through the pipe without interrupting the output of  the 
  797.         pipe itself:
  798.  
  799.         tree | find "Path: " | repl "Path: " "md " | sort | uniq | tee %1
  800.  
  801.              TEE  is  best used at the end of the pipe,  as we have  done 
  802.         here.    It  will send a copy of the input to screen and  another 
  803.         copy to the file specified after it.    In this case the file  is 
  804.         the one substituted by the variable %1.
  805.  
  806.                             -------------------------
  807.  
  808.  
  809.                                Other DOS Commands
  810.              Before  bringing  up the Shell,  you should have  setup  the 
  811.         following DOS commands as you will want them to be:  BREAK, PATH, 
  812.         PROMPT,  VERIFY,  and SET.   The key to remember here is that the 
  813.         Shell  is  NOT  a RAM-resident program  like  SideKick.    It  is 
  814.         actually  an application-program that interfaces with DOS to make 
  815.         it  easier to use.    This means it is easy to get out of  should 
  816.         you need to, and cannot be accused of being incompatible with any 
  817.         RAM-resident programs you might be using (plus this makes it less 
  818.         buggy and easier for me to maintain).
  819.  
  820.  
  821.                                      Prompts
  822.              Currently  the  default  prompt  gives a full  path  to  the 
  823.         present  working directory.    Support for the  conventional  DOS 
  824.         configurable prompt should be present in a future version.
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.                                        13
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.                                  Menu-Generation
  860.              The  Shell has some simple menu-generation capabilities  for 
  861.         use  in a office or automated enviroment.    This means that  you 
  862.         can  customize  a  machine  to  the  point  where  both  computer 
  863.         illiterates  (who  might  want Menus) and Power-Users  (who  will 
  864.         typically  like the Shell environment) can co-exist on  the  same 
  865.         machine.   
  866.             Menu  outlines  are  kept  in a file  that  is  specified  in 
  867.         CONFIG.SH by an entry like:
  868.                                   menu=c:\menudir\menu.cfg
  869.  
  870.              where  "menu"  is  a  key-word in  CONFIG.SH,  and  in  this 
  871.         example,  MENU.CFG  is  a menu configuration file  found  in  the 
  872.         directory called \MENUDIR.   This is also the directory where the 
  873.         menu-associated  batch  files are kept (for more  information  on 
  874.         CONFIG.SH, see section "Adding Your Own Shell Commands").   
  875.              To generate a menu, modify the menu configuration file (I'll 
  876.         call  it MENU.CFG in the examples here) to include a menu command 
  877.         and  a description for each item you want displayed on the  menu.   
  878.         The  key is to have one command and description on each  line  in 
  879.         MENU.CFG,  in the form of command=descriptive phrase, where the 
  880.         "command"  is  really the name of a batch file and  therefore  no 
  881.         more than 8 characters.   To generate a set of menu items like:
  882.  
  883.              Payroll        Run Payroll System
  884.              GL             Run General Ledger
  885.  
  886.              you would have the lines:
  887.  
  888.         Payroll=Run Payroll System
  889.         GL=Run General Ledger     
  890.  
  891.              in MENU.CFG.   Any line that does NOT have the '=' sign in 
  892.         it  will be centered and printed literally.    To put a title  on 
  893.         the menu,  enter the title line in MENU.CFG in the exact  order 
  894.         it will be displayed on the screen and:
  895.  
  896.         Shaw*American Technologies Office System
  897.         blank
  898.         Payroll=Run Payroll System
  899.         GL=Run General Ledger     
  900.  
  901.              would generate a menu like:
  902.  
  903.                     Shaw*American Technologies Office System
  904.  
  905.              Payroll        Run Payroll System
  906.              GL             Run General Ledger
  907.  
  908.              Notice  that the word "blank" as the first phrase on a  line 
  909.         means put a blank line on the screen.   
  910.              For  every  entry in MENU.CFG with an '=' sign,  you  will 
  911.         need  to have a .BAT file that changes to that directory of  your 
  912.         system,  and  boots or loads the appropriate  program.    If  the 
  913.         Payroll entry above really ran a dBASE III system,  then you will 
  914.  
  915.                                        14
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.         need  a  batch  file  called  PAYROLL.BAT  that  might  have  the 
  925.         following in it:
  926.  
  927.         echo off
  928.         cd\payroll
  929.         dbase payroll
  930.         cd\
  931.  
  932.              Make sure that you place all menu related .BAT files in  the 
  933.         directory designated by the "menu=pathname" entry in CONFIG.SH as 
  934.         I mentioned above.
  935.              To enable the menuing capabilities,  bring up the Shell with 
  936.         the  -m  option  and the command "menu" (this can  be  done  with 
  937.         AUTOEXEC.BAT:
  938.                                       sh -m menu
  939.  
  940.              The  -m  option enables menuing and tells the Shell to  look 
  941.         for  a "menu=" entry in CONFIG.SH.    If it is found,  the  Shell 
  942.         will  read the configuration file to generate a menu.    The menu 
  943.         will not be initially displayed until a "menu" command is  issued 
  944.         to the Shell, although that can be done when the Shell is brought 
  945.         up (as shown above).     You may choose to issue a "menu" command 
  946.         later  on.    Issuing  a  "menu" command when the Shell  was  NOT 
  947.         brought  up  with the -m option will NOT generate a  Shell  menu.   
  948.         The  Shell will automatically give precedence to a  menu  command 
  949.         over  other  commands,  and will always re-display the menu  upon 
  950.         exiting the .BAT file for that command.   Also, a Shell menu will 
  951.         always be redisplayed by entering the command "menu".
  952.  
  953.              Try it, we use it in our office all the time!
  954.  
  955.  
  956.                            Issuing Start-up Commands:
  957.              As shown above,  the Shell will accept arguments on boot  in 
  958.         the following form:
  959.                         sh -m cp \shbin\*.exe d:;menu
  960.                     
  961.             This  example from my AUTOEXEC.BAT file will boot  the  Shell 
  962.         with  menu capabilities enabled,  copy all of the .EXE  files  in 
  963.         \shbin to drive d, and show the menu.
  964.              Another example might boot the Shell,  change to a directory 
  965.         called  \UTIL  (where utilities are kept),  and show all  of  the 
  966.         *.EXE files there:
  967.                                sh cd\util;lc *.exe
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.                                        15
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.               Adding Your Own Shell Commands (featuring CONFIG.SH):
  991.  
  992.              Probably  one  of the Shell's most powerful features is  its 
  993.         ability  to reference commands by different names,  and allow the 
  994.         user  (you!) to specify what a command should  mean!    In  other 
  995.         words,  you  can  add your own commands to the  Shell,  which  is 
  996.         something DOS will NOT really let you do (barring the use of .BAT 
  997.         files).
  998.              When  the  Shell is first brought up,  it looks for  a  file 
  999.         called CONFIG.SH in the present working directory (pwd) or on the 
  1000.         environment path.    If the file is found, the Shell will read it 
  1001.         and  from  it  initialize a set of internal  commands  and  their 
  1002.         translation  into  real  executable  programs.    Like  the  menu 
  1003.         configuration file, the statements in CONFIG.SH shoulbe be in the 
  1004.         form: 
  1005.  
  1006.                    command=execution_string -options arguments
  1007.  
  1008.              where  "command" is the command you want to be able to  use, 
  1009.         the "execution_string" is the full path and filename of a program 
  1010.         to  be  executed,  "-options" are any additional  options  to  be 
  1011.         passed,  always  beginning  with  '-',  and "arguments"  are  any 
  1012.         additional parameters to be given.
  1013.  
  1014.             For instance to get the output of LS every time you type DIR, 
  1015.         just enter the following line in CONFIG.SH:
  1016.                                dir=c:\shbin\ls.exe 
  1017.              where anytime you type DIR as a command, it will instead run 
  1018.         the LS program found in \SHBIN.    You can do this with virtually 
  1019.         any  command.    You can also add your own as you write (or find) 
  1020.         other  programs  you would like to have as part  of  the  Shell's 
  1021.         environment.   There is also a speed advantage, as the Shell will 
  1022.         load  and execute it's own set of commands via CONFIG.SH,  faster 
  1023.         than it will others.
  1024.              If you make a change to CONFIG.SH, you will need to exit the 
  1025.         Shell (just type "exit") and restart it for the new CONFIG.SH  to 
  1026.         take effect.    The next revision of the Shell will probably have 
  1027.         a  command to re-initialize the commands from CONFIG.SH,  without 
  1028.         having to leave the Shell.
  1029.  
  1030.              Two  keywords  are  reserved  to  have  special  meaning  to 
  1031.         CONFIG.SH and should NOT be used for commands:
  1032.              MENU=gives  the path and name of the menu configuration file 
  1033.         and the path to the associated menu .BAT files.
  1034.              LOG=gives  the path to a directory where .LOG files will  be 
  1035.         kept (see the section "Generating Logs of Shell Usage").
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.                                        16
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.              The following is my current CONFIG.SH:
  1057.  
  1058.         menu=c:\shbin\config.shm
  1059.         log=c:\shbin\logs
  1060.         cp=d:\cp.exe
  1061.         ls=d:\ls.exe -i
  1062.         lc=d:\ls.exe -ci
  1063.         l=d:\ls.exe -li
  1064.         e=d:\e.exe
  1065.         cat=d:\cat.exe -i
  1066.         typ=d:\cat.exe -pi
  1067.         type=d:\cat.exe -i
  1068.         dir=d:\ls.exe -i
  1069.         uniq=d:\uniq.exe
  1070.         chmod=d:\chmod.exe
  1071.         diff=c:\bin\diff.exe
  1072.         lr=d:\ls.exe -lrit
  1073.         mv=d:\mv.exe
  1074.  
  1075.  
  1076.                                 To Quit the Shell
  1077.              If at any time you want to get out of the Shell,  just enter 
  1078.         the  command "exit".    This will return you to good  old  (yawn) 
  1079.         DOS.
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.                                        17
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.              Generating Logs of Shell (and therefore Computer) Usage
  1123.  
  1124.              The  Shell has the capability of maintaining a daily log  of 
  1125.         computer  usage.    When the log-file option  is  enabled,  every 
  1126.         command-line that you execute in the Shell will be written to the 
  1127.         log-file.    One log-file is generated for every day the Shell is 
  1128.         used  (provided  the  DOS  system date has  been  properly  set).   
  1129.         Multiple sessions on a given day are recorded sequentially in the 
  1130.         same  log-file with a time-stamp showing the beginning of  a  new 
  1131.         session.    A  typical  log (like this one named  "12-12-85.log") 
  1132.         file might look like this:
  1133.  
  1134.         23:25:09
  1135.         l -d \shbin\*.*
  1136.         l  \shbin\logs\*.*
  1137.         exit
  1138.         23:29:20
  1139.         cd\shbin\log
  1140.         cd\shbin\logs
  1141.         l
  1142.         cat 12-12-85.log
  1143.         time
  1144.         ws
  1145.         ws
  1146.         ws
  1147.         exit
  1148.         23:32:08
  1149.         ws
  1150.         ws
  1151.         exit
  1152.  
  1153.              The times stamped into the log show that I started the Shell 
  1154.         on three different occasions (just before midnight).    The Shell 
  1155.         automatically uses the system date to name log files, and because 
  1156.         the system date was set to 12-12-85,  the log file was named "12-
  1157.         12-85.log"
  1158.              Log  file capabilities are enabled in the Shell by  starting 
  1159.         the Shell with the -l option.     For instance to start the Shell 
  1160.         with the log-file enabled:
  1161.                                       sh -l
  1162.              or to start it with both log-files and menus enabled:
  1163.                                      sh -lm
  1164.              etc.
  1165.  
  1166.              The  log files are always kept in the directory specified by 
  1167.         the appropriate entry in CONFIG.SH:
  1168.  
  1169.                                 log=c:\shbin\logs
  1170.              
  1171.              in  which case the log files will be kept in a  subdirectory 
  1172.         of \shbin called (appropriately) "logs".
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.                                        18
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.                                The End (for now).
  1189.  
  1190.  
  1191.                   (This page intentionally left almost blank.)
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.                                        19
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.