home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk381.lzh / SKsh / Hints.doc < prev    next >
Text File  |  1990-10-20  |  8KB  |  331 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.6
  23.  
  24.  
  25.                                (Copyright) 1989, 1990
  26.  
  27.                                      Steve Koren
  28.  
  29.                                    October 4, 1990
  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 automati-
  88.             cally start SKsh when  a  new  CLI  window is generated.  There
  89.             are two things that need to be done for  this.   First,  define
  90.             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 6000
  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 'new-
  104.             cli'  command will now start up  a  new  window, with the given
  105.             size, and run  SKsh  for  you  automatically using the resident
  106.             'SKsh'.  To make the 'exit'  command in SKsh destroy the window
  107.             when SKsh exits, put the following in your .skshrc file:
  108.  
  109.                LOGOUT='endcli'
  110.  
  111.             Now,  the  'newcli' alias can be used  transparently with SKsh.
  112.             A  similar mechanism can be used with MachII or other utilities
  113.             which  let  you  define a  hotkey which will create a new shell
  114.             window.  Simply replace "newcli" with:
  115.  
  116.               c:newshell CON:0/0/600/180/SKsh_Window
  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 pro-
  161.             grams come with  a  "README" or .DOC file which explains how to
  162.             use the program.  Copy these into  the  MAN:  directory and re-
  163.             name 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 com-
  169.             pressed files  before viewing for prog.MAN and prog.MAN.Z.  You
  170.             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 pro-
  178.             gram, simply use:
  179.  
  180.                $(which prog) args
  181.  
  182.  
  183.            
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.           SKsh Amiga Shell             Page 3               Hints and Tips
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.           Re-sourcing the .skshinit file
  207.  
  208.             If you source the .skshinit file  after you start SKsh, any op-
  209.             tions you have set in your  .skshrc  file  will  potentially be
  210.             overridden.   One   example of this is  the  'e'  option.   The
  211.             .skshinit file sets  it,  which  disables command line editing.
  212.             It  is  reset in the .skshrc file.  If you source the .skshinit
  213.             file again  without sourcing the .skshrc file, you will have to
  214.             reset this option flag manually.
  215.  
  216.  
  217.           Using ^r for reverse searches
  218.  
  219.             The  SKsh  usage of ^r  for  reverse searches is different than
  220.             the ksh usage.  In ksh, you type ^r, which is  echoed, the text
  221.             you wish to search for, and then return.   In  SKsh,  you  type
  222.             the text you wish to search for,  followed by ^r.  I have found
  223.             this usage more convienent.
  224.  
  225.  
  226.           Changing default command options
  227.  
  228.             To  change  the  default  command options for a particular com-
  229.             mand,  define an alias of the same name which uses the  'force'
  230.             keyword.   For   example, to change the 'rm' command so that it
  231.             echoes file names as they are  deleted, put the following alias
  232.             in your .skshrc file:
  233.  
  234.               alias rm = 'force -b rm -v'
  235.  
  236.  
  237.           File name completion hints
  238.  
  239.             The  <esc>=  command can be used to list all file  names  in  a
  240.             given directory.  If the  previous word ends in a slash, <esc>=
  241.             will list each file in the directory:
  242.  
  243.               [dh0:]: more ram:test/
  244.             (press <esc>=)
  245.               1) ram:test/file1.txt
  246.               2) ram:test/file2.txt
  247.               3) ram:test/my_file.txt
  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.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.           Maximum command line length
  272.  
  273.             Command lines  which  are  passed  to  external  functions  are
  274.             limited  in  length  by  AmigaDos  to  255  characters.   Alias
  275.             substitions are limited in length by SKsh to  1023  characters;
  276.             lines longer than that will generate a syntax error.   However,
  277.             SKsh  builtins  can  operate  on  any  number   of   arguments.
  278.             Therefore, a "dir foo:*" might generate a  syntax  error  if  a
  279.             very large number of files are matched.  In these cases  (which
  280.             should be rare) the builtin form of the alias  (in  this  case,
  281.             "ls")  will  operate  correctly  since  there  are  no   length
  282.             limitations.
  283.  
  284.  
  285.           Bypassing Internal Commands
  286.  
  287.             If a name is interpreted  by  SKsh  as  a  builtin,  alias,  or
  288.             function, but is also an external command,  starting  the  name
  289.             with a capital letter will  force  SKsh  to  use  the  external
  290.             command.  SKsh internal  commands  are  case  sensitive,  while
  291.             external binaries are not.  For example,  using  a  lower  case
  292.             "dir" normally invokes the SKsh alias of that  name.   However,
  293.             using "Dir" will invoke the AmigaDos command provided  that  it
  294.             is in your search path.  The builtin form of  the  command  can
  295.             also be unaliased or unset.
  296.  
  297.  
  298.           Making Commands Resident
  299.  
  300.             There  are  several different resident command standards avail-
  301.             able  under AmigaDos.  SKsh uses the ARP method, and will "see"
  302.             resident  commands added to that list (which the SKsh  resident
  303.             command will  do).   If  commands are added to another resident
  304.             list, SKsh will use the disk based form of the command.
  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               Hints and Tips
  328.  
  329.  
  330.  
  331.