home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff291.lzh / SKsh / docs / Hints.doc < prev    next >
Text File  |  1989-12-12  |  6KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                                  Hints and Tips for
  17.  
  18.                                         SKsh
  19.  
  20.                            A ksh-like Shell for the Amiga
  21.  
  22.                                      Version 1.2
  23.  
  24.  
  25.                                   (Copyright) 1989 
  26.  
  27.                                      Steve Koren
  28.  
  29.                                   November 19, 1989
  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.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           Making SKsh Resident
  74.  
  75.             SKsh version 1.1 or later can be made  resident.   Add  a  line
  76.             like this to your startup-sequence:
  77.  
  78.                c:resident sksh
  79.  
  80.             where 'sksh' is the path to the  sksh  command  itself.   Then,
  81.             when SKsh is run through  a  shell-window,  the  resident  SKsh
  82.             will be used, not the disk-based SKsh.
  83.  
  84.  
  85.           Starting SKsh with 'newcli' or 'newshell'
  86.  
  87.             The  'newcli'  or  'newshell'   commands   can   be   made   to
  88.             automatically start SKsh when a new CLI  window  is  generated.
  89.             There are two things that need to be  done  for  this.   First,
  90.             define an alias like this:
  91.  
  92.              alias newcli='$(which newshell) CON:0/0/640/200/SKsh_Window'
  93.  
  94.             Also, you must create a s:Shell-Startup file which  runs  SKsh.
  95.             Mine looks like this:
  96.  
  97.                Prompt "%N.%S> "
  98.                sys:bin/setfont source 10 window
  99.                stack 16000
  100.                sksh
  101.  
  102.             You may have to change this if you do not  have  the  'setfont'
  103.             command  or  do  not  have  it  installed  in  'sys:bin'.   The
  104.             'newcli' command will now start  up  a  new  window,  with  the
  105.             given size, and  run  SKsh  for  you  automatically  using  the
  106.             resident 'SKsh'.  To make the 'exit' command  in  SKsh  destroy
  107.             the window when SKsh exits, put the following in  your  .skshrc
  108.             file:
  109.  
  110.                LOGOUT='endcli'
  111.  
  112.             Now, the 'newcli' alias can be used transparently with SKsh.
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.           SKSH Amiga Shell             Page 2               Hints and Tips
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.           Setting up a man-page Directory
  141.  
  142.             To set up a  man-page  directory,  create  one  in  a  suitable
  143.             place, and assign the MAN:  device  to  point  to  it  in  your
  144.             startup-sequence, like this:
  145.  
  146.                assign MAN: sys:usr/man
  147.  
  148.             The following function can be used to show man-pages:
  149.  
  150.                function man {
  151.                   if [ ! -f "MAN:$1.MAN" ]
  152.                   then
  153.                      echo "No manual entry for $1"
  154.                   else
  155.                      more "MAN:$1.MAN"
  156.                   fi
  157.                }
  158.  
  159.             (You can also remove the function begin and end lines  and  use
  160.             it as a script with the  's'  bit  set).   Many  public  domain
  161.             programs come with a "README" or .DOC file which  explains  how
  162.             to use the program.  Copy these into  the  MAN:  directory  and
  163.             rename them to prog.MAN.  Then, you can use:
  164.  
  165.                man prog
  166.  
  167.             to display the documentation file.  This is a  simple  example,
  168.             but  it  could  be  extended  to,   for   example,   uncompress
  169.             compressed files before viewing for  prog.MAN  and  prog.MAN.Z.
  170.             You could also extend it to use a pager  defined  by  a  $PAGER
  171.             variable.  Just replace 'more' with $PAGER.
  172.  
  173.  
  174.           Forcing execution as a program
  175.  
  176.             The 'force' keyword will only force  execution  as  a  builtin,
  177.             alias,  or  function.   To  force  execution  as  an   external
  178.             program, simply use:
  179.  
  180.                $(which prog) args
  181.  
  182.  
  183.           Using c:getenv to read environment variables
  184.  
  185.             A problem with Lattice C currently prevents SKsh from  properly
  186.             reading the value of AmigaDos environment variables.   However,
  187.             they can still be read using:
  188.  
  189.                my_var=$(c:getenv my_var)
  190.  
  191.  
  192.  
  193.  
  194.  
  195.           SKSH Amiga Shell             Page 3               Hints and Tips
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.           Re-sourcing the .skshinit file
  206.  
  207.             If you source the .skshinit file  after  you  start  SKsh,  any
  208.             options you have set in your .skshrc file will  potentially  be
  209.             overridden.  One example  of  this  is  the  'e'  option.   The
  210.             .skshinit file sets it, which disables  command  line  editing.
  211.             It is reset in the .skshrc file.  If you source  the  .skshinit
  212.             file again without sourcing the .skshrc file, you will have  to
  213.             reset this option flag manually.
  214.  
  215.  
  216.           Using ^r for reverse searches
  217.  
  218.             The SKsh usage of ^r for reverse  searches  is  different  than
  219.             the ksh usage.  In ksh, you type ^r, which is echoed, the  text
  220.             you wish to search for, and then return.   In  SKsh,  you  type
  221.             the text you wish to search for, followed by ^r.  I have  found
  222.             this usage more convienent.
  223.  
  224.  
  225.           Changing default command options
  226.  
  227.             To  change  the  default  command  options  for  a   particular
  228.             command, define an alias  of  the  same  name  which  uses  the
  229.             'force' keyword.  For example, to change the  'cp'  command  so
  230.             that it uses the 'clone' option and echoes file names  as  they
  231.             are copied, put the following alias in your .skshrc file:
  232.  
  233.               alias cp = 'force -b cp -cv'
  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               Hints and Tips
  262.  
  263.  
  264.  
  265.