

                             [43m  WShell 2.0  [0m
                               ~~~~~~~~~~
                             by Andrew Wong


[32m   <> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <>


   Is WShell still worth upgrading to?  When it was first released in 1988 it
  was received approvingly as an alternative to the frustratingly limited
  CLI.  I have been using WShell for more than three years and still consider
  it to be the best command-line interpreter, but its lead over the Shell
  (henceforth called AmigaShell) in AmigaDOS 2.0 and later releases and over
  freely-distributable competitors has diminished.


[1mMain Advantages of WShell
~~~~~~~~~~~~~~~~~~~~~~~~~
  The shells in AmigaDOS 1.3 and 2.0 are tremendously improved over the CLI
  of earlier releases and there is now some overlap between the AmigaShell
  and WShell.  Following are the main advantages WShell has over AmigaShell;
  features that are similar in both are not examined here, but will be
  discussed in the next section.

[3m1. Filename completion
  With filename completion you can type a partial filename and then press the
  ESC key to cause the shell to fill in the rest.  If there is an ambiguity
  the shell fills in as much as it can and then beeps the screen.  You can
  then either press the ESC key again to cycle through the possibilities or
  type some more characters to make the name unique.  For example, suppose
  you are in the LIBS: directory and want to find the version number of the
  mathieeedoubtrans.library:

    wsh> version m                         ; You type this and press ESC
    wsh> version math                      ; WShell adds "ath" and beeps
    wsh> version mathi                     ; You type "i" and press ESC
    wsh> version mathieee                  ; WShell adds "eee" and beeps
                                           ; You elect to press ESC
    wsh> version mathieeedoubbas.library   ; WShell offers this filename
                                           ; You press ESC again
    wsh> version mathieeedoubtrans.library ; Done!

   This may seem cumbersome, but in reality takes only a couple of seconds
  and saves an untold amount of typing.  WShell's filename completion, called
  FComp, also permits you to remap the keyboard shortcuts used for line
  editing and history operations; and under AmigaDOS 2.0 you can drag
  Workbench icons into shell windows to insert the icon's filename into the
  command line.

[3m2. Improved console handler
  The WShell console handler continues to evolve; the new console handler is
  called DisplayHandler and replaces the ConMan software used with previous
  versions.  It offers the following features:

    a. Session history
    Everybody's favourite feature, the session history is a buffer that
    holds a transcript of the shell session.  A scrollbar is attached to
    the window and sliding it up with the mouse allows you to see
    everything that has scrolled off the screen.

    b. Shell-window menus
    The console handler allows menus to be attached to the shell window.
    Essentially the menus just insert a stream of characters to the
    console; these can be plain text strings or control sequences to
    simulate keyboard actions.  Although the manual doesn't say so,
    menus are only available under AmigaDOS 2.0.

    c. Non-blocking display
    This allows the user to type commands at the shell without halting
    any output the shell might be displaying.  After all, what is the
    good of `type-ahead' otherwise?

    d. More console options
    Windows controlled by the DisplayHandler have more options, such as
    ALT to specify the size of the window when the zoom gadget is
    selected (under AmigaDOS 2.0), S* to cause the window to open on the
    frontmost screen, keywords to control window colours, FONT and
    FONTSIZE, and many others.

[3m3. REXX-language macros
  ARexx has been touted as being amongst the most significant software on the
  Amiga, and one of WShell's primary design goals was to integrate REXX into
  the Amiga's command environment.  WShell can run ARexx programs without the
  RX command (AmigaShell can also do this if the `s' bit is set); it can run
  in-line programs (short ARexx scripts in double- quotes), also without the
  RX command; and ARexx programs can run commands without the "address
  command" statement.

[3m4. ExecIO utility
  This is a tiny program supplied with WShell that is extremely useful as a
  filter in a pipeline and in ARexx programs, particularly to transfer
  information directly into ARexx variables:

    /* get a single line */
    'avail chip | execio var chipmem'
    say "Chip memory:" chipmem "bytes"
    /* get several lines */
    'assign vols | execio stem ass.'
    do i=2 to ass.0
        if pos('[Mounted]', ass.i)=0 then say ass.i 'is not mounted'
    end

[3m5. Fully concurrent piping
  Command piping is the redirection of the output of one command to the input
  of another.  Most shells these days, except AmigaShell, have this facility,
  but it requires programs that are useful in pipelines; none of the standard
  commands qualify, but some of the old ARP ones can be used, and there are
  many UNIX-inspired utilities in the public domain such as awk, cut, grep,
  sed, tr, uniq, and wc that can also be used.  The piping in WShell uses a
  true pipe handler unlike many other shells, which use temporary files.
  WShell 2.0 also has a built-in command called STDIN, which executes its
  standard input:

    wsh> list devs:#?.device lformat "version %s%s" | stdin

[3m6. Prompt and window-title options
  WShell has much more flexibility in defining its prompt string; it
  recognises more than 20 special sequences such as %T for the time, %MP for
  the amount of free memory, %S for the stack size, and so on.  The titlebar
  can also display a string, just like the prompt.  I have my prompt set to
  "%3[%1%c%3]%1 ", which displays the current directory in a pair of blue
  brackets, and my titlebar is "wsh task %n: R(%r,%y)", which displays the
  task number, return code, and the Result2 code.

[3m7. Directory stack
  WShell maintains a directory stack, which allows you to move to a series of
  different directories and back again, rather like the PCD script in the
  S: directory.  There are three commands to manipulate the stack - PushCD,
  PopCD, and SwapCD, though unfortunately there is no command to display the
  stack without changing it.  It is also possible to have directories
  automatically added to the stack every time the current directory is
  changed.

[3m8. The PathHandler
  WShell includes a utility, called PathHandler, to assign several
  directories to a logical name; and it goes far beyond the abilities of the
  AmigaDOS 2.0 "Assign ADD" command.  You simply type something like "assign
  big: path:dir1,dir2" and thereafter every reference to "big:" will refer to
  dir1 and dir2 combined.  I have a directory called sys:util which is split
  into 15 subdirectories; by assigning util: to all the subdirectories
  together I can put util: in the path and access all the programs easily
  while still keeping the sys:util directory organised.


[1mWShell Features Similar to Those in AmigaShell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Following are features that are similar in WShell and AmigaShell, but that
  are enhanced or improved in the former.  Except for variable and command
  substitution all these features have been present in earlier versions of
  WShell and have only recently been introduced to AmigaShell.

[3m1. Line editing and command history
  AmigaShell introduced line editing and command history in AmigaDOS 1.3 to
  catch up with ConMan, but the latter's successor, DisplayHandler, has
  become more powerful still and now has keys to move and delete by words and
  names (strings separated by : and /), delete to the start or end of line,
  define a region, cut and paste to and from the clipboard, transpose
  characters, toggle overstrike mode, and more.  The downside is that many of
  the default key bindings are completely bizarre - a mixture of Emacs and
  I-don't-know-what.  Fortunately they can all be remapped.  The history
  function in AmigaShell has some deficiencies, but they are remedied in the
  History command written by Andy Finkel and available on Fish 673.

[3m2. Resident commands
  AmigaShell introduced resident commands in version 1.3.  The WShell Resi
  command supports auto-loading of programs, which means that a program name
  can be added to the resident list without actually being loaded until the
  program is first accessed; this is similar to the `load on demand' feature
  used by the old ARP ARes command.  WShell searches two resident lists: the
  private WShell one and the AmigaDOS list.  This is particularly to allow
  the use of commands that are internal to AmigaShell, such as Ask, Fault,
  Path, Set, and so on.

[3m3. Built-in commands
  Like AmigaShell 2.0, WShell has a set of built-in commands, but it is much
  smaller than that of most other competitors.  The WShell philosophy is to
  restrict built-in commands largely to those which modify values internal to
  the shell and those which are a part of the batch language.  This is a
  philosophy with which I agree, and I eschew shells that include their own
  versions of Assign, Copy, Delete, Dir, and so on.  WShell does include some
  `luxury' commands - Jump (moves the window to another screen), Mounted
  (tests if a device is mounted), Recall (recalls history by line number),
  Stdin (executes standard input), and the directory stack commands mentioned
  earlier, but otherwise they are all fairly standard: Alias, CD, Echo, Else,
  EndCLI, EndIf, EndSkip, Failat, If, Lab, Prompt, Quit, Resi, Rexx, Skip,
  and Stack.  The Goto, Home, and Pause commands of previous versions have
  been removed.

[3m4. Command aliases
  Aliases were introduced to AmigaShell in 1.3.  In WShell, aliases can be
  global, which means that an alias defined in one shell can immediately be
  used by all others; this cannot be done in AmigaShell.  WShell also permits
  command abbreviations: these are defined as aliases, but are distinguished
  by their mixed case.  For example, if "MAkeDir" were aliased to "makedir"
  then WShell would accept "ma", "mak", "maked", and "makedi" as
  abbreviations, but not "m" or "make".

[1m5. Other features
    a. Additional redirection
    AmigaShell 2.0 added the ">>" symbol to indicate redirection of
    output appended to an existing file, an operation which just about
    every other shell has had for the last twenty years.  WShell adds
    the "<>" symbol, which redirects both input and output streams to a
    console device: "dir inter <> con:wait".  WShell also recognises a
    variable called NOCLOBBER, borrowed from the UNIX csh, which
    prevents files from being overwritten by output redirection.

    b. Command echoing
    This is another concept introduced to AmigaShell in 2.0.  The ECHO
    variable, when set, causes commands to be displayed as they are
    executed.  While AmigaShell simply prints the command name, WShell
    introduces script file commands with "++>" and all other commands
    with "-->".

    c. Implicit CD command
    The term implicit CD refers to the ability to change directories by
    simply typing its name rather than having to use the CD command - a
    very convenient shortcut.  As far as I know this is a WShell
    innovation.

    d. End-of-file closes window
    Typing CTRL-\ to close the shell is not a new concept as UNIX shells
    have always exited upon receiving an EOF, but WShell introduced it
    to the Amiga.  It still has the advantage because the user can
    specify the number of CTRL-\ signals required to close the shell.

    e. Variable and command substitution
    ${Variable} and `command` substitution are new to both shells,
    though they have been available in other shells for some time.
    WShell allows backticked commands to be nested one level deep.


[1mWShell Alternatives
~~~~~~~~~~~~~~~~~~~
  I had hoped to do a detailed comparison of WShell with a number of other
  shells, but most of them have now become so complex and powerful that I
  thought better of the idea.  Whole books have been written that compare
  UNIX shells and as much could be written on WShell and its competitors, so
  I have left this task to someone else.

Other shells available include:

    a. SKsh v2.1 by Steve Koren (Fish 791)
    b. Csh v5.19 by Matt Dillon et.al. (Fish 624)
    c. Bsh v0.98 by Gary Brant (Fish 811)
    d. AUSH v1.52 by Denis Gounelle (Fish 747)
    e. ZShell v1.30 by Paul Hayter (Fish 537)
    f. ASH v1.3 by the ARP team

   Most of these shells have more features than WShell, and SKsh in
  particular is more powerful in many respects: WShell has none of its
  complex control structures, and as mentioned earlier only a handful of
  built-in commands.  WShell uses the same batch language as AmigaShell; for
  its power it relies on ARexx - an approach consistent with the direction
  more Amiga software is taking.

   WShell aims to be fully compatible with AmigaShell.  For the most part it
  adds features without making the shell work differently: all the commands
  of AmigaShell except Alias and Prompt use the same syntax, and commands
  such as If and Run work the same way.  And unlike some of the other shells
  WShell always operates smoothly and predictably.  It is also compact: 20KB
  in size compared to 71KB for SKsh.

   Of the shells listed above, SKsh, Csh, Bsh, and AUSH will be of interest
  primarily to UNIX users; ZShell is intended for those who want a very small
  shell.  ASH, included with the AmigaDOS Resource Project (highly popular in
  the late '80s), is similar to WShell and follows the same principles of
  compatibility and simplicity; but it is old technology, and most of its
  features have since been incorporated into AmigaShell.


[1mWShell Extras
~~~~~~~~~~~~~
  Accompanying this review are several files that can be used with WShell.
  Existing users may find them useful as they are; non-users may gain from
  them some more insight into how WShell works and what it is capable of.
  The files are as follows:

[3m1. A replacement for Which - whence.rexx
  Whence is an ARexx program that works similarly to the standard Which
  command, but whereas Which only looks for commands in the path, Whence
  supports the full WShell search path, including aliases, resident commands,
  and REXX programs.

[3m2. A script for PathHandler - assignall
  In the section on the PathHandler above I described how I assign the
  util: logical device to all of the subdirectories of sys:util concatenated
  together.  The assignall script is used for this purpose; my User-Startup
  file contains the line "assignall util sys:util".  Similarly, if you have a
  very large sys:c directory you can divide it into subdirectories and then
  run "assignall c sys:c".

[3m3. A menu description file - WSH-Menus
  The WSH-Menus file is an sample menu configuration file that is tidier and
  more consistent than the one on the WShell distribution disk.  The
  character that appears after the word `key' is the Right-Amiga keyboard
  shortcut; the sequence "*e[56]" clears the command line.



   Availability: Hard to find - call us at Megadisc for info.
   Author: W. Hawes (author of ARexx)



[32m   <> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <>


