home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / tools / cshell32 / shell.doc < prev    next >
Text File  |  1986-08-22  |  52KB  |  1,254 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  68.  
  69.  
  70.           NAME              NAME  
  71.  
  72.                pc-shell - pc command processor 
  73.  
  74.           SYNOPSIS              SYNOPSIS  
  75.  
  76.                pc shell                                                  pc-shell  [-s] [-v] [-b] [arg1 ... argn] 
  77.  
  78.           DESCRIPTION              DESCRIPTION  
  79.  
  80.                pc-shell is a command processor for IBM-PC's and compatibles that 
  81.                emulates  some  of  the  more desirable functions of the Berkeley
  82.                UNIX* C-shell. In addition, it implements PC-DOS versions of some 
  83.                of the common UNIX* commands  -ls, mv, cp, etc.  
  84.  
  85.                     v                                                                            The -v option (verbose) causes the program to echo  all  commands
  86.                to the standard error stream before executing them.  
  87.  
  88.                      b                                                                           The  -b  option  suppresses mapping of the backslash character to
  89.                the forward slash character in all  operations  that  communicate
  90.                with [PC|MS]DOS.    This is here primarily for compatibility with
  91.                PC-NET,  which  seems  to  choke  on  paths  containing   forward
  92.                slashes.  
  93.  
  94.                arg1       argn                                                                   arg1  ...  argn  (the  command  line  arguments) are put into the
  95.                shell's environment as the variables $1 through $n.  
  96.  
  97.  
  98.           Wild Card Substitution              Wild Card Substitution  
  99.  
  100.                Ambiguous file names are expanded to  a  list  of  matching  file
  101.                names on  the command line.  This can be defeated by quoting, and
  102.                by setting the NOGLOB environment variable to '1'.  
  103.  
  104.                Command lines passed to external programs are  truncated  to  128
  105.                characters.  
  106.  
  107.  
  108.           History Substitution              History Substitution  
  109.  
  110.  
  111.                History substitution is a powerful means to save retyping of long 
  112.                command lines.It allows you to do things like re-execute the last 
  113.                command,    re-execute  the last command but redirect output to a
  114.                file, or execute a  new  command  with  arguments  from  previous
  115.                command  lines.    The  last  20  commands  are saved, and can be
  116.                reviewed by typing the 'history' command.  
  117.  
  118.                Previous commands can be referred to by their number, or relative 
  119.                to the  current  command's  number.    Parameters  from  previous
  120.                commands can be seperated out and used individually.  
  121.  
  122.                History  substitutions  specifications  come  in  two parts - the
  123.                command number  specifier and the argument  specifier,  seperated
  124.                by a  colon.    The  argument    specifier  is optional; if it is
  125.                omitted, the entire command line is specified.  
  126.  
  127.                <command specifier> ::= !! | !n | !-n | <shortcut> 
  128.  
  129.  
  130.                                               -1-
  131.  
  132.  
  133.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  134.  
  135.  
  136.                !!  = last command
  137.                !n  = nth command
  138.                !-n = command n commands before current command number
  139.                !#  = the current command line
  140.  
  141.                <arg specifier> ::= :[^$*] | [^$*] | :n | :n* | <searchstr> | <empty>
  142.                n   = number of argument (0 being the command name)
  143.                ^   = first argument (i.e. argv[1])
  144.                $   = last argument
  145.                *   = ^-$, or nothing if only one word on command line
  146.                n*  = arguments n through $
  147.  
  148.                <searchstr> ::= (initial characters of a previous command)
  149.  
  150.                <history subst specification> ::= <command specifier><arg specifier>
  151.  
  152.                This is not as complicatated as  it  may  appear.    Here  is  an
  153.                example session.  
  154.  
  155.                EXAMPLE 
  156.  
  157.                0% ls *.c
  158.                *.c
  159.                foo.c bar.c
  160.                1% more foo.c
  161.                /* edit the last argument of the last command */
  162.                2% edit !!:$            
  163.                /* go off and edit */
  164.                /* reference last argument of last command */
  165.                3% fgrep foo !!:$ bar.c 
  166.                FOO.C : foo
  167.                BAR.C : foo
  168.                /* edit the second thru the last args of command 3 */
  169.                4% edit !3:2*            
  170.                (go off and edit)
  171.                /* repeat last command */
  172.                %5 !!
  173.                (go off and edit)
  174.                /* remove the 1st argument of the command 2 before the current one */
  175.                %6 rm !-6:^
  176.  
  177.  
  178.                Several  shortcut  expressions  (that  don't  fit into the formal
  179.                description above) are also allowed.  !$, !^,  !*  are  allowable
  180.                synonyms for !!:$, !!:^, and !!:*.  It is also possible to select 
  181.                a previous command with one or more characters from the beginning 
  182.                of that command line.  
  183.  
  184.                     %1 edit foo.c    # edit a source file
  185.                     %2 cc foo.c        # try and compile it
  186.                     %3 !e            # repeat command #1
  187.  
  188.                History substitution here is a compatible subset of the [U|XE]NIX 
  189.                C shell    history  substitution  facility.    Cshell allows even
  190.                weirder combinations.  
  191.  
  192.  
  193.           Variable Substitution              Variable Substitution  
  194.  
  195.  
  196.                                               -2-
  197.  
  198.  
  199.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  200.  
  201.  
  202.                Shell variables are synonymous for our purposes with  environment
  203.                strings, i.e.  they are defined with the 'set' command.  
  204.  
  205.                Variables  are  referenced  on  the  command  line by prefacing a
  206.                variable name by a dollar sign.    Two  dollar  signs  in  a  row
  207.                signify a dollar sign character.  
  208.  
  209.                As  mentioned  above, command line arguments are contained in the
  210.                                                      n                                            shell variables, $1 through $n, where n is the number of the last 
  211.                argument.  
  212.  
  213.                EXAMPLE
  214.  
  215.                %0 set home = c:/
  216.                %1 echo $home
  217.                C:/
  218.                %2 ls $home
  219.                C:/*.*
  220.                command.com
  221.                %3 echo $path
  222.                C:/bin
  223.  
  224.                And so on.  
  225.  
  226.  
  227.           Special variables              Special variables  
  228.  
  229.                There are a some shell variables that have special  meanings  for
  230.                                                               set                                the shell.   They can be given values with the set command.  They
  231.                are 
  232.  
  233.               NOCLOBBER                  NOCLOBBER  
  234.  
  235.                       NOCLOBBER                                                                      If NOCLOBBER is equal to '1', then existing files may not  be
  236.                    destroyed  by  output  redirection,  and  output  files to be
  237.                    appended to by >> must exist.  
  238.  
  239.  
  240.               PROMPT                  PROMPT  
  241.  
  242.                        PROMPT                                                                        The PROMPT environment string is handled the same way  as  it
  243.                           COMMAND COM                                                                is by  COMMAND.COM.    There  is one pc-shell-specific prompt
  244.                    string character  !    that  specifies  the  current  command
  245.                    index.   If no PROMPT environment string is defined, then the
  246.                    default is '$!% '.  
  247.  
  248.           NOGLOB              NOGLOB  
  249.  
  250.                    NOGLOB                                                                        The NOGLOB environment string, if set to '1', will suppress  file
  251.                name expansion.  
  252.  
  253.  
  254.           NODOS              NODOS  
  255.  
  256.                     NODOS environment string  if set to  1   will keep the shell                 The  NODOS environment string, if set to '1', will keep the shell
  257.                from                                                                              from  invoking  command.com  to  handle   commands   it   doesn't
  258.                understand.  
  259.  
  260.  
  261.  
  262.                                               -3-
  263.  
  264.  
  265.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  266.  
  267.  
  268.           Multiple commands on one command line              Multiple commands on one command line  
  269.  
  270.                Command lines  are  split at semicolons.  This can be defeated by
  271.                quoting or escaping.  
  272.  
  273.                EXAMPLE 
  274.  
  275.                %0 ls -l *.c ; make shell.exe ; exit
  276.  
  277.           Conditional command execution              Conditional command execution  
  278.  
  279.                If two commands are seperated by '&&', then the  second  will  be
  280.                executed only  if  the  first  returns 0 as an exit code.  If two
  281.                commands are seperated by '||', then the second will be  executed
  282.                only the first command returns non-zero as an exit code.  
  283.  
  284.                Example 
  285.  
  286.                    make shell.exe && chmod +w /bin/shell.exe && mv shell.exe /bin 
  287.  
  288.                    If  the  make operation fails, then the chmod and the mv will
  289.                    not be executed.  
  290.  
  291.                    make shell.exe || echo You blew it bub!
  292.  
  293.                    If the make operation fails, then the echo operation will  be
  294.                    executed.  
  295.  
  296.  
  297.           Character Escapes  Shell Comments  and Argument Quoting              Character Escapes, Shell Comments, and Argument Quoting  
  298.  
  299.                Any  character  preceded by a  \ (backslash) is copied unmodified
  300.                to the command buffer.  This allows you to suppress  the  special
  301.                meanings  of  shell  command characters, such as '|', ';', and '*
  302.                '.  
  303.  
  304.                # is the shell comment character.  Anything on a line after  a  #
  305.                character is ignored.  
  306.  
  307.                Command line arguments contained in quotes (single or double) may 
  308.                contain blank space (i.e. blanks or tabs).  Variable substitution 
  309.                will take  place  within strings surrounded by double quotes.  No
  310.                interpretation takes place within single quotes.   
  311.  
  312.                Within  double  quotes,  the  'C'   language   escape   sequences
  313.                \r,\n,\b,\f, and  \a are honored - i.e.  they are mapped to their
  314.                corresponding control characters.  
  315.  
  316.  
  317.           Startup and Script Files              Startup and Script Files  
  318.  
  319.  
  320.                If '-s' is specified on the command line the  program  will  look
  321.                for  a file called SHELL.RC in the current directory, and execute
  322.                it before passing  control to the console.  This  allows  you  to
  323.                set up  all  your alias commands.  It isn't a good idea to put an
  324.                'exit'  command  in  your  SHELL.RC  file,  as  the  shell   will
  325.                terminate.  
  326.  
  327.  
  328.                                               -4-
  329.  
  330.  
  331.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  332.  
  333.  
  334.                                                sh                                                Any file  whose  extension  is .sh is run as a command file.  The
  335.                environment string PATH is used to locate the script file  if  it
  336.                isn't in  the  current  directory.  .sp 1 There is also a command
  337.                sh                                                                                sh, into which shell scripts whose extension is not  .sh  can  be
  338.                redirected as standard input.  
  339.  
  340.                EXAMPLE
  341.  
  342.                %0 sh <batch.fil        # use the sh command
  343.                %1 shell <batch.fil     # run the external program
  344.  
  345.                                    bat                                                           Files  ending  in  .bat  files  are  passed  to  COMMAND.COM  for
  346.                execution.  
  347.  
  348.  
  349.           INPUT OUTPUT              INPUT/OUTPUT  
  350.  
  351.                                                          COMMAND COM                             I/O redirection operates as it does under COMMAND.COM  with  some
  352.                additional options: 
  353.  
  354.             name              <name 
  355.  
  356.                               name                                          Opens the file name as the standard input.  
  357.  
  358.              word              <<word 
  359.  
  360.                                                                            word                  reads  the  shell  input up to a line which is identical to word.
  361.                The resulting text is put into an anonymous temporary file, which 
  362.                is given to the command as standard input.  
  363.  
  364.                 name                 >name
  365.                  name                 >!name
  366.                  name                 >&name
  367.                   name                 >&!name
  368.  
  369.                             name                                                                     The file name  is used as standard output.    If  it  doesn't
  370.                    exist,  it's  created; if it exists, it is truncated, and its
  371.                    previous contents are lost.  
  372.  
  373.                                    NOCLOBBER                                                         If the variable NOCLOBBER is set, the file must  not  already
  374.                    exist, or  an  error results.  The forms using an exclamation
  375.                    point override the NOCLOBBER variable's action.  
  376.  
  377.                               name                                                                   The form >&name routes standard  error  along  with  standard
  378.                              name                        output to name.  
  379.  
  380.                  name                 >>name
  381.                   name                 >>!name
  382.                   name                 >>&name
  383.                    name                 >>&!name
  384.  
  385.                                     name                                                             Uses  the  file  name  as standard output, like >, but places
  386.                                                                NOCLOBBER                              output at the end of file.  If the variable NOCLOBBER is set, 
  387.                    it is an error if the file doesn't already exist.  The  forms
  388.                    using  an exclamation point override the NOCLOBBER variable's
  389.                    action.  
  390.  
  391.  
  392.  
  393.  
  394.                                               -5-
  395.  
  396.  
  397.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  398.  
  399.  
  400.               BUILT IN COMMANDS                  BUILT-IN COMMANDS  
  401.  
  402.  
  403.                    Some of the internal commands are  UNIX*  style  replacements
  404.                    for  COMMAND.COM internal commands, and some are included for
  405.                    convenience.  
  406.  
  407.                        Output of the 'commands' command
  408.  
  409.                        a:              alias           b:              c:
  410.                        cat             cd              chdir           chmod
  411.                        cls             commands        copy            cp
  412.                        d:              del             dir             dump
  413.                        e:              echo            era             erase
  414.                        error           exit            f:              fgrep
  415.                        g:              h:              hd              history
  416.                        i:              j:              ls              md
  417.                        mkdir           mon             more            mv
  418.                        popd            pushd           pwd             rd
  419.                        read            rm              rmdir           set
  420.                        sh              switchar        tee             touch
  421.                        unalias         version         y
  422.  
  423.                    There are many that are simply aliases, e.g.  'copy' and 'cp' 
  424.                    invoke the same program.  
  425.  
  426.  
  427.               COMMAND DESCRIPTION SYNTAX                  COMMAND DESCRIPTION SYNTAX  
  428.  
  429.                    terms used in syntax explanations :
  430.                    
  431.                    fname ::= PC-DOS ambiguous or unambiguous file or directory name.
  432.                    
  433.                    uname ::= unambiguous PC-DOS file or directory name
  434.                    
  435.                    string ::= any string of printable characters of arbitrary(<512) length.
  436.                    
  437.                    filelist ::= filename [filename .. filename]
  438.                    
  439.                    noargs ::= no arguments at all
  440.                    
  441.                    space ::= any white space characters
  442.                    
  443.                    [arg] ::= term is optional
  444.                    
  445.                    envstring ::=    <string>=<string> | <string><space>=<space><string> |
  446.                 <string><space><string>
  447.  
  448.  
  449.               COMMANDS                  COMMANDS  
  450.  
  451.  
  452.                    drive                     drive
  453.  
  454.                        a: | b: | c: | d: | e: | f: | g: | h: | i: | j: <noargs> 
  455.  
  456.                        changes default drive.  If you don't have such  a  drive,
  457.                        nothing happens.  
  458.  
  459.  
  460.                                               -6-
  461.  
  462.  
  463.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  464.  
  465.  
  466.                    alias                     alias
  467.  
  468.                        alias <envstring> 
  469.  
  470.                        assigns cmdstring  to name.  name can now be used just as
  471.                        if it were a built-in or external command.  cmdstring may 
  472.                        contain history expressions or variable substitutions.  
  473.  
  474.                        The syntax of this command is flexible - you can  specify
  475.                        alii  (?)  in  the form 'name=subst','name subst','name =
  476.                        subst', or  'name  =subst.'  However  you  need  a  space
  477.                                   before                                                                 character  before  a  single quote in order to specify an
  478.                        alias that contains blanks.  
  479.  
  480.                            alias     set                                                                 The alias and set commands  are  case  sensitive,  unlike
  481.                                         COMMAND COM                            their analogs in COMMAND.COM.  
  482.  
  483.                    cat                     cat
  484.  
  485.                        cat [<filelist>] 
  486.  
  487.                        copies specified  files  to standard output.  If none are
  488.                        given, copies standard input to standard output 
  489.  
  490.                    cp                     cp
  491.  
  492.                        cp | copy <filelist> <uname> 
  493.  
  494.                        copies specified files to destination file or device.  If 
  495.                        more than one file is in the file list, <uname> must be a 
  496.                        directory.  
  497.  
  498.                    cd                     cd
  499.  
  500.                        cd | chdir <dirname> 
  501.  
  502.                        makes <dirname> the current default directory.  
  503.  
  504.                    chmod                     chmod
  505.  
  506.                        chmod [-|+[arwhs]*] <filelist> 
  507.  
  508.                        change file permissions for specified files 
  509.  
  510.                        +r, -r turn on or off read permission - i.e. hide the file.
  511.                        +w, -w turn on or off write permission.
  512.                        +h, -h turn on or off hidden attribute - converse of r
  513.                        +a, -a turn on or off archive attribute
  514.                        +s, -s turns on or off the system attribute
  515.  
  516.                        Note that '-r'  or  '+rwh'  are  both  valid  syntax  for
  517.                        switches.   Also  new permission switches are permissable
  518.                        between file names with the following  warning:  I  don't
  519.                        reset the masks between file names - if you have a second 
  520.                        batch  of  attribute  changes  on  the  command line, the
  521.                        effect is additive.  If you're  not  careful,  you  could
  522.                        make a mess of a files attributes.  
  523.  
  524.  
  525.  
  526.                                               -7-
  527.  
  528.  
  529.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  530.  
  531.  
  532.                        If   you  don't  specify  any  attribute  switches,  file
  533.                        attributes will be set to 0, which  means  read,write,not
  534.                        hidden,not system, not  modified since last backup.  
  535.  
  536.                    cls                     cls
  537.  
  538.                        cls <noargs> 
  539.  
  540.                        clears the screen and homes the cursor.  
  541.  
  542.                    commands                     commands
  543.  
  544.                        commands <noargs> 
  545.  
  546.                        prints a  table  of  available  built-in  commands.  (see
  547.                        above) 
  548.  
  549.                    del                     del
  550.  
  551.                        del 
  552.  
  553.                        synonym for rm.  
  554.  
  555.                    dir                     dir
  556.  
  557.                        dir 
  558.  
  559.                        synonym for ls.  
  560.  
  561.                    dirs                     dirs
  562.  
  563.                        dirs <noargs> 
  564.  
  565.                        lists the directories on the directory stack.  (see pushd 
  566.                        and popd) 
  567.  
  568.                    du                     du
  569.  
  570.                        du [drivename] 
  571.  
  572.                                                             drivename                                    prints out remaining space on drive  drivename.   If  you
  573.                        leave  off  the  drivename,  it  defaults  to the current
  574.                        drive.  
  575.  
  576.                    dump                     dump
  577.  
  578.  
  579.                        dump filespec [block [page]] | [segment:[offset]] [count] 
  580.  
  581.                        Where a block is 64K bytes and a page is 256 bytes
  582.                        Segment:offset are standard 8086 notation in hexadecimal
  583.                        Count is the number of bytes to dump in decimal
  584.  
  585.                        This came from some anonymous public domain source, ported by me
  586.  
  587.                    echo                     echo
  588.  
  589.                        echo <anything> 
  590.  
  591.  
  592.                                               -8-
  593.  
  594.  
  595.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  596.  
  597.  
  598.                                                            echo  on                                      echos argument list  to  screen.    echo  on  causes  all
  599.                        commands  to  be  echoed  before execution (i.e. sets the
  600.                                         echo off                                                       verbose  flag).  echo off turns off the verbose flag.  
  601.  
  602.                    era                     era
  603.  
  604.                        era 
  605.  
  606.                        synonym for rm.  
  607.  
  608.                    error                     error
  609.  
  610.                        error <noargs> 
  611.  
  612.                        prints returned value of last command to the screen.  
  613.  
  614.                    exit                     exit
  615.  
  616.                        exit <noargs> 
  617.  
  618.                        terminates execution of the currently running  sub-shell.
  619.                        If  you are at top level of execution, you will return to
  620.                        dos.  
  621.  
  622.                    fgrep                     fgrep
  623.  
  624.                        fgrep <pattern> <filelist> 
  625.  
  626.                        looks for unambiguous pattern  <pattern>  in  <filelist>.
  627.                        echos lines matching to the screen.  
  628.  
  629.                    history                     history
  630.  
  631.                        history [size] 
  632.  
  633.                                                                          size                            prints history  list  to  standard  output.    If size is
  634.                        given, the number of commands history remembers is set to 
  635.                        size                                                                              size.  If you change  the  size,  history  'forgets'  all
  636.                        previous commands and resets its counters to 0.  
  637.  
  638.                    ls                     ls
  639.  
  640.                        ls | dir [-[alqctrR]] <filelist> 
  641.  
  642.                        Lists files that match <filelist> 
  643.  
  644.                        -a all files, including system files are listed.  '.' and 
  645.                        '..'  are  suppressed,  but you know they're there if you
  646.                        need them, don't you?  
  647.                        -l prints out file times, permissions, etc 
  648.                        -q suppresses header line from display - useful when  you
  649.                        want to pipe stuff into another program.  
  650.                        -c print as one column.  
  651.                        -t sort by time, most recent last 
  652.                        -R recurse through all encountered subdirectories.  
  653.                        -r reverses sort order.  
  654.  
  655.                    md                     md
  656.  
  657.  
  658.                                               -9-
  659.  
  660.  
  661.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  662.  
  663.  
  664.                        md | mkdir <uname> 
  665.  
  666.                        make a directory.  Prints an error if it can't be done 
  667.  
  668.                    mon                     mon
  669.  
  670.                        mon <noargs> 
  671.  
  672.                        mon                                                                                mon prints to standard error a lot of cryptic information 
  673.                        on system variables thusly: 
  674.  
  675.                            Corg : 0000 Cend : 715a Dorg : 0002 Dend 167a
  676.                            Uorg : 167a Uend : 327a mbot : 427c mtop 4800
  677.                            sbot : 0000 PSP  : 490d STKSIZ : 00256 HEAPSIZ : 00064
  678.                            dsval : 5033 csval : 491d
  679.                            STKLOW : 0001 MEMRY : 4680
  680.                            CS : 491d DS : 5033 SP : 4186
  681.  
  682.                        You  can  probably  figure out what most of the variables
  683.                        mean.  If you have source and have broken the shell, this 
  684.                        command may help.  
  685.  
  686.                    more                     more
  687.  
  688.                        more [-[0-9]*] [<filelist>] 
  689.  
  690.                        List file to screen with pauses 
  691.  
  692.                        -n specify tab width when expanding tabs, where n  is  an
  693.                        integer.   more acts like 'cat' when redirected - you can
  694.                        concatenate files in  this  manner.    If  no  files  are
  695.                        specifed, standard input is 'mored.' 
  696.  
  697.                    mv                     mv
  698.  
  699.                        mv [-v] <filelist> <uname> 
  700.  
  701.                        moves  specified  file  or  files  to  target specifed by
  702.                        <uname>.  If there is more than one file in list, <uname> 
  703.                        must be a directory 
  704.  
  705.                         v                                                                                -v  will  print  out  a  message   saying   how   it   is
  706.                        accomplishing   the   move,   which   is   probably  more
  707.                        interesting to me than you.  
  708.  
  709.                    popd                     popd
  710.  
  711.                        popd <noargs> 
  712.  
  713.                        returns to directory at top of directory stack.  
  714.  
  715.                    pushd                     pushd
  716.  
  717.                        pushd <uname> 
  718.  
  719.                        save current working directory on  directory  stack,  and
  720.                        changes current working directory to <uname>.  
  721.  
  722.  
  723.  
  724.                                              -10-
  725.  
  726.  
  727.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  728.  
  729.  
  730.                    pwd                     pwd
  731.  
  732.                        pwd 
  733.  
  734.                        prints current working directory to standard output.  
  735.  
  736.                    read                     read
  737.  
  738.                        read vname0 [vname1 .. vnamen] 
  739.  
  740.                        read                                                                              read  reads  a line from standard input, and assigns each
  741.                        word from  the  line  to  the  corresponding  environment
  742.                                               vname0          vnamen                            variable specified by  vname0  through vnamen.  
  743.  
  744.                        EXAMPLE 
  745.  
  746.                            read a b    # read into environment variables a and b
  747.                        you type
  748.                            hello there
  749.                            echo $a
  750.                        the shell echos
  751.                            hello
  752.                            echo $b
  753.                        there
  754.  
  755.                        If there are fewer environment variables specified on the 
  756.                        command  line  than  there are words in the command line,
  757.                        the last environment variable will contain  the  rest  of
  758.                        the words on the line.  
  759.  
  760.                        EXAMPLE 
  761.  
  762.                            read a b    # read into environment variables a and b
  763.                        you type
  764.                            hello there Mister Jones
  765.                            echo $a
  766.                        the shell echos
  767.                            hello
  768.                            echo $b
  769.                        there Mister Jones
  770.  
  771.                        If  there  are  more environment variables on the command
  772.                        line than words on the line read from standard input, the 
  773.                        left-over environment variables' state will not change  -
  774.                        if  they  were  defined in the environment already, their
  775.                        status won't change, and if they  weren't  defined,  they
  776.                        stay undefined.  
  777.  
  778.                    rd                     rd
  779.  
  780.                        rd | rmdir <uname> 
  781.  
  782.                        remove specified directory if possible.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.                                              -11-
  791.  
  792.  
  793.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  794.  
  795.  
  796.                    rm                     rm
  797.  
  798.                        rm [-q] <filelist> 
  799.  
  800.                        blows  away  all files in <filelist>. If -q is specified,
  801.                        will ask if they should be removed.  
  802.  
  803.                    set                     set
  804.  
  805.                        set [<envstring>] 
  806.  
  807.                        sets a string in the environment.  If you specify 'name=' 
  808.                        with  no  string  after,  it  will  remove  it  from  the
  809.                        environment.   If  you don't specify a string, set prints
  810.                        out current environment.  
  811.  
  812.                        The syntax of this command is flexible - you can  specify
  813.                        set  in  the  form 'set name=subst','set name subst','set
  814.                        name = subst', or 'set name =subst.' However you  need  a
  815.                                        before                                                             space character before a single quote in order to specify 
  816.                        a substitution string that contains blanks.  
  817.  
  818.                    sh                     sh
  819.  
  820.                        sh [ <arg1> .. <argn>] <scriptfile 
  821.  
  822.                        forks a  'local'  shell  -  i.e.    saves  all  pertinent
  823.                        information about  the  shell  you're  currently  in  and
  824.                        invokes  the command processor function recursively, with
  825.                        scriptfile                                                                        scriptfile as input.  The  arguments  are  copied  to  $1
  826.                        through  $N  environment strings, overwriting the startup
  827.                        arguments.  
  828.  
  829.                        sh                                                                                sh gives you a way to run  scripts,  without  loading  an
  830.                        extra copy of shell.com or small.com.  
  831.  
  832.                    switchar                     switchar
  833.  
  834.                        switchar [schar] 
  835.  
  836.                                                          schar      schar                                sets the  DOS switch character to schar.  If schar is not
  837.                        given, the current switch character is echoed.  
  838.  
  839.                    tee                     tee
  840.  
  841.                        tee <uname> 
  842.  
  843.                        Copies standard input to standard  output,  depositing  a
  844.                        copy in <uname> 
  845.  
  846.                    touch                     touch
  847.  
  848.                        touch <filelist> 
  849.  
  850.                        Makes  the  modification  time  of  specified  files  the
  851.                        current date and time.  
  852.  
  853.                    unalias                     unalias
  854.  
  855.  
  856.                                              -12-
  857.  
  858.  
  859.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  860.  
  861.  
  862.                        unalias aliasname 
  863.  
  864.                        remove alias name from the alias list.  
  865.  
  866.                    y                     y
  867.  
  868.                        y <filelist> 
  869.  
  870.                        copies standard input to standard output, and then copies 
  871.                        the specified files to standard  output.    Sort  of  the
  872.                        opposite of tee, in other words.  
  873.  
  874.  
  875.               The Small Shell                  The Small Shell  
  876.  
  877.  
  878.                    Included  in release 2.0 or later is a 'small' version of the
  879.                    shell.   This version will take up less than 30K of memory at 
  880.                     runtime (as verified by chkdsk).  What's the catch?    Well,
  881.                    ls,  cp,  mv, more, fgrep, and dump become external commands.
  882.                    I am not going to distribute these commands; you  can  either
  883.                    make  them    yourself,  or  you can use whatever you have on
  884.                    hand.  If you need to use the COMMAND.COM copy facility,  try
  885.                    putting these commands in your SHELL.RC file 
  886.  
  887.                    alias cp 'command -c copy'
  888.                    alias ls 'command -c dir -w | sort'
  889.  
  890.                    The   removed   commands   accounted  for  over  10K  of  the
  891.                    shell.com.  
  892.  
  893.               Helpful hints                  Helpful hints  
  894.  
  895.  
  896.                    Use forward slashes in all path names.  (See  note  below  on
  897.                    switch  characters)    If  you  use  DOS  3.0 or higher, this
  898.                    includes paths to transient programs.  
  899.  
  900.                    put single quotes around arguments with semicolons  in  them,
  901.                    so they don't turn into command delimiters.  
  902.  
  903.                    The  set  command affects only the local shell's environment.
  904.                    You can 'exit' to command.com and the original environment is 
  905.                    intact.  The  local  environment  is  2K  large  -  which  is
  906.                    useful.  
  907.  
  908.                    When  using  the  Microsoft  C  compiler  under pc-shell, the
  909.                    compiler has a bad habit of  look  for  parameters  beginning
  910.                    with forward  slashes  in  the environment.  If you get their
  911.                    famous  'P0  :  bad  option'  message,   try   revising   the
  912.                    environment.  
  913.  
  914.  
  915.               Implementation notes                  Implementation notes  
  916.  
  917.  
  918.                    DOS  doesn't  acknowledge  a  'change  default drive' command
  919.                    until you issue a 'get current directory' call.   Why?    The
  920.  
  921.  
  922.                                              -13-
  923.  
  924.  
  925.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  926.  
  927.  
  928.                    only way I figured this out is by disassembling command.com.  
  929.  
  930.                    PC|MS-DOS has  a  limit  of  20  file  handles.  If you add a
  931.                    command that opens files, make sure you catch the  ctrl-break
  932.                    signal and close them.  Look at CAT.C or Y.C for examples.  
  933.  
  934.                    DON'T  REDIRECT  INPUT  INTO  PRINT. Print gets all hosed up.
  935.                    Print has lots of trouble in general with the  pc-shell,  and
  936.                    should be avoided.  
  937.  
  938.               BUGS                  BUGS  
  939.  
  940.  
  941.                    Due  to  the way that environment strings are expanded on the
  942.                    command line, semicolons inside  shell  variables  look  like
  943.                    command seperators.    If  you enclose them in double quotes,
  944.                    the problem will go away.  
  945.  
  946.                    I have noticed intermittent problems running on an  AT,  with
  947.                    DOS  3.0,  but  have been unable to reproduce them on a PC. I
  948.                    suspect bugs in DOS 3.0 that are absent in 3.1. If you notice 
  949.                    any consistent problems, send  me a bug report.  
  950.  
  951.               HISTORY                  HISTORY  
  952.  
  953.  
  954.  
  955.                   V 2 0                      V 2.0  
  956.  
  957.                        Minor bug fixes.  Started allocating command buffers  out
  958.                        of heap rather than stack, reducing stack usage.  Stopped 
  959.                        releasing source with executables.  
  960.  
  961.                   V 2 1                      V 2.1  
  962.  
  963.                        Fixed the bug that made "mv foo .." throw away the source 
  964.                        file and  move  it to "..foo", (i.e. nowhere).  Added the
  965.                        sh command,  that  allows  you  to  run  scripts  without
  966.                        re-invoking the shell.  
  967.  
  968.                   V 2 2                      V 2.2  
  969.  
  970.                        Fixed  the bug that locked pc up when a command line with
  971.                        a leading ; was entered.  Changed fork code so that files 
  972.                        with the extension .sh are run as scripts.    The  equals
  973.                        sign in alias and set is now optional.  
  974.  
  975.                   V 2 3                      V 2.3  
  976.  
  977.                        Removed  information  about versions 1.0 through 1.6 from
  978.                        documentation, adding any relevant material to  the  tips
  979.                        or implementation  notes sections.   Added redirection of
  980.                        standard error, and checking for  NOCLOBBER.  Implemented
  981.                        execution of the prompt string.  
  982.  
  983.  
  984.                   V 2 4                      V 2.4  
  985.  
  986.  
  987.  
  988.                                              -14-
  989.  
  990.  
  991.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  992.  
  993.  
  994.                        The  problem running external programs written by IBM and
  995.                        Microsoft  has  finally  been  traced  to  Aztecs  fexecv
  996.                        function.   When  is  an  ASCIIZ  string  not  an  ASCIIZ
  997.                        string?  When you need to put a single carriage return on 
  998.                        the end of it.  THANKS to Programmers Journal. NOTE  WELL
  999.                        that  needing  a carriage return in your command tail for
  1000.                        EXEC calls is note documented in the IBM PC-DOS technical 
  1001.                        reference.  
  1002.  
  1003.                        All references to the  Aztec  screen  library  have  been
  1004.                        removed,  so  this  should  work  on Rainbows, Compupros,
  1005.                        AMPROs etc.  etc.  etc.  ls is slower, but  its  a  small
  1006.                        price to  pay.    If  you want a fast version, one can be
  1007.                        created for you if you mail a contribution (hint,hint).  
  1008.  
  1009.                        mv now will do the right thing when you try to move to  a
  1010.                        drive  that  has been joined to a directory (DOS 3.1). It
  1011.                        also now has a  verbose  switch,  which  tells  you  what
  1012.                        exactly its doing.  When I started writing a mv, I had no 
  1013.                        idea  how  many  special  cases I would have to take care
  1014.                        of.  
  1015.  
  1016.                   V 2 5                      V 2.5  
  1017.  
  1018.                        Problem with using the wrong path to search for  external
  1019.                        programs solved.    Main  command line parsing changed so
  1020.                        that  NOGLOB  could  be  used  to  suppress   file   name
  1021.                        expansion.  
  1022.  
  1023.                   V 2 6                      V 2.6  
  1024.  
  1025.                        Many stupid  bugs  in 2.5 are addressed (sorry folks).  I
  1026.                        now peek inside double quotes to do  variable  expansion.
  1027.                        Double quotes are now stripped.  
  1028.  
  1029.                   V 2 7                      V 2.7  
  1030.  
  1031.                        Added read.    Fixed  bug  in  ls that would occasionally
  1032.                        leave you in a different directory.    The  exit  command
  1033.                        will  now  just  pop  you out a level of shell execution,
  1034.                        rather than kicking you out to the DOS prompt.  
  1035.  
  1036.                   V 2 8                      V 2.8  
  1037.  
  1038.                        Fixed bug  in  more  that  made  it  puke  when  you  hit
  1039.                        <CTRL>-<BREAK> at the bottom of a screen-full.  Made move 
  1040.                        and  cp  preserve  file  times when they have to create a
  1041.                        target.  
  1042.  
  1043.                   V 2 9                      V 2.9  
  1044.  
  1045.                        Fixed bug in ls that caused it to get confused  when  you
  1046.                        did an  'ls  -R'  on  a  drive other than default.  Also,
  1047.                        stopped it from hanging on an empty pipe.  Added the 'du' 
  1048.                        command - which is simply the last line of ls  -l.  Shell
  1049.                        scripts will now be searched for on PATH.  
  1050.  
  1051.                   V 3 0                      V 3.0  
  1052.  
  1053.  
  1054.                                              -15-
  1055.  
  1056.  
  1057.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1058.  
  1059.  
  1060.                        Bug  fixed  : when you switched to a disk for which there
  1061.                        was no /tmp directory, the shell couldn't open  its  pipe
  1062.                        files.    Now  pipe  files  are  opened  in  the  default
  1063.                        directory.  If you have a better idea, let me know.  
  1064.  
  1065.                        Added a critical error handler - if you  get  the  abort,
  1066.                        retry, ignore message and abort, you return to the shell, 
  1067.                        rather than  to  DOS.  It is possible that all the memory
  1068.                        allocated during the execution of the  offending  command
  1069.                        may  not  be freed, in which case the shell could run out
  1070.                        of memory.  Just give it the exit command  and  re-invoke
  1071.                        if that happens.  
  1072.  
  1073.                        If  you  type something that the shell can't interpret as
  1074.                        an internal command, run as  an  external  program  or  a
  1075.                        script, I  give  command.com  a  crack  at  it.   You can
  1076.                        therefore now run dos batch files  transparently.    This
  1077.                        slows  things  down  somewhat  if  you type totally bogus
  1078.                        commands, so this feature can be  turned  off  with  "set
  1079.                        NODOS=1".  
  1080.  
  1081.                   V 3 1                      V 3.1  
  1082.  
  1083.                        Some general  cleanup.    Added  a function that makes an
  1084.                        absolute path from any relative path,  which  cleaned  up
  1085.                        mv, ls, and cp quite a bit.  
  1086.  
  1087.                        Went back  to  .com  format for pc-shell and small.  This
  1088.                        makes the archive file about 1K smaller on average.  
  1089.  
  1090.                   V 3 2                      V 3.2  
  1091.  
  1092.                               b                                                                          Added -b option in hopes of being  more  compatible  with
  1093.                        recalcitrant   software  (like  PC-NET)  that  chokes  on
  1094.                        forward slashes in paths.  It should be  noted  that  DOS
  1095.                        2.XX  versions  don't  like  forward  slashes in the PATH
  1096.                        environment string.  
  1097.  
  1098.                        Stopped closing standard handles  3  and  4  on  startup.
  1099.                        This  should  make  weird  things  like  Wordstar printer
  1100.                        output being redirected to the screen go away.  
  1101.  
  1102.                        Single or double quotes around redirected file names  are
  1103.                        now permitted.  
  1104.  
  1105.                   LICENCING STATEMENT                      LICENCING STATEMENT  
  1106.  
  1107.                        PC-SHELL is  not in the public domain.  I, Kent Williams,
  1108.                        retain  all  rights  of   ownership   over   source   and
  1109.                        executables,  unless I explicitly transfer such rights to
  1110.                        someone else.  
  1111.  
  1112.                        All persons who come into possesion of  PC-SHELL  in  the
  1113.                        binary-only  version  are entitled to use it however they
  1114.                        wish.  No warranty is given or implied.  All persons  who
  1115.                        come  into  possesion  of  PC-SHELL  are also entitled to
  1116.                        redistribute  the  package  in  any  way  they  see   fit
  1117.                        providing that 
  1118.  
  1119.  
  1120.                                              -16-
  1121.  
  1122.  
  1123.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1124.  
  1125.  
  1126.                             1) The  package  is  distributed intact.  This means
  1127.                             that  the  archive  file  or  distribution  diskette
  1128.                             contains  PC-SHELL.COM, SMALL.COM and SHELL.DOC, and
  1129.                             that no changes have  been  made  to  any  of  these
  1130.                             files.  
  1131.  
  1132.                             2)  That no charge is made, beyond a nominal fee for
  1133.                             media duplication.  
  1134.  
  1135.                        The  above  three  paragraphs   constitute   an   limited
  1136.                        non-commercial licence to PC-SHELL binaries to anyone who 
  1137.                        obtains it.    This  distiguishes  it  from  being public
  1138.                        domain only in that I retain enough control  over  it  to
  1139.                        protect my own interests.  (Take heart, hackers!) 
  1140.  
  1141.                        All  person  who obtain copies of source code are granted
  1142.                        unlimited noncommercial use thereof.   This  source  code
  1143.                        licence  is not transferrable to any other party, for any
  1144.                        reason.  
  1145.  
  1146.                        In addition, no modified versions of the program PC-SHELL 
  1147.                        may  be  distributed  by  commercial  or   non-commercial
  1148.                        means.  
  1149.  
  1150.                        Any  company  wishing  to  purchase  source  licenses are
  1151.                        subject to these further restrictions.  
  1152.  
  1153.                             1) That no part of the source code is used,  in  any
  1154.                             form in any program sold commercially.  
  1155.  
  1156.                             2)  That  a  licence  fee will be paid for each user
  1157.                             within a company of PC-SHELL, according to the  rate
  1158.                        schedule below.  
  1159.  
  1160.                   PRICING                      PRICING  
  1161.  
  1162.                        Noncommercial Personal Use - 25.00$
  1163.                        Commercial User    - 25.00$, plus 15.00$ per each additional user.
  1164.                        Commercial Distribution - by written agreement only
  1165.  
  1166.                             For the above prices you will receive: 
  1167.  
  1168.                             1) Complete source code for shell, with makefile 
  1169.                             2) Source and executable for the text formatter used 
  1170.                             to prepare this documentation.  NOTE: I didn't write 
  1171.                             this  program,  and  am distributing it as a service
  1172.                             only.  
  1173.  
  1174.                             3) Executable and documentation for NDMAKE, the best 
  1175.                             make available for love or money on PC-DOS. This  is
  1176.                             distributed as  a  service  only.   Please honor the
  1177.                             author's request for donations.  
  1178.  
  1179.                             4) Source for as many other Unix Utilities  as  will
  1180.                             fit on  the disk.  Currently I am distributing grep,
  1181.                             calls, fgrep, cut, paste, tail, ctags.   I  did  not
  1182.                             write  these programs, and am distributing them as a
  1183.                             service only.  
  1184.  
  1185.  
  1186.                                              -17-
  1187.  
  1188.  
  1189.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1190.  
  1191.  
  1192.                             As always, miscellaneous contributions are  welcome.
  1193.                             As  anyone  who  has  contacted  me is aware, I will
  1194.                             provide as much help  as  I  can,  in  fixing  bugs,
  1195.                             providing   updates,   taking   suggestions,   etc.,
  1196.                             regardless of monetary arrangements.  
  1197.  
  1198.                             QUESTIONS COMMENTS BUGREPORTS GOTO 
  1199.                             KENT WILLIAMS
  1200.                             722 Rundell St.
  1201.                             Iowa City, IA 52240
  1202.                             (319) 338-6053 (HOME VOICE)
  1203.                             
  1204.                             * UNIX is an unregistered trademark of AT&T.
  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.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                                              -18-
  1253.  
  1254.