home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / cli / sksh017.lzh / doc / ExtCmds.doc < prev    next >
Encoding:
Text File  |  1991-05-04  |  51.2 KB  |  2,311 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                       External Command Reference
  18.  
  19.                                  SKsh
  20.  
  21.                     A ksh-like Shell for the Amiga
  22.  
  23.                               Version 1.7
  24.  
  25.  
  26.                          (Copyright) 1988-1991
  27.  
  28.                               Steve Koren
  29.  
  30.                               May 4, 1991
  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.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.        Table of Contents
  74.  
  75.         Introduction......................................3
  76.         cat...............................................4
  77.         cmp...............................................5
  78.         cp................................................6
  79.         crc...............................................7
  80.         cut...............................................8
  81.         doc2man...........................................9
  82.         du................................................10
  83.         encr..............................................11
  84.         fgrep.............................................12
  85.         find..............................................14
  86.         grep..............................................18
  87.         head..............................................20
  88.         indent............................................21
  89.         join..............................................22
  90.         num...............................................23
  91.         split.............................................24
  92.         srun..............................................25
  93.         strings...........................................26
  94.         tail..............................................27
  95.         tee...............................................28
  96.         view..............................................29
  97.         wc................................................30
  98.         window............................................31
  99.         xargs.............................................32
  100.         xd................................................35
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.        SKsh Amiga Shell             Page 2       External Cmd Reference
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.        Introduction
  140.  
  141.      This reference manual describes each SKsh external  command  in
  142.      a  concise  manner.    Each   page   contains   the   following
  143.      information:
  144.  
  145.      Name:     The name of the command.
  146.  
  147.      Type:     Always External Command for  this  document;  may  be
  148.                something else in the reference manual.
  149.  
  150.      Default:  Default parameters, if applicable.
  151.  
  152.      Usage:    Command syntax
  153.  
  154.      Range:    Legal values for variables or parameters
  155.  
  156.      About:    Text describing the command, variable, etc.
  157.  
  158.      Example:  A brief example usage.
  159.  
  160.      See Also: Other related commands, variables, etc.
  161.  
  162.      When  reading  the  command syntax, anything in square brackets
  163.      is  optional.   Anything followed by three dots can be repeated
  164.      any  number of times.   A  vertical bar is used to separate op-
  165.      tion where one or the other, but not both, can be used.
  166.  
  167.      In general, 'command -a -b' is equilivant to 'command -ab'.
  168.  
  169.      All external commands were re-written in SKsh 1.4  to  be  much
  170.      smaller and faster than their  earlier  counterparts.   In  1.5
  171.      they are slightly smaller yet.
  172.  
  173.      All  commands will print a usage message if given "-?" as their
  174.      first argument.  It is best to quote this in the shell, as  "?"
  175.      is a wildcard character.
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.        SKsh Amiga Shell             Page 3       External Cmd Reference
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.        ________________________________________________________________
  206.  
  207.      Name:     cat
  208.  
  209.      Type:     External Command
  210.  
  211.      Default:  n/a
  212.  
  213.      Usage:    cat [ file ... ]
  214.  
  215.      Range:    n/a
  216.  
  217.      About:    cat  copies the files named on the  command line to
  218.                its  standard output.  If no files  are  named,  it
  219.                copies the standard input to the standard output.
  220.  
  221.                The  cat  external command is provided as an alter-
  222.                native to  the  builtin form; this one can copy bi-
  223.                nary data as well as ASCII data and is much  faster
  224.                when the output is redirected to a file.
  225.  
  226.                To use the  external cat command by default, insert
  227.                the following line into your .skshrc file:
  228.  
  229.                   unset -b cat
  230.  
  231.      Example:  cat myfile.foo
  232.  
  233.      See Also: The cat command entry in Reference.doc
  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.  
  259.  
  260.  
  261.        SKsh Amiga Shell             Page 4       External Cmd Reference
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.        ________________________________________________________________
  272.  
  273.      Name:     cmp
  274.  
  275.      Type:     External Command
  276.  
  277.      Default:  n/a
  278.  
  279.      Usage:    cmp [ -s ] file1 file2
  280.  
  281.      Range:    n/a
  282.  
  283.      About:    cmp  compares two files for equality.   It  can  be
  284.                used  on  binary as well  as  textual data.  cmp is
  285.                fast in that if the files are not  the  same  size,
  286.                it won't even bother  comparing the contents of the
  287.                files.    cmp normally outputs a message that indi-
  288.                cates whether the files are  the  same,  different,
  289.                or one is shorter than the other.  If  the  -s  op-
  290.                tion is  used,  compare does not output this infor-
  291.                mation,  but  simply  returns a zero exit status if
  292.                the files were the same, or non-zero if  they  were
  293.                not.
  294.  
  295.      Example:  if cmp -s file1 file2
  296.                then
  297.                   echo 'file1 is the same as file2'
  298.                else
  299.                   echo 'file1 is different than file2'
  300.                fi
  301.  
  302.      See Also:
  303.  
  304.        ________________________________________________________________
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.        SKsh Amiga Shell             Page 5       External Cmd Reference
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.        ________________________________________________________________
  338.  
  339.      Name:     cp
  340.  
  341.      Type:     External Command
  342.  
  343.      Default:  n/a
  344.  
  345.      Usage:    cp [ -nuv ] file { file | dir }
  346.                cp [ -nruv ] { file | dir } ... dir
  347.  
  348.      Range:    n/a
  349.  
  350.      About:    cp  copies files from one place to another, option-
  351.                ally  renaming them in the process.  If the  desti-
  352.                nation  is  a  directory, the files have  the  same
  353.                name  in  the  destination directory.  If more than
  354.                one file is  copied, the destination must be either
  355.                a  directory or nonexistant.  If it is nonexistant,
  356.                it is created as a directory.
  357.  
  358.                The -r flag causes cp to perform a recursive copy. 
  359.  
  360.                The -v flag prints the name of each file as  it  is
  361.                copied.
  362.  
  363.                The -n flag causes cp NOT  to  duplicate file modi-
  364.                fication times  and  protection flags on the desti-
  365.                nation files.  If you wish to  make  this  the  de-
  366.                fault behavior, use this alias:
  367.  
  368.                   alias cp='$(which cp) -n'
  369.  
  370.                cp  will  reset the AmigaDos archive bit whether or
  371.                not the -v flag is used.
  372.  
  373.                The -u flag causes  cp to operate in "update" mode;
  374.                only files with a newer  timestamp than their asso-
  375.                ciated destination are copied.
  376.  
  377.  
  378.      Example:  cp my_file1 m_file2 my_file3 my_directory
  379.  
  380.      Warnings:  The -c (clone) flag was obsoleted in SKsh 1.4.  It
  381.                is still  accepted for backward compatibility; how-
  382.                ever, it is ignored.   Use  the  -n  option to turn
  383.                off the clone behaviour.
  384.  
  385.                The  cp  command was changed to an  external binary
  386.                in SKsh 1.4.  It used to be a builtin.
  387.  
  388.      See Also: mv
  389.  
  390.        ________________________________________________________________
  391.  
  392.  
  393.        SKsh Amiga Shell             Page 6       External Cmd Reference
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.        ________________________________________________________________
  404.  
  405.      Name:     crc
  406.  
  407.      Type:     External Command
  408.  
  409.      Default:  n/a
  410.  
  411.      Usage:    crc [ -q ] [ file... ]
  412.  
  413.      Range:    n/a
  414.  
  415.      About:    crc  generates several 32 bit values which are com-
  416.                puted from a file's contents.  These  values can be
  417.                used  to  check  the  integrity of files which  are
  418.                transfered over a  medium of questionable reliabil-
  419.                ity (such as phone lines).
  420.  
  421.                If the -q switch is  given,  crc will not print the
  422.                file name.  This is  useful in scripts to check the
  423.                validity  of  a  file  by  comparing  crc output to
  424.                known good values.  If not given  any  file  names,
  425.                crc will read its standard input.
  426.  
  427.      Example:  crc a_file another_file
  428.  
  429.      See Also:
  430.  
  431.        ________________________________________________________________
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.        SKsh Amiga Shell             Page 7       External Cmd Reference
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.        ________________________________________________________________
  470.  
  471.      Name:     cut
  472.  
  473.      Type:     External Command
  474.  
  475.      Default:  n/a
  476.  
  477.      Usage:    cut [ -flist [ -dchar ] | -clist ] [ file ... ]
  478.  
  479.      Range:    n/a
  480.  
  481.      About:    Cut  is  used  for  making vertical slices though a
  482.                file based  on  character position or on fields de-
  483.                limited  by  a  defined character.  It can also  be
  484.                used  to  re-order  characters or fields  within  a
  485.                file.
  486.  
  487.                The -c  option cuts based on character positions in
  488.                the  line.   For  example, "-c1,5-10,20" would copy
  489.                characters one, five though ten,  and  twenty  from
  490.                each  input line  to  the  output line. If the list
  491.                begins  with  a  dash  (for  example, "-c-10")  the
  492.                first item is used  implicitly (1 though 10 in this
  493.                case).    Characters  beyond the end  of  line  are
  494.                ignored.
  495.  
  496.                The  -f  option cuts based on field position within
  497.                a line.  Fields are  separated by the tab character
  498.                by  default, but this can be changed  with  the  -d
  499.                option.   For  example, "-d:" would use colon sepa-
  500.                rated fields.   Repeated strings of the field sepa-
  501.                rator  indicate empty  fields.   Fields  beyond the
  502.                last in the record are ignored.
  503.  
  504.                No  space  may  occur between the -d option and the
  505.                field  separator character, or between the -f or -c
  506.                options and the list.
  507.  
  508.  
  509.  
  510.      Example:  cut -c1-10,15,20-50 myfile.txt
  511.                cut -f1,3,5-7 -d: myfile1.txt
  512.  
  513.      See Also:
  514.  
  515.        ________________________________________________________________
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.        SKsh Amiga Shell             Page 8       External Cmd Reference
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.        ________________________________________________________________
  536.  
  537.      Name:     doc2man
  538.  
  539.      Type:     External Command
  540.  
  541.      Default:  n/a
  542.  
  543.      Usage:    doc2man [ -?V ] | [ docfile ... ]
  544.  
  545.      Range:    n/a
  546.  
  547.      About:    This  command,  unlike  most  others in SKsh, has a
  548.                somewhat  limited use.   It  is  designed to divide
  549.                the Reference.doc and ExtCmds.doc files into  sepa-
  550.                rate manpage entries for use by the man command.
  551.  
  552.                This  command is used  by  the  install script, and
  553.                may be also  used  manually.   However, it is picky
  554.                about  the  format of the input files, and will not
  555.                accept any file not in the exact right format.
  556.  
  557.                The  resulting files are put in the MAN:SKsh direc-
  558.                tory, which must exist when the script is run.
  559.  
  560.      Example:  doc2man ExtCmds.doc
  561.  
  562.      See Also: man
  563.  
  564.        ________________________________________________________________
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.        SKsh Amiga Shell             Page 9       External Cmd Reference
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.        ________________________________________________________________
  602.  
  603.      Name:     du
  604.  
  605.      Type:     External Command
  606.  
  607.      Default:  n/a
  608.  
  609.      Usage:    du [ -dkst ] dir ...
  610.  
  611.      Range:    n/a
  612.  
  613.      About:    du  prints  disk  usage  information for a  set  of
  614.                directories.   For  each   directory listed on  the
  615.                command line,  the  subtree rooted at that point is
  616.                searched in a depth-first manner.   du adds all the
  617.                file sizes, and for  each  directory, prints 1) the
  618.                directory name, 2)  the  total disk usage for files
  619.                in this  directory, and 3) the total disk usage for
  620.                the subtree rooted at this directory.
  621.  
  622.                The following options are available:
  623.  
  624.                   -k   Print  disk  usage in 1024  byte  kilobytes
  625.                        instead of the default bytes.
  626.  
  627.                   -s   Summary  mode;  print  disk  usage only for
  628.                        root  directories  listed  on  the  command
  629.                        line.   This   option omits the display for
  630.                        any sub-directories, but still  must  exam-
  631.                        ine  the  entire  directory subtree to find
  632.                        the total disk usage.
  633.  
  634.                   -d   Omit the first  disk  usage number (the to-
  635.                        tal for this directory only).
  636.  
  637.                   -t   Omit the  second disk usage number (the to-
  638.                        tal for  the  subtree rooted at this direc-
  639.                        tory).   If  both  -t and -d are used, only
  640.                        directory names are printed.
  641.  
  642.      Example:  du devs: ram:
  643.                du -s devs:
  644.  
  645.      Warnings: The  -k option rounds to the nearest kilobyte.  For
  646.                example, a 1023 byte file is printed as 1K,  and  a
  647.                511 byte file is printed as 0K.   This  means  that
  648.                the rooted  subtree disk usage count may not be the
  649.                sum  of  the  directory  disk  usage counts for all
  650.                subdirectories.
  651.  
  652.      See Also: info
  653.  
  654.        ________________________________________________________________
  655.  
  656.  
  657.        SKsh Amiga Shell            Page 10       External Cmd Reference
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.        ________________________________________________________________
  668.  
  669.      Name:     encr
  670.  
  671.      Type:     External Command
  672.  
  673.      Default:  n/a
  674.  
  675.      Usage:    encr { -d|-e } key { infile | - } { outfile | - }
  676.  
  677.      Range:    4 <= strlen(key) <= max parameter length
  678.  
  679.      About:    encr  encrypts  (-e)  and  decrypts (-d) files,  or
  680.                standard  input  and  output if the  file  name  is
  681.                given as a dash.  The key value must  be  the  same
  682.                for  the  encrypt  and  decrypt; otherwise, garbage
  683.                will result.   The  key  may  be  of  any  passable
  684.                length.  Longer keys  will  result in a more secure
  685.                encryption.
  686.  
  687.                The  encrypted data will in most cases not be ASCII
  688.                data.    However, this can be an  advantage in that
  689.                encr  can  be  used  to  encrypt  binary as well as
  690.                ASCII data.
  691.  
  692.                If  encrypted data is  to  be  compressed, the com-
  693.                press  operation  should  be  performed  before the
  694.                data is  encrypted, not after.  This is because the
  695.                encrypted  data  will  appear  random, and hence be
  696.                difficult to compress by the standard algorithms.
  697.  
  698.                encr does not use the DES  algorithm, as code based
  699.                on  that  algorithm is not shippable outside of the
  700.                United States.  (This is a bit  paranoid if you ask
  701.                me, but no one did).  For  obvious reasons, I'm not
  702.                going  to  describe  the  encr algorithm here.  The
  703.                algorithm should  be  plenty  secure enough to dis-
  704.                courage  casual  perusal of  encrypted data.  It is
  705.                probably  not  secure enough to keep  data  from  a
  706.                dedicated   cryptoanalyst,  or  perhaps  even  from
  707.                someone who is  willing to closely examine a disas-
  708.                sembly  of  the  program code.  I  have  provided a
  709.                small  file  with  this  release of SKsh which con-
  710.                tains some encrypted english  text;  I  would  very
  711.                much like  to  hear  if  anyone manages to find out
  712.                what it says.  The file is called "crypted_data". 
  713.  
  714.      Example:  encr -e mykey plainfile encryptedfile
  715.                encr -d mykey encryptedfile plainfile
  716.  
  717.      See Also:
  718.  
  719.        ________________________________________________________________
  720.  
  721.  
  722.  
  723.        SKsh Amiga Shell            Page 11       External Cmd Reference
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.        ________________________________________________________________
  734.  
  735.      Name:     fgrep
  736.  
  737.      Type:     External Command
  738.  
  739.      Default:  n/a
  740.  
  741.      Usage:    fgrep -[vxcilns] [-f pfile] [-e] pattern
  742.                   [ file ... ]
  743.  
  744.      Range:    n/a
  745.  
  746.      About:    fgrep  provides a fast way to search for text  pat-
  747.                terns in a set of  files.   It  is  similar to, al-
  748.                though more limited but faster than, grep.
  749.  
  750.                fgrep  searches  for  the  indicated pattern in the
  751.                indicated set of files, if present,  or  the  stan-
  752.                dard  input, if not.  An fgrep pattern is extremely
  753.                limited; it  can  be  either a string constant or a
  754.                set  of  string   constants  separated  by  percent
  755.                signs.   For  example, these are valid fgrep state-
  756.                ments:
  757.  
  758.                   fgrep my_routine *.c
  759.                   fgrep 'this%or%that' my_file my_other_file
  760.  
  761.                In  the  second  example,  fgrep searches for lines
  762.                containing any of the three strings.
  763.  
  764.                There are a large  number of options availble which
  765.                modify the actions of fgrep:
  766.  
  767.                -c   Print only a count of  matching lines for each
  768.                     file.  If the 'v'  option is used with the 'c'
  769.                     option,  a  count  of  non-matching  lines  is
  770.                     printed.
  771.  
  772.                -e   Use  the  next  argument as the pattern.  This
  773.                     is  useful to  search  for  patterns beginning
  774.                     with a dash.
  775.  
  776.                -f   Use  the  next  argument as a file which  con-
  777.                     tains  a  newline  separated list  of  values.
  778.                     This file is read and used  in  place  of  the
  779.                     command line pattern.   For  example, the fol-
  780.                     lowing two examples are equivalent:
  781.  
  782.                        fgrep 'foo%bar' myfile
  783.  
  784.                        echo "foo" >temp; echo "bar" >>temp
  785.                        fgrep -f temp myfile
  786.  
  787.  
  788.  
  789.        SKsh Amiga Shell            Page 12       External Cmd Reference
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.                -i   Ignore case in  the  search.   Normally, fgrep
  800.                     is case sensitive.
  801.  
  802.                -l   Print only the names of files  which  containg
  803.                     the given pattern.  This  is  fast;  if  fgrep
  804.                     finds  the  pattern  anywhere in the file,  it
  805.                     will  stop  looking  and  proceed to the  next
  806.                     file.  This can  save  time  for  large  files
  807.                     where  the  task  is  to  discover which files
  808.                     contain the given pattern.
  809.  
  810.                -n   Print  the  line  number  before each matching
  811.                     line.
  812.  
  813.                -s   Print  nothing.    Return an exit  code  of  0
  814.                     (true) if any  file  contained the pattern, or
  815.                     1 (false) if no files contained the pattern.
  816.  
  817.                -v   Invert the search.  Lines which  do  not  con-
  818.                     tain the pattern are printed.
  819.  
  820.                -x   Lines  must  match  the  pattern  exactly, not
  821.                     simply contain it.
  822.  
  823.      Example:  if grep -s my_pattern my_file
  824.                then
  825.                   echo 'my_file contains my_pattern'
  826.                fi
  827.  
  828.      Warnings: Patterns  which  contain '%', spaces, or other spe-
  829.                cial  characters should be quoted  to  avoid  being
  830.                interpreted by the shell.
  831.  
  832.                The  '%'  character is used to separate strings in-
  833.                stead of a newline as in Un*x, as there is a  prob-
  834.                lem  in  AmigaDos   passing  parameters  containing
  835.                newlines to external commands.
  836.  
  837.      See Also: grep
  838.  
  839.        ________________________________________________________________
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.        SKsh Amiga Shell            Page 13       External Cmd Reference
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.        ________________________________________________________________
  866.  
  867.      Name:     find
  868.  
  869.      Type:     External Command
  870.  
  871.      Default:  n/a
  872.  
  873.      Usage:    find paths [ -print ] [ -exec command ]
  874.                   [ -cmd command ] [ -type {d|f} ] [ -hidden ]
  875.                   [ -depth ] [ -case ] [ -blocks n ]
  876.                   [ -bigger n ] [ -smaller n ] [ -ver | -v ]
  877.                   [ -comment pattern ] [ -name pattern ]
  878.                   [ -path pattern ] [ -quiet ]
  879.                   [ -newer { file | date [ time ] } ]
  880.                   [ -older { file | date [ time ] } ]
  881.  
  882.      Range:    n/a
  883.  
  884.      About:    Find  recursively  walks  the  directory hierarchy,
  885.                applying  certain tests to files  and  performing a
  886.                defined  action on  files  which  pass  the  tests.
  887.                Find may be given one or more path  parameters fol-
  888.                lowed by zero or more  switches.   Usually at least
  889.                one of the following two switches is used:
  890.  
  891.                -print       Print the files for  which  the  given
  892.                             tests    are    true.     Files    and
  893.                             directories  are  listed  to  standard
  894.                             output, one per line.   If  the  paths
  895.                             given to find  are  absolute, the out-
  896.                             put will be also.  If the  input paths
  897.                             are   relative,  the  output  will  be
  898.                             relative to the same location.
  899.  
  900.                -cmd         The  first   argument  following  this
  901.                             switch is used as a  format string for
  902.                             the output.   Any  occurrences of "%s"
  903.                             (without the quotes)  are  replaced by
  904.                             the  output  path  name.   Results are
  905.                             sent to  standard output.  This is of-
  906.                             ten  useful to build a script file for
  907.                             later interpretation by the shell.
  908.  
  909.                The  other  switches  indicate conditions which are
  910.                "anded" together.  A  file  or  directory must meet
  911.                all  conditions to be  selected.   If  patterns are
  912.                given to any switches, they must be quoted.
  913.  
  914.                -type        The  first   argument  following  this
  915.                             switch  is  either "d", which  selects
  916.                             only  directories, or "f",  which  se-
  917.                             lects only files.
  918.  
  919.  
  920.  
  921.        SKsh Amiga Shell            Page 14       External Cmd Reference
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.                -name        The file name must match  the  pattern
  932.                             given as  the  next  parameter.   Only
  933.                             the  file  portion (the  basename)  of
  934.                             the path must match.
  935.  
  936.                -path        Similar to -name, but the  given  pat-
  937.                             tern must match  the  entire path, not
  938.                             just the file portion.  Slashes  ("/")
  939.                             are not treated specially.
  940.  
  941.                -comment     A  file's  comment, if it exists, must
  942.                             match  the  pattern given as the  next
  943.                             parameter.
  944.  
  945.                -case        Normally all  pattern matching is case
  946.                             insensitive.  This  switch  will  make
  947.                             it case sensitive.
  948.  
  949.                -depth       Causes find  to  perform a depth-first
  950.                             scan.      Normally   directories  are
  951.                             listed  before  their  contents;  this
  952.                             switch reverses that order.
  953.  
  954.                -blocks      The  following  parameter, which  must
  955.                             be  numeric, is  treated  as  a  block
  956.                             size.  All files  containing this num-
  957.                             ber of blocks are selected.
  958.  
  959.                -bigger      The  following  parameter  is  a  byte
  960.                             count.   All  files   having this many
  961.                             bytes or more are selected.
  962.  
  963.                -smaller     Similar to  -bigger, but selects files
  964.                             having this byte count or less.
  965.  
  966.                -newer       Has  several forms.  If the  following
  967.                             parameter is a  file  name,  then  all
  968.                             files which are newer  (have  a  later
  969.                             datestamp)   than   this   file    are
  970.                             selected.   If  followed by one param-
  971.                             eter which is a date in  AmigaDos  dd-
  972.                             mmm-yy  format, files newer than  this
  973.                             date are  selected (files created any-
  974.                             time  after 12:00am are  considered to
  975.                             be newer).   If  given  two  following
  976.                             arguments, the first  of  which  is  a
  977.                             date  in  the  above  format, and  the
  978.                             second of which is a time in  hh:mm:ss
  979.                             format, then  files  newer  than  this
  980.                             are selected.
  981.  
  982.                -older       Similar to -newer.
  983.  
  984.  
  985.  
  986.  
  987.        SKsh Amiga Shell            Page 15       External Cmd Reference
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.                -quiet       Normally  find  will  print  an  error
  998.                             message if it  is  unable to examine a
  999.                             file  or  directory's   entry.    This
  1000.                             might  happen, for example, if another
  1001.                             process  has  this   file   open   for
  1002.                             writing.  This switch will cause  find
  1003.                             to  silently skip these files; this is
  1004.                             useful with the -cmd option.
  1005.  
  1006.                -hidden      Normally  files  which  are   "hidden"
  1007.                             (ie, have the  +h  bit  set)  are  not
  1008.                             seen  by  find.   This  switch  causes
  1009.                             find to list these files.
  1010.  
  1011.                -exec        The  following parameter is taken as a
  1012.                             command.  All  occurrences of "%s" are
  1013.                             replaced  by  the  file  or  directory
  1014.                             name,   and   the   string   is   then
  1015.                             executed.   If  the  resulting command
  1016.                             returns  successfully (ie,  with  exit
  1017.                             code 0), then the  file  or  directory
  1018.                             is    selected.     Otherwise,  it  is
  1019.                             rejected.   Since  this  operation can
  1020.                             be slow  (invoking another program for
  1021.                             each  path),  it  is  invoked last and
  1022.                             only   if   all   other   tests   have
  1023.                             succeeded.   For   example, if used in
  1024.                             conjunction   with   "-blocks",   only
  1025.                             files  passing the "-blocks" test will
  1026.                             be given to  "-exec".   It  is  recom-
  1027.                             mended that -exec be  used  only  with
  1028.                             some  other  qualifier  to  reduce the
  1029.                             number of  times  the  command must be
  1030.                             called.
  1031.  
  1032.                             Programs  invoked from -exec  must  be
  1033.                             specified as a complete path.
  1034.  
  1035.                -ver or -v   Prints the version ID of find.
  1036.  
  1037.      Example:  # list all files under /usr and /misc:
  1038.                find /usr /misc -print
  1039.  
  1040.                # list all files under /usr/appl newer than
  1041.                # ram:myfile:
  1042.                find /usr/appl -newer ram:myfile -print
  1043.  
  1044.                # list all files under /pd/src ending in  ".h"  and
  1045.                having a non-null file comment:
  1046.                find /pd/src -name '*.h' -comment '?*' -print
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.        SKsh Amiga Shell            Page 16       External Cmd Reference
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.                # run "view -t" on all files under /misc:
  1064.                find /misc -type f -print | while read fspec
  1065.                do
  1066.                   view -t $fspec
  1067.                done
  1068.  
  1069.                # another way to do that above:
  1070.                find /misc -cmd -type f "/bin/view -t %s" >myscr
  1071.                source myscr
  1072.  
  1073.                # find all files under /foo bigger than 10000
  1074.                # bytes, smaller than 50000 bytes, and containing
  1075.                # the string "blee":
  1076.                find /foo -print -exec "sys:bin/fgrep blee %s" \
  1077.                     -bigger 10000 -smaller 50000
  1078.  
  1079.      Limits:   In  this  version   of   find,  only  one  of  each
  1080.                qualifier switch may be given.  For  example,  only
  1081.                one -name switch can be used.  This limitation  may
  1082.                be removed in a future version  of  find.  In spite
  1083.                of this limit, multiple directories  may  still  be
  1084.                searched.
  1085.  
  1086.      See Also:
  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.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.        SKsh Amiga Shell            Page 17       External Cmd Reference
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.        ________________________________________________________________
  1130.  
  1131.      Name:     grep
  1132.  
  1133.      Type:     External Command
  1134.  
  1135.      Default:  n/a
  1136.  
  1137.      Usage:    grep -[vxcilns] [-f pfile] [-e] pattern
  1138.                   [ file ... ]
  1139.  
  1140.      Range:    n/a
  1141.  
  1142.      About:    grep  provides a way to search for text patterns in
  1143.                a set of files.   It  is  similar to, although more
  1144.                powerful but slower than, fgrep.
  1145.  
  1146.                grep searches for the  indicated pattern in the in-
  1147.                dicated set of files, if present, or  the  standard
  1148.                input, if not.  A  grep  pattern is a limited regu-
  1149.                lar  expression.   An   explaination of regular ex-
  1150.                pressions  is  beyond the scope of  this  document;
  1151.                however, it should be noted that  although they ap-
  1152.                pear  similar to wildcards, they are much different
  1153.                (and more powerful).
  1154.  
  1155.                There are a large  number of options availble which
  1156.                modify the actions of grep:
  1157.  
  1158.                -c   Print only a count of  matching lines for each
  1159.                     file.  If the 'v'  option is used with the 'c'
  1160.                     option,  a  count  of  non-matching  lines  is
  1161.                     printed.
  1162.  
  1163.                -e   Use  the  next  argument as the pattern.  This
  1164.                     is  useful to  search  for  patterns beginning
  1165.                     with a dash.
  1166.  
  1167.                -f   Use  the  next  argument as a file which  con-
  1168.                     tains  a  one-line  regular expression.  There
  1169.                     can  only  be  one  regular expression in this
  1170.                     version  of  grep, so this option is currently
  1171.                     of  limited use.  However, if grep is extended
  1172.                     to  permit  multiple  expressions, the 'f' op-
  1173.                     tion will become more useful.
  1174.  
  1175.                -i   Ignore case in the search.   Normally, grep is
  1176.                     case sensitive.
  1177.  
  1178.                -l   Print only the names of files  which  containg
  1179.                     the given pattern.   This  is  fast;  if  grep
  1180.                     finds  the  pattern  anywhere in the file,  it
  1181.                     will  stop  looking  and  proceed to the  next
  1182.                     file.  This can  save  time  for  large  files
  1183.  
  1184.  
  1185.        SKsh Amiga Shell            Page 18       External Cmd Reference
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.                     where  the  task  is  to  discover which files
  1196.                     contain the given pattern.
  1197.  
  1198.                -n   Print  the  line  number  before each matching
  1199.                     line.
  1200.  
  1201.                -s   Print  nothing.    Return an exit  code  of  0
  1202.                     (true) if any  file  contained the regular ex-
  1203.                     pression, or 1 (false) otherwise.
  1204.  
  1205.                -v   Invert the search.  Lines which  do  not  con-
  1206.                     tain the regular expression are printed.
  1207.  
  1208.                -x   The  expression must be found at the beginning
  1209.                     of a line.
  1210.  
  1211.      Example:  if grep -s my_pattern my_file
  1212.                then
  1213.                   echo 'my_file contains my_pattern'
  1214.                fi
  1215.  
  1216.      Warnings: Patterns  which  contain '*', '.', spaces, or other
  1217.                special  characters should be quoted to avoid being
  1218.                interpreted by the shell.
  1219.  
  1220.                Be  wary  of  the  difference in the 'x' option be-
  1221.                tween fgrep and grep.
  1222.  
  1223.                fgrep  often  more  useful than grep because of its
  1224.                greater speed  and  smaller  size.   This  is  most
  1225.                noticable  on  fast  devices such as  ram  or  hard
  1226.                disks.
  1227.  
  1228.      See Also: fgrep
  1229.  
  1230.        ________________________________________________________________
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.        SKsh Amiga Shell            Page 19       External Cmd Reference
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.        ________________________________________________________________
  1262.  
  1263.      Name:     head
  1264.  
  1265.      Type:     External Command
  1266.  
  1267.      Default:  num = 10
  1268.  
  1269.      Usage:    head [ -num ] [ file ... ]
  1270.  
  1271.      Range:    0 <= num
  1272.  
  1273.      About:    head  prints  the  first  num lines of  each  named
  1274.                file,  or  the  standard  input  if  no  files  are
  1275.                indicated.  If  num is not explicitly set, it has a
  1276.                default value of 10.
  1277.  
  1278.      Example:  head -5 my_file.c my_other_file.c
  1279.  
  1280.      See Also: tail
  1281.  
  1282.        ________________________________________________________________
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.        SKsh Amiga Shell            Page 20       External Cmd Reference
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.        ________________________________________________________________
  1328.  
  1329.      Name:     indent
  1330.  
  1331.      Type:     External Command
  1332.  
  1333.      Default:  char = space
  1334.                num = 4
  1335.  
  1336.      Usage:    indent [ -num ] [ -cchar ] [ file ... ]
  1337.  
  1338.      Range:    n/a
  1339.  
  1340.      About:    Indent  inserts  the  defined character (a space by
  1341.                default) a given  number of times (4 by default) at
  1342.                the  beginning  of  every line of a file which does
  1343.                not  contain only a newline.  That is, empty  lines
  1344.                are left alone.
  1345.  
  1346.      Example:  indent -5 myfile.txt
  1347.  
  1348.      See Also:
  1349.  
  1350.        ________________________________________________________________
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.        SKsh Amiga Shell            Page 21       External Cmd Reference
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.        ________________________________________________________________
  1394.  
  1395.      Name:     join
  1396.  
  1397.      Type:     External Command
  1398.  
  1399.      Default:  n/a
  1400.  
  1401.      Usage:    join [ -a ] source1 [ source2 ... ] destination
  1402.  
  1403.      Range:    n/a
  1404.  
  1405.      About:    The  join command concatinates binary or ASCII data
  1406.                from  multiple files into a single file, optionally
  1407.                appending the data to  the  destination file if the
  1408.                -a flag is set.   The  destination file is the last
  1409.                one given.
  1410.  
  1411.                join may be  used  to  reconstruct files which have
  1412.                been split with the split command.
  1413.  
  1414.      Example:  join file1 file2 dest_file
  1415.  
  1416.      See Also: split
  1417.  
  1418.        ________________________________________________________________
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.        SKsh Amiga Shell            Page 22       External Cmd Reference
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.        ________________________________________________________________
  1460.  
  1461.      Name:     num
  1462.  
  1463.      Type:     External Command
  1464.  
  1465.      Default:  num = 4
  1466.  
  1467.      Usage:    num [ -digits ] [ -r ] [ file ... ]
  1468.  
  1469.      Range:    2 <= digits <= 8
  1470.  
  1471.      About:    num prints ASCII files,  prefixing each line in the
  1472.                file with its  line  number.   By  default, 4 digit
  1473.                line  numbers are used, but  this  can  be  changed
  1474.                from 2  to  8  digits numbers with the command line
  1475.                switch.
  1476.  
  1477.                Also by  default, num resets the line number at the
  1478.                beginning of each file.   To  use  consecutive line
  1479.                numbers for all files, use the "-r"  switch.   With
  1480.                that  option  selected, the line count is not reset
  1481.                for each file.
  1482.  
  1483.      Example:  num -6 -r myfile1.c myfile2.c
  1484.  
  1485.      See Also:
  1486.  
  1487.        ________________________________________________________________
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.        SKsh Amiga Shell            Page 23       External Cmd Reference
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.        ________________________________________________________________
  1526.  
  1527.      Name:     split
  1528.  
  1529.      Type:     External Command
  1530.  
  1531.      Default:  <num> = 800
  1532.                name = "file"
  1533.  
  1534.      Usage:    split [ -?V ] | [ -<num> ] [ file [ name ] ]
  1535.  
  1536.      Range:    1 <= num <= 65535
  1537.  
  1538.      About:    The  split  command  divides ASCII files into  sec-
  1539.                tions of <num> lines each, with <num>  having a de-
  1540.                fault value of 800.  The  resulting groups of <num>
  1541.                lines  are  output to "name.001", "name.002",  etc.
  1542.                By  default "name" is the name of  the  file  being
  1543.                split.  If "file" and "name" are  omitted, standard
  1544.                input  is  split  and  the   results  are  sent  to
  1545.                "stdin.001", "stdin.002", etc.
  1546.  
  1547.                Split  files  may  be  reconstructed using the join
  1548.                command.    split  is  useful in dealing with large
  1549.                uuencoded files or files which are  too  large  for
  1550.                comfortable editing.
  1551.  
  1552.      Example:  split -512 mybigasciifile result
  1553.  
  1554.      See Also: join
  1555.  
  1556.        ________________________________________________________________
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.        SKsh Amiga Shell            Page 24       External Cmd Reference
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.        ________________________________________________________________
  1592.  
  1593.      Name:     srun
  1594.  
  1595.      Type:     External Command
  1596.  
  1597.      Default:  stk = 4000
  1598.                pri = 0
  1599.  
  1600.      Usage:    srun [ -i file ] [ -o file ] [ -s stk ] [ -p pri ]
  1601.                   program [ args ]
  1602.  
  1603.      Range:    4000 <= stk
  1604.                -31 <= pri <= 31
  1605.  
  1606.      About:    srun  was  created to overcome certain deficiencies
  1607.                in the  AmigaDos  run command.  srun is most useful
  1608.                in  scripts  or  functions, although it can also be
  1609.                used  from  the  command  line.   It  allows you to
  1610.                specify  an  input  file,  output file, stack size,
  1611.                and  priority  for  a  command which is run in  the
  1612.                background.    Standard  input and output cannot be
  1613.                re-directed with the AmigaDos  run command (for ex-
  1614.                ample,  if  standard output is redirected, the out-
  1615.                put  file  will  contain only "[CLI n]").  The srun
  1616.                command  is  very  useful in  functions such as the
  1617.                one  given  below  (very  much  simplified from one
  1618.                given in the Stuff.sksh file).
  1619.  
  1620.                The program name given  to  srun must be a complete
  1621.                path.  This can be obtained in SKsh via:
  1622.  
  1623.                  $(which -s prog)
  1624.  
  1625.                srun  will  report an  error if it is unable to ex-
  1626.                ecute  the  program or  unable to open and input or
  1627.                output file.
  1628.  
  1629.      Example:  function zmore {
  1630.                   srun -o pipe:tmp $(which zoo) -print "$1" "$2"
  1631.                   more pipe:tmp
  1632.                }
  1633.  
  1634.      See Also: run
  1635.  
  1636.        ________________________________________________________________
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.        SKsh Amiga Shell            Page 25       External Cmd Reference
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.        ________________________________________________________________
  1658.  
  1659.      Name:     strings
  1660.  
  1661.      Type:     External Command
  1662.  
  1663.      Default:  num = 6
  1664.  
  1665.      Usage:    strings [ -num ] [ file ... ]
  1666.  
  1667.      Range:    0 <= num
  1668.  
  1669.      About:    strings searches the named files for strings of  at
  1670.                least  num  consecutive  printable characters.   If
  1671.                found, it prints them.   If  num is not set, it de-
  1672.                faults to 6.
  1673.  
  1674.      Example:  strings -10 my_file.o binary_file
  1675.  
  1676.      See Also:
  1677.  
  1678.        ________________________________________________________________
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.        SKsh Amiga Shell            Page 26       External Cmd Reference
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.        ________________________________________________________________
  1724.  
  1725.      Name:     tail
  1726.  
  1727.      Type:     External Command
  1728.  
  1729.      Default:  num = 10, '-' option
  1730.  
  1731.      Usage:    tail [ -num | +num ] [ file ... ]
  1732.  
  1733.      Range:    0 <= num <= 32000
  1734.  
  1735.      About:    tail prints the last  num lines of each named file,
  1736.                or the  standard input if no files are named.  If a
  1737.                '+'  precedes  num  instead of a '-',  tail instead
  1738.                skips num lines and prints the rest of the file.
  1739.  
  1740.                In  SKsh  1.4,  the  algorithm  used  by  tail  was
  1741.                changed.  If run on a file, it  will  now  seek  to
  1742.                the end of the  file  and  read  backwards until it
  1743.                encounters the proper line.  This means  that  run-
  1744.                ning  tail on a large file is now nearly  instanta-
  1745.                neous;  previously, it would  read  in  the  entire
  1746.                file.
  1747.  
  1748.      Example:  tail -15 my_file.c my_other_file.c
  1749.  
  1750.      See Also: head
  1751.  
  1752.        ________________________________________________________________
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.        SKsh Amiga Shell            Page 27       External Cmd Reference
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.        ________________________________________________________________
  1790.  
  1791.      Name:     tee
  1792.  
  1793.      Type:     External Command
  1794.  
  1795.      Default:  n/a
  1796.  
  1797.      Usage:    tee [ -a ] [ file ... ]
  1798.  
  1799.      Range:    less than 32 files
  1800.  
  1801.      About:    tee  copies its standard input to its standard out-
  1802.                put, and also to any named  files.   The  old  con-
  1803.                tents of the files  are  overwritten unless the ap-
  1804.                pend (-a) flag is  used.   With  no  arguments, tee
  1805.                simply copies its input to its output.
  1806.  
  1807.      Example:  fgrep foo my_file | tee save_foo | wc -c
  1808.  
  1809.      See Also:
  1810.  
  1811.        _______________________________________________________________
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.        SKsh Amiga Shell            Page 28       External Cmd Reference
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.        ________________________________________________________________
  1856.  
  1857.      Name:     view
  1858.  
  1859.      Type:     External Command
  1860.  
  1861.      Default:  n/a
  1862.  
  1863.      Usage:    see View.doc
  1864.  
  1865.      Range:    n/a
  1866.  
  1867.      About:    view  is  a  command which allows other commands to
  1868.                be called based on the type of a given  file.   See
  1869.                the  View.doc manual  for  a  detail description of
  1870.                this command.
  1871.  
  1872.      Example:  view myfile my_otherfile
  1873.  
  1874.      See Also:
  1875.  
  1876.        ________________________________________________________________
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.        SKsh Amiga Shell            Page 29       External Cmd Reference
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.        ________________________________________________________________
  1922.  
  1923.      Name:     wc
  1924.  
  1925.      Type:     External Command
  1926.  
  1927.      Default:  n/a
  1928.  
  1929.      Usage:    wc [ -hcwlqt ] [ file ... ]
  1930.  
  1931.      Range:    n/a
  1932.  
  1933.      About:    wc is a  utility which counts characters, words, or
  1934.                lines in a  given  series of files (or the standard
  1935.                input, if  no  files  are  indicated).  It normally
  1936.                produces  information on all three counts, preceded
  1937.                by a title for each column.  If  the  c,  w,  or  l
  1938.                flags  are  set,  only  information on  characters,
  1939.                words, or lines is  printed.  (These  can  be  com-
  1940.                bined;  for  example 'wc -cl').  If the q  flag  is
  1941.                set,  wc does its work  quietly; that is, it leaves
  1942.                out titles and file names,  only  reporting the ac-
  1943.                tual counts.  The t flag can be  used  to  obtain a
  1944.                total at the end, and the h flag prints  a  helpful
  1945.                usage message.
  1946.  
  1947.      Example:  if [ $(wc -lq my_file) -lt 10 ]
  1948.                then
  1949.                   echo "There must be at least 10 lines"
  1950.                fi
  1951.  
  1952.      See Also:
  1953.  
  1954.        ________________________________________________________________
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.        SKsh Amiga Shell            Page 30       External Cmd Reference
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.        ________________________________________________________________
  1988.  
  1989.      Name:     window
  1990.  
  1991.      Type:     External Command
  1992.  
  1993.      Default:  n/a
  1994.  
  1995.      Usage:    window [ -back ] [ -front ] [ -title ]
  1996.                   [ -pos [x,y] ] [ -size [x,y] ] [ -scrsize ]
  1997.                   [ -wmouse ] [ -smouse ]
  1998.  
  1999.      Range:    n/a
  2000.  
  2001.      About:    window is a  command which allows parameters of the
  2002.                current  shell  window to be  modified or examined.
  2003.                The -back and -front flags cause  the  window to be
  2004.                sent to the back or front.  The -title flag  causes
  2005.                the  current  window title to be printed.  The -pos
  2006.                flag  with  no  following parameters can be used to
  2007.                find  the  current x and y positions of the window.
  2008.                With  a  comma  separated set of  numbers, it moves
  2009.                the  window  to  that  position if possible.  Simi-
  2010.                larly, the -size  parameter either reports the size
  2011.                of  the  current  window in  pixels, or resizes the
  2012.                window to that  size  if  possible.   The  -scrsize
  2013.                flag  reports  the  current size of the screen con-
  2014.                taining  this  window, and the -smouse and  -wmouse
  2015.                flags  report  the  cursor position relative to the
  2016.                screen or window.
  2017.  
  2018.                With  no  parameters,  the  window command prints a
  2019.                helpful  usage message.  Note that this  usage mes-
  2020.                sage  contains  one  additional option which can be
  2021.                included  after the -title flag to change the  win-
  2022.                dow title to  a  set  value.   However, this is not
  2023.                actually  permitted by  AmigaDos,  and  although it
  2024.                works now, it  may  cause  problems, and its use is
  2025.                not recommended.  Use at your own risk.
  2026.  
  2027.      Example:  # move window to back and upper left hand corner
  2028.                window -back -pos 0,0
  2029.  
  2030.      See Also:
  2031.  
  2032.        ________________________________________________________________
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.        SKsh Amiga Shell            Page 31       External Cmd Reference
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.        ________________________________________________________________
  2054.  
  2055.      Name:     xargs
  2056.  
  2057.      Type:     External Command
  2058.  
  2059.      Default:  n/a
  2060.  
  2061.      Usage:    xargs [ -s size ] [ -i [ replstr ] ] [ -n num ]
  2062.                      [ -z ] [ -r ] [ -t ] [ -p ] [ -x ]
  2063.                      [ -l lines ] [ -e eofstr ] cmd-args...
  2064.                xargs [ -?V ]
  2065.  
  2066.      Range:    1 <= num <= 128
  2067.                1 <= lines <= 128
  2068.                40 <= size <= 255 (for AmigaDos 1.3)
  2069.  
  2070.      Defaults: size = 250
  2071.                replstr = {}
  2072.  
  2073.      About:    The  xargs  command is similar to the Unix command of
  2074.                the same  name.   xargs can be used to circumvent the
  2075.                255  character  command  line  length  limitation  in
  2076.                AmigaDos.    xargs  reads  its  standard input, which
  2077.                should be a list of names  separated by spaces, tabs,
  2078.                or newlines, and  executes commands multiple times on
  2079.                these names.   The  standard input is produced by ei-
  2080.                ther  the  SKsh  find  utility, or more commonly, the
  2081.                echo builtin.  Since  echo is a shell builtin, it can
  2082.                handle any number of files.
  2083.  
  2084.                xargs  concatenates "cmd-args",  separated by spaces,
  2085.                into a string.  It  then  reads  its  standard input,
  2086.                creating  commands lines.  If  the  -i  flag  is  not
  2087.                present,  the  arguments are  concatenated on the end
  2088.                of the cmd-args.  If the -i flag is present, any  oc-
  2089.                currences  of  "replstr" (which is  {}  by  default),
  2090.                will  be  replaced with  as  many  arguments from the
  2091.                standard input as possible.
  2092.  
  2093.                xargs supports the following options:
  2094.  
  2095.                   -s size     Each  output line will  be  no  longer
  2096.                               than size characters.  Size is 250  by
  2097.                               default for efficiency.  (Larger  num-
  2098.                               bers  mean  that  the  command is  ex-
  2099.                               ecuted less often.   However, AmigaDos
  2100.                               imposes a limit of 255).
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.        SKsh Amiga Shell            Page 32       External Cmd Reference
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.                   -i replstr  Any  ocurrances of replstr in cmd-args
  2120.                               is  replaced with names from  standard
  2121.                               input.    replstr may  occur more than
  2122.                               once  in  cmd-args.   The   total line
  2123.                               length will be less than size.   repl-
  2124.                               str is "{}" by default.
  2125.  
  2126.                   -n num      cmd-args is  executed for each num pa-
  2127.                               rameters read from  standard input (as
  2128.                               long as  the  result is less than size
  2129.                               characters).
  2130.  
  2131.                   -l lines    cmd-args  is  executed  for  each  num
  2132.                               lines  read  from  standard  input (as
  2133.                               long as  the  result is less than size
  2134.                               characters).
  2135.  
  2136.                   -z          The  resulting lines are not executed.
  2137.                               This causes  xargs to be a no-op; how-
  2138.                               ever, the  -t  paramter  is  still  in
  2139.                               effect.
  2140.  
  2141.                   -p          The -p option is not yet implemented.
  2142.  
  2143.                   -t          Each  command line is  printed  before
  2144.                               being   passed   to    AmigaDos    for
  2145.                               execution.
  2146.  
  2147.                   -x          Exit  of  any  command would be longer
  2148.                               than size characters.
  2149.  
  2150.                   -r          Exit if any  executed command line re-
  2151.                               turns an error.
  2152.  
  2153.                   -e eofstr   The -e option is not yet implemented.
  2154.  
  2155.                   -?          Print a usage message
  2156.  
  2157.                   -V          Print the copyright notice.
  2158.  
  2159.  
  2160.  
  2161.      Examples: For  all  these  examples, assume that in the current
  2162.                directory  are  a  large  number of ".c" files.   Too
  2163.                many, in fact,  to  manipulate with external commands
  2164.                normally  since  the  argument lists would become too
  2165.                long for AmigaDos to cope with.
  2166.  
  2167.                To print the names of all  .c  files  containing  the
  2168.                string "mytext":
  2169.  
  2170.                   echo *.c | xargs fgrep -il mytext
  2171.  
  2172.  
  2173.  
  2174.  
  2175.        SKsh Amiga Shell            Page 33       External Cmd Reference
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.                To copy all *.c files to ram:
  2186.  
  2187.                   echo *.c | xargs "cp {} ram:"
  2188.  
  2189.                Note that in the above  command, the "cp" command had
  2190.                to be quoted, since  "{}"  are  special characters to
  2191.                the shell.  To avoid  this,  set  the  replace string
  2192.                explicitly:
  2193.  
  2194.                   echo *.c | xargs -i _F_ cp _F_ ram:
  2195.  
  2196.                To run "crc" on all the *.c files:
  2197.  
  2198.                   echo *.c | xargs crc
  2199.  
  2200.                To do the above, but  print  the  resulting commands,
  2201.                and  not  generate  any  command line longer than  72
  2202.                characters:
  2203.  
  2204.                   echo *.c | xargs -t -s72 crc
  2205.  
  2206.                To do the above, but not execute the commands:
  2207.  
  2208.                   echo *.c | xargs -t -z -s72 crc
  2209.  
  2210.                To copy each *.c file to ram:*.c.bak:
  2211.  
  2212.                   echo *.c | xargs -n1 "cp {} ram:{}.bak"
  2213.  
  2214.                To run "view -t" on each  file  in  the  subdirectory
  2215.                undir "mydir", recursively:
  2216.  
  2217.                   find mydir -type f -print | xargs view -t
  2218.  
  2219.  
  2220.      Notes:    xargs  assumes that the -i  option is followed by ei-
  2221.                ther a  replace string or another option.  Therefore,
  2222.                do  not  use  the  -i  option as the last option in a
  2223.                command  line  without  specifying a  replace string.
  2224.                If  you  do,  xargs will  assume that your command to
  2225.                execute is really a replace string.
  2226.  
  2227.                With a little  cleverness, it is possible to create a
  2228.                wrapper  shell  function for "cp", "wc",  etc,  which
  2229.                uses xargs transparently.
  2230.  
  2231.                The  commands to be executed must be in your AmigaDos
  2232.                search path or be specified as a whole path name.
  2233.  
  2234.  
  2235.      See Also:
  2236.  
  2237.        ________________________________________________________________
  2238.  
  2239.  
  2240.  
  2241.        SKsh Amiga Shell            Page 34       External Cmd Reference
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.        ________________________________________________________________
  2252.  
  2253.      Name:     xd
  2254.  
  2255.      Type:     External Command
  2256.  
  2257.      Default:  n/a
  2258.  
  2259.      Usage:    xd [ file ... ]
  2260.  
  2261.      Range:    n/a
  2262.  
  2263.      About:    xd  (hex  dump)  prints  a  hexadecimal dump of  each
  2264.                named  file,  or  the  standard input if no files are
  2265.                named.   It  prints  the  hex  address of the current
  2266.                offset  as  8  digits, then a hex dump  of  16  bytes
  2267.                separated into groups of 2 bytes, then an ASCII  rep-
  2268.                resentation of the 16 bytes, or '.' if  the  byte  is
  2269.                not a printable character.
  2270.  
  2271.      Example:  xd any_old_file
  2272.  
  2273.      See Also:
  2274.  
  2275.        ________________________________________________________________
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.        SKsh Amiga Shell            Page 35       External Cmd Reference
  2308.  
  2309.  
  2310.  
  2311.