home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Shells / zsh-3.0.5-MIHS / src / Etc / FAQ < prev    next >
Encoding:
Text File  |  1997-09-25  |  68.7 KB  |  1,618 lines

  1. Archive-Name: unix-faq/shell/zsh
  2. Last-Modified: 1997/09/03
  3. Submitted-By: pws@amtp.liv.ac.uk (Peter Stephenson)
  4. Version: $Id: zshfaq.yo,v 1.9 1997/09/03 08:07:18 pws Exp $
  5. Frequency: Monthly
  6. Copyright: (C) P.W. Stephenson, 1995, 1996, 1997 (see end of document)
  7.  
  8. Changes since last issue:
  9.  
  10. 1.4,1.6:  Mention Windows and OS/2 versions
  11. 3.9:      Rewrote explanation of autoload problems
  12.  
  13. This document contains a list of frequently-asked (or otherwise
  14. significant) questions concerning the Z-shell, a command interpreter
  15. for many UNIX systems which is freely available to anyone with FTP
  16. access.  Zsh is among the most powerful freely available Bourne-like
  17. shell for interactive use.
  18.  
  19. If you have never heard of `sh', `csh' or `ksh', then you are
  20. probably better off to start by reading a general introduction to UNIX
  21. rather than this document.
  22.  
  23. If you just want to know how to get your hands on the latest version,
  24. skip to question 1.6; if you want to know what to do with
  25. insoluble problems, go to 5.2.
  26.  
  27. Notation: Quotes `like this' are ordinary textual quotation
  28. marks.  Other uses of quotation marks are input to the shell.
  29.  
  30. Contents:
  31. Chapter 1:  Introducing zsh and how to install it
  32. 1.1. Sources of information
  33. 1.2. What is it?
  34. 1.3. What is it good at?
  35. 1.4. On what machines will it run?  (Plus important compilation notes)
  36. 1.5. What's the latest version?
  37. 1.6. Where do I get it?
  38. 1.7. I don't have root access: how do I make zsh my login shell?
  39.  
  40. Chapter 2:  How does zsh differ from...?
  41. 2.1. sh and ksh?
  42. 2.2. csh?
  43. 2.3. Why do my csh aliases not work?  (Plus other alias pitfalls.)
  44. 2.4. tcsh?
  45. 2.5. bash?
  46. 2.6. Shouldn't zsh be more/less like ksh/(t)csh?
  47.  
  48. Chapter 3:  How to get various things to work
  49. 3.1. Why does `$var' where `var="foo bar"' not do what I expect?
  50. 3.2. What is the difference between `export' and the ALL_EXPORT option?
  51. 3.3. How do I turn off spelling correction/globbing for a single command?
  52. 3.4. How do I get the meta key to work on my xterm?
  53. 3.5. How do I automatically display the directory in my xterm title bar?
  54. 3.6. How do I make the completion list use eight bit characters?
  55. 3.7. Why does my terminal act funny in some way?
  56. 3.8. Why does zsh not work in an Emacs shell mode any more?
  57. 3.9. Why do my autoloaded functions not autoload [the first time]?
  58. 3.10. How does base arithmetic work?
  59. 3.11. How do I get a newline in my prompt?
  60. 3.12. Why does `bindkey ^a command-name' or 'stty intr ^-' do something funny?
  61. 3.13. Why can't I bind \C-s and \C-q any more?
  62. 3.14. How do I execute command `foo' within function `foo'?
  63. 3.15. Why do history substitutions with single bangs do something funny?
  64. 3.16. Why does zsh kill off all my background jobs when I logout?
  65. 3.17. How do I list all my history entries?
  66. 3.18. How does the alternative loop syntax, e.g. `while {...} {...}' work?
  67.  
  68. Chapter 4:  The mysteries of completion
  69. 4.1. What is completion?
  70. 4.2. What sorts of things can be completed?
  71. 4.3. How does zsh deal with ambiguous completions?
  72. 4.4. How do I get started with programmable completion?
  73. 4.5. And if programmable completion isn't good enough?
  74.  
  75. Chapter 5:  The future of zsh
  76. 5.1. What bugs are currently known and unfixed? (Plus recent important changes)
  77. 5.2. Where do I report bugs, get more info / who's working on zsh?
  78. 5.3. What's on the wish-list?
  79.  
  80. Acknowledgments
  81.  
  82. Copyright
  83. --- End of Contents ---
  84.  
  85. Chapter 1: Introducing zsh and how to install it
  86.  
  87. 1.1: Sources of information
  88.  
  89.   Information on zsh is available via the World Wide Web.  The URL
  90.   is http://www.peak.org/zsh/ (note the change of address from the
  91.   end of April 1997).  The server provides this FAQ and much else and is
  92.   now maintained by Timothy Luoma.  The FAQ is at
  93.   http://www.peak.org/zsh/FAQ/ .
  94.  
  95.   Another useful source of information is the collection of FAQ articles
  96.   posted frequently to the Usenet news groups comp.unix.questions,
  97.   comp.unix.shells and comp.answers with answers to general questions
  98.   about UNIX.  The fifth of the seven articles deals with shells,
  99.   including zsh, with a brief description of differences.  (This article
  100.   also talks about shell startup files which would otherwise rate a
  101.   mention here.)  There is also a separate FAQ on shell differences
  102.   and how to change your shell.  Usenet FAQs are available via FTP
  103.   from rtfm.mit.edu and mirrors and also on the World Wide Web; see
  104.  
  105.     USA         http://www.cis.ohio-state.edu/hypertext/faq/usenet/top.html
  106.     UK          http://www.lib.ox.ac.uk/internet/news/faq/comp.unix.shell.html
  107.     Netherlands http://www.cs.ruu.nl/wais/html/na-dir/unix-faq/shell/.html
  108.  
  109.   The latest version of this FAQ is also available directly from any
  110.   of the zsh archive sites listed in question 1.6.
  111.  
  112.   (As a method of reading this in Emacs, you can type \M-2 \C-x $ to
  113.   make all the indented text vanish, then \M-0 \C-x $ when you are on
  114.   the title you want.)
  115.  
  116.   For any more eclectic information, you should contact the mailing
  117.   list:  see question 5.2.
  118.  
  119. 1.2: What is it?
  120.  
  121.   Zsh is a UNIX command interpreter (shell) which of the standard
  122.   shells most resembles the Korn shell (ksh); it's compatibility with
  123.   the 1988 Korn shell has been gradually increasing.  It includes
  124.   enhancements of many types, notably in the command-line editor,
  125.   options for customising its behaviour, filename globbing, features
  126.   to make C-shell (csh) users feel more at home and extra features
  127.   drawn from tcsh (another `custom' shell).
  128.  
  129.   It was written by Paul Falstad when a student at Princeton; however,
  130.   Paul doesn't maintain it any more and enquiries should be sent to
  131.   the mailing list (see question 5.2.  Zsh is distributed under a
  132.   standard Berkeley style copyright.
  133.  
  134.   For more information, the files Doc/intro.txt or Doc/intro.troff
  135.   included with the source distribution are highly recommended.  A list
  136.   of features is given in FEATURES, also with the source.
  137.  
  138. 1.3: What is it good at?
  139.  
  140.   Here are some things that zsh is particularly good at.  No claim of
  141.   exclusivity is made, especially as shells copy one another, though
  142.   in the areas of command line editing and globbing zsh is well ahead
  143.   of the competition.  I am not aware of a major interactive feature
  144.   in any other freely-available shell which zsh does not also have
  145.   (except smallness).
  146.  
  147.   o  Command line editing:
  148.  
  149.     o  programmable completion: incorporates the ability to use
  150.        the full power of zsh globbing (compctl -g),
  151.     o  multi-line commands editable as a single buffer (even files!),
  152.     o  variable editing (vared),
  153.     o  command buffer stack,
  154.     o  print text straight into the buffer for immediate editing (print -z),
  155.     o  execution of unbound commands,
  156.     o  menu completion,
  157.     o  variable, editing function and option name completion,
  158.     o  inline expansion of variables, history commands.  
  159.  
  160.   o  Globbing --- extremely powerful, including:
  161.  
  162.     o  recursive globbing (cf. find),
  163.     o  file attribute qualifiers (size, type, etc. also cf. find),
  164.     o  full alternation and negation of patterns.
  165.  
  166.   o  Handling of multiple redirections (simpler than tee).
  167.   o  Large number of options for tailoring.
  168.   o  Path expansion (=foo -> /usr/bin/foo).
  169.   o  Adaptable messages for spelling, watch, time as well as prompt
  170.      (including conditional expressions).
  171.   o  Named directories.
  172.   o  Comprehensive integer arithmetic.
  173.   o  Manipulation of arrays (including reverse subscripting).
  174.   o  Spelling correction.
  175.  
  176. 1.4: On what machines will it run?
  177.  
  178.   From version 3.0, zsh uses GNU autoconf as the installation
  179.   mechanism.  This considerably increases flexibility over the old
  180.   `buildzsh' mechanism.  Consequently, zsh should compile and run on
  181.   any modern version of UNIX, and a great many not-so-modern versions
  182.   too.  The file Etc/MACHINES in the distribution has more details.
  183.  
  184.   There are also now separate ports for Windows and OS/2, see `Where
  185.   do I get it' below.
  186.  
  187.   If you need to change something to support a new machine, it would be
  188.   appreciated if you could add any necessary preprocessor code and
  189.   alter configure.in and config.h.in to configure zsh automatically,
  190.   then send the required context diffs to the list (see question
  191.   5.2).  Changes based on version 2.5 are very unlikely to
  192.   be useful.
  193.  
  194.   To get it to work, retrieve the source distribution (see question
  195.   1.6), un-gzip it, un-tar it and read the INSTALL file in the top
  196.   directory.  Also read the Etc/MACHINES file for up-to-date
  197.   information on compilation on certain architectures.
  198.  
  199.   *Note for users of nawk* (The following information comes from Zoltan
  200.   Hidvegi): On some systems nawk is broken and produces an incorrect
  201.   signames.h file. This make the signals code unusable. This often happens
  202.   on Ultrix, HP-UX, IRIX (?). Install gawk if you experience such problems.
  203.  
  204. 1.5: What's the latest version?
  205.  
  206.   Zsh 3.0.4 has now been released. The new major number 3.0 largely
  207.   reflects the considerable internal changes in zsh to make it more
  208.   reliable, consistent and (where possible) compatible.  Those
  209.   planning on upgrading their zsh installation should take a look at
  210.   the list of incompatibilities at the end of 5.1.  This is longer
  211.   than usual due to enhanced sh, ksh and POSIX compatibility.
  212.  
  213.   The beta version 3.1.2 has also been released.  Development of zsh
  214.   is usually patch by patch, with each intermediate version publicly
  215.   available.  Note that this `open' development system does mean bugs
  216.   are sometimes introduced into the most recent archived version.
  217.   These are usually fixed quickly.
  218.  
  219.   Note also that as the shell changes, it may become incompatible with
  220.   older versions; see the end of question 5.1 for a partial list.
  221.   Changes of this kind are almost always forced by an awkward or
  222.   unnecessary feature in the original design (as perceived by current
  223.   users), or to enhance compatibility with other Bourne shell
  224.   derivatives, or (most recently) to provide POSIX compliancy.
  225.  
  226. 1.6: Where do I get it?
  227.  
  228.   The archive is now run by Zoltan Hidvegi <hzoli@cs.elte.hu>.  The
  229.   following are known mirrors (kept frequently up to date); the first
  230.   is the official archive site.  All are available by anonymous FTP.
  231.   The major sites keep test versions in the 'testing' subdirectory:
  232.   such up-to-the-minute development versions should only be retrieved
  233.   if you actually plan to help test the latest version of the shell.
  234.  
  235.     Hungary   ftp://ftp.cs.elte.hu/pub/zsh/
  236.               (also http://www.cs.elte.hu/pub/zsh/ )
  237.     Australia ftp://ftp.ips.gov.au/mirror/zsh/
  238.     Finland   ftp://ftp.funet.fi/pub/unix/shells/zsh/
  239.     France    ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/
  240.     Germany   ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/
  241.               ftp://ftp.gmd.de/packages/zsh/
  242.               ftp://ftp.uni-trier.de/pub/unix/shell/zsh/
  243.     Japan     ftp://ftp.tohoku.ac.jp/mirror/zsh/
  244.               ftp://ftp.nis.co.jp/pub/shells/zsh/
  245.     Norway    ftp://ftp.uit.no/pub/unix/shells/zsh/
  246.     Slovenia  ftp://ftp.siol.net/pub/unix/shells/zsh/
  247.     Sweden    ftp://ftp.lysator.liu.se/pub/unix/zsh/
  248.     UK        ftp://ftp.net.lut.ac.uk/zsh/
  249.               (also by FSP at port 21)
  250.     USA       ftp://ftp.math.gatech.edu/pub/zsh/
  251.               ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/
  252.               ftp://ftp.sterling.com/zsh/
  253.               ftp://ftp.rge.com/pub/shells/zsh/
  254.  
  255.   The Windows port mentioned above is maintained separately by Amol
  256.   Deshpande <amol@microsoft.com>; please mail Amol directly about any
  257.   Windows-specific problems.  This is quite new, so don't expect it to
  258.   be perfect.  You can get it from:
  259.  
  260.             ftp://ftp.blarg.net/users/amol/zsh  
  261.  
  262.   Likewise the OS/2 port is available from TAMURA Kent
  263.   <kent@tril.ibm.co.jp at
  264.  
  265.             http://cgi.din.or.jp/~tkent/tmp/zsh-3.0.0-os2-a01.zip
  266.  
  267. 1.7: I don't have root access: how do I make zsh my login shell?
  268.  
  269.   Unfortunately, on many machines you can't use `chsh' to change your
  270.   shell unless the name of the shell is contained in /etc/shells, so if
  271.   you have your own copy of zsh you need some sleight-of-hand to use it
  272.   when you log on.  (Simply typing `zsh' is not really a solution since
  273.   you still have your original login shell waiting for when you exit.)
  274.  
  275.   The basic idea is to use `exec <zsh-path>' to replace the current
  276.   shell with zsh.  Often you can do this in a login file such as .profile 
  277.   (if your shell is sh or ksh) or .login (if it's csh).  Make sure you
  278.   have some way of altering the file (e.g. via FTP) before you try this as
  279.   `exec' is often rather unforgiving. 
  280.  
  281.   If you have zsh in a subdirectory `bin' of your home directory,
  282.   put this in .profile:
  283.  
  284.     [ -f $HOME/bin/zsh ] && exec $HOME/bin/zsh -l
  285.  
  286.   or if your login shell is csh or tcsh, put this in .login:
  287.  
  288.     if ( -f ~/bin/zsh ) exec ~/bin/zsh -l
  289.  
  290.   (in each case the `-l' tells zsh it is a login shell).
  291.  
  292.   If you want to check this works before committing yourself to it,
  293.   you can make the login shell ask whether to exec zsh.  The following
  294.   work for Bourne-like shells:
  295.  
  296.     [ -f $HOME/bin/zsh ] && {
  297.             echo "Type Y to run zsh: \c"
  298.             read line
  299.             [ "$line" = Y ] && exec $HOME/bin/zsh -l
  300.     }
  301.  
  302.   and for C-shell-like shells:
  303.  
  304.     if ( -f ~/bin/zsh ) then
  305.             echo -n "Type Y to run zsh: "
  306.             if ( "$<" == Y ) exec ~/bin/zsh -l
  307.     endif
  308.  
  309.   It's not a good idea to put this (even without the -l) into .cshrc,
  310.   at least without some tests on what the csh is supposed to be doing,
  311.   as that will cause _every_ instance of csh to turn into a zsh and
  312.   will cause csh scripts (yes, unfortunately some people write these)
  313.   which do not call `csh -f' to fail.  If you want to tell xterm to
  314.   run zsh, change the SHELL environment variable to the full path of
  315.   zsh at the same time as you exec zsh (in fact, this is sensible for
  316.   consistency even if you aren't using xterm).  If you have to exec
  317.   zsh from your .cshrc, a minimum safety check is `if ($?prompt) exec
  318.   zsh'.
  319.  
  320.   If you like your login shell to appear in the process list as `-zsh',
  321.   you can link `zsh' to `-zsh' (e.g. by `ln -s ~/bin/zsh 
  322.   ~/bin/-zsh') and change the exec to `exec -zsh'.  (Make sure
  323.   `-zsh' is in your path.) This has the same effect as the `-l'
  324.   option. 
  325.  
  326.   Footnote: if you DO have root access, make sure zsh goes in
  327.   /etc/shells on all appropriate machines, including NIS clients, or you
  328.   may have problems with FTP to that machine.
  329.  
  330. Chapter 2: How does zsh differ from...?
  331.  
  332. As has already been mentioned, zsh is most similar to ksh, while many
  333. of the additions are to please csh users.  Here are some more detailed
  334. notes.  See also the article `UNIX shell differences and how to change
  335. your shell' posted frequently to the USENET group comp.unix.shell.
  336.  
  337. 2.1: Differences from sh and ksh
  338.  
  339.   Most features of ksh (and hence also of sh) are implemented in zsh;
  340.   problems can arise because the implementation is slightly different.
  341.   Note also that not all ksh's are the same either.  I have based this
  342.   on the 11/16/88f version of ksh; differences with ksh93 will be more
  343.   substantial.
  344.  
  345.   As a summary of the status:
  346.  
  347.   1) because of all the options it is not safe to assume a general
  348.      zsh run by a user will behave as if sh or ksh compatible;
  349.   2) invoking zsh as sh or ksh (or if either is a symbolic link to
  350.      zsh) sets appropriate options and improves compatibility (from
  351.      within zsh itself, calling `ARGV0=sh zsh' will also work);
  352.   3) from version 3.0 onward the degree of compatibility with sh
  353.      under these circumstances is very high:  zsh can now be used
  354.      with GNU configure or perl's Configure, for example;
  355.   4) the degree of compatibility with ksh is also high, but a few
  356.      things are missing:  for example the more sophisticated
  357.      pattern-matching expressions are different --- see the detailed
  358.      list below;
  359.   5) also from 3.0, the command `emulate' is available: `emulate
  360.      ksh' and `emulate sh' set various options as well as changing the
  361.      effect of single-letter option flags as if the shell had been
  362.      invoked with the appropriate name.  Including the commands
  363.      `emulate sh; setopt localoptions' in a shell function will
  364.      turn on sh emulation for that function only.
  365.  
  366.   The classic difference is word splitting, discussed in 3.1; this
  367.   catches out very many beginning zsh users.  As explained there, this
  368.   is actually a bug in every other shell.  The answer is to set
  369.   SH_WORD_SPLIT for backward compatibility.  The next most classic
  370.   difference is that unmatched glob patterns cause the command to
  371.   abort; set NO_NOMATCH for those.
  372.  
  373.   Here is a list of various options which will increase ksh
  374.   compatibility, though maybe decrease zsh's abilities: see the manual
  375.   entries for GLOB_SUBST, IGNORE_BRACES (though brace expansion occurs
  376.   in some versions of ksh), KSH_ARRAYS, KSH_OPTION_PRINT, LOCAL_OPTIONS,
  377.   NO_BAD_PATTERN, NO_BANG_HIST, NO_EQUALS, NO_HUP, NO_NOMATCH, NO_RCS,
  378.   NO_SHORT_LOOPS, PROMPT_SUBST, RM_STAR_SILENT, POSIX_BUILTINS,
  379.   SH_FILE_EXPANSION, SH_GLOB, SH_OPTION_LETTERS, SH_WORD_SPLIT (see
  380.   question 3.1) and SINGLE_LINE_ZLE.  Note that you can also disable
  381.   any built-in commands which get in your way.  If invoked as `ksh',
  382.   the shell will try and set suitable options.
  383.  
  384.   Here are some differences from ksh which might prove significant for
  385.   ksh programmers, some of which may be interpreted as bugs; there
  386.   must be more.  Note that this list is deliberately rather full and
  387.   that most of the items are fairly minor.  Those marked `*' perform
  388.   in a ksh-like manner if the shell is invoked with the name `ksh', or
  389.   if `emulate ksh' is in effect.  Capitalised words with underlines
  390.   refer to shell options. 
  391.  
  392.   o  Syntax:
  393.  
  394.     o * Shell word splitting: see question 3.1.
  395.     o * Arrays are (by default) more csh-like than ksh-like:
  396.         subscripts start at 1, not 0; array[0] refers to array[1];
  397.         `$array' refers to the whole array, not $array[0];
  398.         braces are unnecessary: $a[1] == ${a[1]}, etc.
  399.         The KSH_ARRAYS option is now available.
  400.     o   Coprocesses are established by `coproc'; `|&' behaves like
  401.         csh. 
  402.  
  403.   o  Command line substitutions, globbing etc.:
  404.  
  405.     o * Failure to match a globbing pattern causes an error (use
  406.         NO_NOMATCH).
  407.     o * The results of parameter substitutions are treated as plain text:
  408.         `foo="*"; print $foo' prints all files in ksh but `*' in zsh.
  409.         (GLOB_SUBST has been added to fix this.)
  410.     o   The backslash in $(echo '\$x') is treated differently:  in ksh,  it
  411.         is not stripped, in zsh it is.  (The `...` form gives the same in
  412.         both shells.)
  413.     o * $PSn do not do parameter substitution by default (use PROMPT_SUBST).
  414.     o   Globbing does not allow ksh-style `pattern-lists'.  Equivalents:
  415.  
  416. ----------------------------------------------------------------------
  417.       ksh             zsh          Meaning
  418.       -----           -----        ---------
  419.      !(foo)            ^foo        Anything but foo.
  420.                 or   foo1~foo2     Anything matching foo1 but foo2[1].
  421. @(foo1|foo2|...)  (foo1|foo2|...)  One of foo1 or foo2 or ...
  422.      ?(foo)           (foo|)       Zero or one occurrences of foo.
  423.      *(foo)           (foo)#       Zero or more occurrences of foo.
  424.      +(foo)           (foo)##      One or more occurrences of foo.
  425. ----------------------------------------------------------------------
  426.  
  427.       The `^', `~' and `#' (but not `|')forms require EXTENDED_GLOB.
  428.  
  429.       [1] Note that `~' is the only globbing operator to have a lower
  430.         precedence than `/'.  For example, `**/foo~*bar*' matches any
  431.         file in a subdirectory called `foo', except where `bar'
  432.         occurred somewhere in the path (e.g. `users/barstaff/foo' will
  433.         be excluded by the `~' operator).  As the `**' operator cannot
  434.         be grouped (inside parentheses it is treated as `*'), this is
  435.         the way to exclude some subdirectories from matching a `**'.
  436.     o   Unquoted assignments do file expansion after `:'s (intended for
  437.         PATHs). 
  438.     o   `integer' does not allow `-i'.
  439.  
  440.   o  Command execution:
  441.  
  442.     o * There is no $ENV variable (use /etc/zshrc, ~/.zshrc; 
  443.         note also $ZDOTDIR).
  444.     o   $PATH is not searched for commands specified
  445.         at invocation without -c.
  446.  
  447.   o  Aliases and functions:
  448.  
  449.     o   The order in which aliases and functions are defined is significant:
  450.         function definitions with () expand aliases -- see question 2.3.
  451.     o   Aliases and functions cannot be exported.
  452.     o   There are no tracked aliases: command hashing replaces these.
  453.     o   The use of aliases for key bindings is replaced by `bindkey'.
  454.     o * Options are not local to functions (use LOCAL_OPTIONS; note this
  455.         may always be unset locally to propagate options settings from a
  456.         function to the calling level).
  457.  
  458.     o  Traps and signals:
  459.  
  460.     o   Traps are not local to functions.
  461.     o   TRAPERR has become TRAPZERR (this was forced by UNICOS which
  462.         has SIGERR).
  463.  
  464.   o  Editing:
  465.  
  466.     o   The options emacs, gmacs, viraw are not supported.
  467.         Use bindkey to change the editing behaviour: `set -o {emacs,vi}'
  468.         becomes `bindkey -{e,v}'; for gmacs, go to emacs mode and use
  469.         `bindkey \^t gosmacs-transpose-characters'.
  470.     o   The `keyword' option does not exist and `-k' is instead
  471.         interactivecomments.  (`keyword' will not be in the next ksh
  472.         release either.)
  473.     o   Management of histories in multiple shells is different:
  474.         the history list is not saved and restored after each command.
  475.     o   `\' does not escape editing chars (use `^V').
  476.     o   Not all ksh bindings are set (e.g. `<ESC>#'; try `<ESC>q').
  477.     o * `#' in an interactive shell is not treated as a comment by
  478.         default. 
  479.  
  480.   o  Built-in commands:
  481.  
  482.     o   Some built-ins (r, autoload, history, integer ...)
  483.         were aliases in ksh. 
  484.     o   There is no built-in command newgrp: use e.g. `alias
  485.         newgrp="exec newgrp"'
  486.     o   `jobs' has no `-n' flag.
  487.     o   `read' has no `-s' flag.
  488.     o   In `let "i = foo"', foo is evaluated as a number, not an
  489.         expression (although in `let "i = $foo"' +it is treated as an
  490.         expression). 
  491.  
  492.   o  Other idiosyncrasies:
  493.  
  494.     o   `select' always redisplays the list of selections on each loop.
  495.  
  496. 2.2: Similarities with csh
  497.  
  498.   Although certain features aim to ease the withdrawal symptoms of csh
  499.   (ab)users, the syntax is in general rather different and you should
  500.   certainly not try to run scripts without modification.  The c2z script
  501.   is provided with the source (in Misc/c2z) to help convert .cshrc
  502.   and .login files; see also the next question concerning aliases,
  503.   particularly those with arguments.
  504.  
  505.   Csh-compatibility additions include:
  506.  
  507.   o   logout, rehash, source, (un)limit built-in commands.
  508.   o   *rc file for interactive shells.
  509.   o   Directory stacks.
  510.   o   cshjunkie*, ignoreeof options.
  511.   o   The CSH_NULL_GLOB option.
  512.   o   >&, |& etc. redirection.
  513.       (Note that `>file 2>&1' is the standard Bourne shell command for
  514.       csh's `>&file'.)
  515.   o   foreach ... loops; alternative syntax for other loops.
  516.   o   Alternative syntax `if ( ... ) ...', though this still doesn't
  517.       work like csh: it expects a command in the parentheses.  Also
  518.       `for', `which'.
  519.   o   $PROMPT as well as $PS1, $status as well as $?,
  520.       $#argv as well as $#, .... 
  521.   o   Escape sequences via % for prompts.
  522.   o   Special array variables $PATH etc. are colon-separated, $path
  523.       are arrays.
  524.   o   !-type history (which may be turned off via `setopt
  525.       nobanghist').
  526.   o   Arrays have csh-like features (see under 2.1).
  527.  
  528. 2.3: Why do my csh aliases not work?  (Plus other alias pitfalls.)
  529.  
  530.   First of all, check you are using the syntax
  531.  
  532.     alias newcmd='list of commands'
  533.  
  534.   and not
  535.  
  536.     alias newcmd 'list of commands'
  537.  
  538.   which won't work. (It tells you if `newcmd' and `list of commands' are
  539.   already defined as aliases.)
  540.  
  541.   Otherwise, your aliases probably contain references to the command
  542.   line of the form `\!*', etc.  Zsh does not handle this behaviour as it
  543.   has shell functions which provide a way of solving this problem more
  544.   consistent with other forms of argument handling.  For example, the
  545.   csh alias
  546.  
  547.     alias cd 'cd \!*; echo $cwd'
  548.  
  549.   can be replaced by the zsh function,
  550.  
  551.     cd() { builtin cd $*; echo $PWD; }
  552.  
  553.   (the `builtin' tells zsh to use its own `cd', avoiding an infinite loop)
  554.   or, perhaps better,
  555.  
  556.     cd() { builtin cd $*; print -D $PWD; }
  557.  
  558.   (which converts your home directory to a ~).  In fact, this problem is
  559.   better solved by defining the special function chpwd() (see the manual).
  560.   Note also that the `;' at the end of the function is optional in zsh,
  561.   but not in ksh or sh (for sh's where it exists).
  562.  
  563.   Here is Bart Schaefer's guide to converting csh aliases for zsh.
  564.  
  565.   1) If the csh alias references "parameters" (\!:1, \!* etc.),
  566.      then in zsh you need a function (referencing $1, $* etc.).
  567.      Otherwise, you can use a zsh alias.
  568.  
  569.   2) If you use a zsh function, you need to refer _at_least_ to
  570.      $* in the body (inside the { }).  Parameters don't magically
  571.      appear inside the { } the way they get appended to an alias.
  572.  
  573.   3) If the csh alias references its own name (alias rm "rm -i"),
  574.      then in a zsh function you need the "command" keyword
  575.      (function rm() { command rm -i $* }), but in a zsh alias
  576.      you don't (alias rm="rm -i").
  577.  
  578.   4) If you have aliases that refer to each other (alias ls "ls -C";
  579.      alias lf "ls -F" ==> lf == ls -C -F) then you must either:
  580.  
  581.         o  convert all of them to zsh functions; or
  582.         o  after converting, be sure your .zshrc defines all of your
  583.            aliases before it defines any of your functions.
  584.  
  585.      Those first four are all you really need, but here are four more for
  586.      heavy csh alias junkies:
  587.  
  588.   5) Mapping from csh alias "parameter referencing" into zsh function
  589.      (assuming shwordsplit and ksharrays are NOT set in zsh):
  590.  
  591.       csh             zsh
  592.      =====         ==========
  593.      \!*           $*              (or $argv)
  594.      \!^           $1              (or $argv[1])
  595.      \!:1          $1
  596.      \!:2          $2              (or $argv[2], etc.)
  597.      \!$           $*[$#]          (or $argv[$#], or $*[-1])
  598.      \!:1-4        $*[1,4]
  599.      \!:1-         $*[1,$#-1]      (or $*[1,-2])
  600.      \!^-          $*[1,$#-1]
  601.      \!*:q         "$@"            ($*:q doesn't work (yet))
  602.      \!*:x         $=*             ($*:x doesn't work (yet))
  603.  
  604.   6) Remember that it is NOT a syntax error in a zsh function to
  605.      refer to a position ($1, $2, etc.) greater than the number of
  606.      parameters. (E.g., in a csh alias, a reference to \!:5 will
  607.      cause an error if 4 or fewer arguments are given; in a zsh
  608.      function, $5 is the empty string if there are 4 or fewer
  609.      parameters.)
  610.  
  611.   7) To begin a zsh alias with a - (dash, hyphen) character, use
  612.      `alias --':
  613.  
  614.              csh                            zsh
  615.         ===============             ==================
  616.         alias - "fg %-"             alias -- -="fg %-"
  617.  
  618.   8) Stay away from `alias -g' in zsh until you REALLY know what
  619.      you're doing.
  620.  
  621.   There is one other serious problem with aliases: consider
  622.  
  623.     alias l='/bin/ls -F'
  624.     l() { /bin/ls -la $* | more }
  625.  
  626.   `l' in the function definition is in command position and is expanded
  627.   as an alias, defining `/bin/ls' and `-F' as functions which call
  628.   `/bin/ls', which gets a bit recursive.  This can be avoided if you use
  629.   `function' to define a function, which doesn't expand aliases.  It is
  630.   possible to argue for extra warnings somewhere in this mess.  Luckily,
  631.   it is not possible to define `function' as an alias.
  632.  
  633.   Bart Schaefer's rule is:  Define first those aliases you expect to
  634.   use in the body of a function, but define the function first if the
  635.   alias has the same name as the function.
  636.  
  637. 2.4: Similarities with tcsh
  638.  
  639.   (The sections on csh apply too, of course.)  Certain features have
  640.   been borrowed from tcsh, including $watch, run-help, $savehist,
  641.   $histlit, periodic commands etc., extended prompts, sched
  642.   and which built-ins.  Programmable completion was inspired by,
  643.   but is entirely different to, tcsh's `complete'.  (There is a perl
  644.   script called lete2ctl in the Misc directory of the source
  645.   distribution to convert `complete' to `compctl' statements.)
  646.   This list is not definitive:  some features have gone in the other
  647.   direction. 
  648.  
  649.   If you're missing the editor function run-fg-editor, try something
  650.   with `bindkey -s' (which binds a string to a keystroke), e.g.
  651.  
  652.     bindkey -s '^z' '\eqfg %$EDITOR:t\n'
  653.  
  654.   which pushes the current line onto the stack and tries to bring a job
  655.   with the basename of your editor into the foreground.  `bindkey -s'
  656.   allows limitless possibilities along these lines.  You can execute
  657.   any command in the middle of editing a line in the same way,
  658.   corresponding to tcsh's `-c' option:
  659.  
  660.     bindkey -s '^p' '\eqpwd\n'
  661.  
  662.   In both these examples, the `\eq' saves the current input line to
  663.   be restored after the command runs; a better effect with multiline
  664.   buffers is achieved if you also have
  665.  
  666.     bindkey '\eq' push-input
  667.  
  668.   to save the entire buffer.
  669.  
  670. 2.5: Similarities with bash
  671.  
  672.   The Bourne-Again Shell, bash, is another enhanced Bourne-like shell;
  673.   the most obvious difference from zsh is that it does not attempt to
  674.   emulate the Korn shell.  Since both shells are under active
  675.   development it is probably not sensible to be too specific here.
  676.   Broadly, bash has paid more attention to standards compliancy
  677.   (i.e. POSIX) for longer, and has so far avoided the more abstruse
  678.   interactive features (programmable completion, etc.) that zsh has.
  679.  
  680. 2.6: Shouldn't zsh be more/less like ksh/(t)csh?
  681.  
  682.   People often ask why zsh has all these `unnecessary' csh-like features,
  683.   or alternatively why zsh doesn't understand more csh syntax.  This is
  684.   far from a definitive answer and the debate will no doubt continue.
  685.  
  686.   Paul's object in writing zsh was to produce a ksh-like shell which
  687.   would have features familiar to csh users.  For a long time, csh was
  688.   the preferred interactive shell and there is a strong resistance to
  689.   changing to something unfamiliar, hence the additional syntax and
  690.   CSH_JUNKIE options.  This argument still holds.  On the other hand,
  691.   the arguments for having what is close to a plug-in replacement for ksh
  692.   are, if anything, even more powerful:  the deficiencies of csh as a
  693.   programming language are well known (look in any Usenet FAQ archive, e.g.
  694.     http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/\ 
  695.         shell/csh-whynot/faq.html
  696.   if you are in any doubt) and zsh is able to run many standard
  697.   scripts such as /etc/rc.
  698.  
  699.   Of course, this makes zsh rather large and feature-ridden so that it
  700.   seems to appeal mainly to hackers.  The only answer, perhaps not
  701.   entirely satisfactory, is that you have to ignore the bits you don't
  702.   want.
  703.  
  704. Chapter 3: How to get various things to work
  705.  
  706. 3.1: Why does `$var' where `var="foo bar"' not do what I expect?
  707.  
  708.   In most Bourne-shell derivatives, multiple-word variables such as
  709.  
  710.     var="foo bar"
  711.  
  712.   are split into words when passed to a command or used in a `for foo in
  713.   $var' loop.  By default, zsh does not have that behaviour: the
  714.   variable remains intact.  (This is not a bug!  See below.)  An option
  715.   (shwordsplit) exists to provide compatibility.
  716.  
  717.   For example, defining the function args to show the number of its
  718.   arguments:
  719.  
  720.     args() { echo $#; }
  721.  
  722.   and with our definition of `var',
  723.  
  724.     args $var
  725.  
  726.   produces the output `1'.  After
  727.  
  728.     setopt shwordsplit
  729.  
  730.   the same function produces the output `2', as with sh and ksh.
  731.  
  732.   Unless you need strict sh/ksh compatibility, you should ask yourself
  733.   whether you really want this behaviour, as it can produce unexpected
  734.   effects for variables with entirely innocuous embedded spaces.  This
  735.   can cause horrendous quoting problems when invoking scripts from
  736.   other shells.  The natural way to produce word-splitting behaviour
  737.   in zsh is via arrays.  For example,
  738.  
  739.     set -A array one two three twenty
  740.  
  741.   (or
  742.  
  743.     array=(one two three twenty)
  744.  
  745.   if you prefer), followed by
  746.  
  747.     args $array
  748.  
  749.   produces the output `4', regardless of the setting of shwordsplit.
  750.   Arrays are also much more versatile than single strings.  Probably
  751.   if this mechanism had always been available there would never have
  752.   been automatic word splitting in scalars, which is a sort of
  753.   uncontrollable poor man's array.
  754.  
  755.   Note that this happens regardless of the value of the internal field
  756.   separator, $IFS; in other words, with `IFS=:; foo=a:b; args $foo'
  757.   you get the answer 1.
  758.  
  759.   Other ways of causing word splitting include a judicious use of
  760.   `eval':
  761.  
  762.     sentence="Longtemps, je me suis couch\\'e de bonne heure."
  763.     eval "words=($sentence)"
  764.  
  765.   after which $words is an array with the words of $sentence (note
  766.   characters special to the shell, such as the `'' in this example,
  767.   must already be quoted), or, less standard but more reliable,
  768.   turning on shwordsplit for one variable only:
  769.  
  770.     args ${=sentence}
  771.  
  772.   always returns 8 with the above definition of `args'.  (In older
  773.   versions of zsh, ${=foo} toggled shwordsplit; now it forces it on.)
  774.  
  775.   Note also the "$@" method of word splitting is always available in zsh
  776.   functions and scripts (though strictly this does array splitting, not
  777.   word splitting).
  778.  
  779.   Shwordsplit is set when zsh is invoked with the names `ksh' or `sh',
  780.   or (entirely equivalent) when `emulate ksh' or `emulate sh' is in
  781.   effect.
  782.  
  783. 3.2: What is the difference between `export' and the ALL_EXPORT option?
  784.  
  785.   Normally, you would put a variable into the environment by using
  786.   `export var'.  The command `setopt allexport' causes all
  787.   variables which are subsequently set (N.B. not all the ones which
  788.   already exist) to be put into the environment.
  789.  
  790.   This may seem a useful shorthand, but in practice it can have
  791.   unhelpful side effects:
  792.  
  793.   1) Since every variable is in the environment as well as remembered
  794.      by the shell, the memory for it needs to be allocated twice.
  795.      This is bigger as well as slower.
  796.   2) It really is *every* variable which is exported, even loop
  797.      variables in `for' loops.  This is probably a waste.
  798.   3) An arbitrary variable created by the user might have a special
  799.      meaning to a command.  Since all shell variables are visible to
  800.      commands, there is no protection against this.
  801.  
  802.   For these reasons it is usually best to avoid ALL_EXPORT unless you
  803.   have a specific use for it.  One safe use is to set it before
  804.   creating a list of variables in an initialisation file, then unset
  805.   it immediately afterwards.  Only those variables will be automatically
  806.   exported.
  807.  
  808. 3.3: How do I turn off spelling correction/globbing for a single command?
  809.  
  810.   In the first case, you presumably have `setopt correctall' in an
  811.   initialisation file, so that zsh checks the spelling of each word in
  812.   the command line.  You probably do not want this behaviour for
  813.   commands which do not operate on existing files.
  814.  
  815.   The answer is to alias the offending command to itself with
  816.   `nocorrect' stuck on the front, e.g.
  817.  
  818.     alias mkdir='nocorrect mkdir'
  819.  
  820.   To turn off globbing, the rationale is identical:
  821.  
  822.     alias mkdir='noglob mkdir'
  823.  
  824.   You can have both nocorrect and noglob, if you like, but the
  825.   nocorrect must come first, since it is needed by the line editor,
  826.   while noglob is only handled when the command is examined.
  827.  
  828.   Note also that a shell function won't work: the no... directives must
  829.   be expanded before the rest of the command line is parsed.
  830.  
  831. 3.4: How do I get the meta key to work on my xterm?
  832.  
  833.   As stated in the manual, zsh needs to be told about the meta key by
  834.   using `bindkey -me' or `bindkey -mv' in your .zshrc or on the
  835.   command line.  You probably also need to tell the terminal driver to
  836.   allow the `meta' bit of the character through; `stty pass8' is the
  837.   usual incantation.  Sample .zshrc entry:
  838.  
  839.     [[ $TERM = "xterm" ]] && stty pass8 && bindkey -me
  840.  
  841.   or, on SYSVR4-ish systems without pass8,
  842.  
  843.     [[ $TERM = "xterm" ]] && stty -parenb -istrip cs8 && bindkey -me
  844.  
  845.   (disable parity detection, don't strip high bit, use 8-bit characters).
  846.   Make sure this comes _before_ any bindkey entries in your .zshrc which
  847.   redefine keys normally defined in the emacs/vi keymap.
  848.  
  849.   You don't need the `bindkey' to be able to define your own sequences
  850.   with the meta key, though you still need the `stty'.
  851.  
  852. 3.5: How do I automatically display the directory in my xterm title bar?
  853.  
  854.   You should use the special function `chpwd', which is called when
  855.   the directory changes.  The following checks that standard output is
  856.   a terminal, then puts the directory in the title bar if the terminal
  857.   is an xterm or a sun-cmd.
  858.  
  859.   chpwd() {
  860.     [[ -t 1 ]] || return
  861.     case $TERM in
  862.       sun-cmd) print -Pn "\e]l%~\e\\"
  863.         ;;
  864.       xterm) print -Pn "\e]2;%~\a"
  865.         ;;
  866.     esac
  867.   }
  868.  
  869.   Change `%~' if you want the message to be different.  (The `-P'
  870.   option interprets such sequences just like in prompts, in this case
  871.   producing the current directory; you can of course use `$PWD' here,
  872.   but that won't use the `~' notation which I find clearer.)  Note that
  873.   when the xterm starts up you will probably want to call chpwd
  874.   directly: just put `chpwd' in .zshrc after it is defined or autoloaded.
  875.  
  876. 3.6: How do I make the completion list use eight bit characters?
  877.  
  878.   A traditional UNIX environment (character terminal and ASCII
  879.   character sets) is not sufficient to be able to handle non-ASCII
  880.   characters, and there are so many possible enhancements that in
  881.   general this is hard.  However, if you have something like an xterm
  882.   using a standard character set like ISO-8859-1 (which is often the
  883.   default for xterm), read on.  You should also note question
  884.   3.4 on the subject of eight bit characters.
  885.  
  886.   You are probably creating files with names including non-ASCII
  887.   accented characters, and find they show up in the completion list as
  888.   \M-i or something such.  This is because the library routines
  889.   (not zsh itself) which test whether a character is printable have
  890.   replied that it is not; zsh has simply found a way to show them
  891.   anyway.
  892.  
  893.   The answer, under a modern POSIXy operating system, is to find a
  894.   locale where these are treated as printable characters.  Zsh has
  895.   handling for locales built in and will recognise when you set a
  896.   relevant variable. You need to look in /usr/lib/locale to find one
  897.   which suits you; the subdirectories correspond to the locale names.
  898.   The simplest possibility is likely to be en_US, so that the simplest
  899.   answer to your problem is to set
  900.  
  901.     LC_CTYPE=en_US
  902.  
  903.   when your terminal is capable of showing eight bit characters.  If
  904.   you only have a default domain (called C), you may need to have some
  905.   additional files installed on your system.
  906.  
  907. 3.7: Why does my terminal act funny in some way?
  908.  
  909.   If you are using an OpenWindows cmdtool as your terminal, any
  910.   escape sequences (such as those produced by cursor keys) will be
  911.   swallowed up and never reach zsh.  Either use shelltool or avoid
  912.   commands with escape sequences.  You can also disable scrolling from
  913.   the cmdtool pane menu (which effectively turns it into a shelltool).
  914.   If you still want scrolling, try using an xterm with the scrollbar
  915.   activated.
  916.  
  917.   If that's not the problem, and you are using stty to change some tty
  918.   settings, make sure you haven't asked zsh to freeze the tty settings:
  919.   type
  920.  
  921.     ttyctl -u
  922.  
  923.   before any stty commands you use.
  924.  
  925.   On the other hand, if you aren't using stty and have problems you may
  926.   need the opposite:  `ttyctl -f' freezes the terminal to protect it
  927.   from hiccups introduced by other programmes (kermit has been known to
  928.   do this).
  929.  
  930.   If _that_'s not the problem, and you are having difficulties with
  931.   external commands (not part of zsh), and you think some terminal
  932.   setting is wrong (e.g. ^V is getting interpreted as `literal next
  933.   character' when you don't want it to be), try
  934.  
  935.     ttyctl -u
  936.     STTY='lnext "^-"' commandname
  937.  
  938.   (in this example), or just export STTY for all commands to see.  Note
  939.   that zsh doesn't reset the terminal completely afterwards: just the
  940.   modes it uses itself and a number of special processing characters
  941.   (see the stty(1) manual page).
  942.  
  943.   At some point there may be an overhaul which allows the terminal
  944.   modes used by the shell to be modified separately from those seen by
  945.   external programmes.  This is partially implemented already: from 2.5,
  946.   the shell is less susceptible to mode changes inherited from
  947.   programmes than it used to be.
  948.  
  949. 3.8: Why does zsh not work in an Emacs shell mode any more?
  950.  
  951.   (This information comes from Bart Schaefer and other zsh-workers.)
  952.  
  953.   Emacs 19.29 or thereabouts stopped using a terminal type of "emacs"
  954.   in shell buffers, and instead sets it to "dumb".  Zsh only kicks in
  955.   its special I'm-inside-emacs initialization when the terminal type
  956.   is "emacs".
  957.  
  958.   Probably the most reliable way of dealing with this is to look for
  959.   the environment variable `$EMACS', which is set to `t' in
  960.   Emacs' shell mode.  Putting
  961.  
  962.     [[ $EMACS = t ]] && unsetopt zle
  963.  
  964.   in your .zshrc should be sufficient.
  965.  
  966.   Another method is to put
  967.  
  968.     #!/bin/sh
  969.     TERM=emacs exec zsh
  970.  
  971.   into a file ~/bin/eshell, then `chmod +x ~/bin/eshell', and
  972.   tell emacs to use that as the shell by adding
  973.  
  974.     (setenv "ESHELL" "~/bin/eshell")
  975.  
  976.   to ~/.emacs.
  977.  
  978. 3.9: Why do my autoloaded functions not autoload [the first time]?
  979.  
  980.   The problem is that there are two possible ways of autoloading a
  981.   function (see the AUTOLOADING FUNCTIONS section of the zsh manual
  982.   page zshmisc for more detailed information):
  983.  
  984.   1) The file contains just the body of the function, i.e.
  985.      there should be no line at the beginning saying `function foo {'
  986.      or `foo () {', and consequently no matching `}' at the end.
  987.      This is the traditional zsh method.  The advantage is that the
  988.      file is called exactly like a script, so can double as both.
  989.      To define a function `xhead () { print -n "\033]2;$*\a"; }',
  990.      the file would just contain `print -n "\033]2;$*\a"'.  
  991.   2) The file contains the entire definition, and maybe even
  992.      other code:  it is run when the function needs to be loaded, then
  993.      the function itself is called up.  This is the method in ksh.
  994.      To define the same function `xhead', the whole of the
  995.      usual definition should be in the file.
  996.  
  997.   In old versions of zsh, before 3.0, only the first behaviour was
  998.   allowed, so you had to make sure the file found for autoload just
  999.   contained the function body.  You could still define other functions
  1000.   in the file with the standard form for definitions, though they
  1001.   would be redefined each time you called the main function.
  1002.  
  1003.   In version 3.0.x, the second behaviour is activated if the file
  1004.   defines the autoloaded function.  Unfortunately, this is
  1005.   incompatible with the old zsh behaviour which allowed you to
  1006.   redefine the function when you called it.
  1007.  
  1008.   From version 3.1, there is an option KSHAUTOLOAD to allow full ksh
  1009.   compatiblity, i.e. the function _must_ be in the second form
  1010.   above.  If that is not set, zsh tries to guess which form you are
  1011.   using:  if the file contains only a complete definition of the
  1012.   function in the second form, and nothing else apart from comments
  1013.   and whitespace, it will use the function defined in the file;
  1014.   otherwise, it will assume the old behaviour.  The option is set
  1015.   if `emulate ksh' is in effect, of course.
  1016.  
  1017.   (A neat trick to autoload all functions in a given directory is to
  1018.   include a line like `autoload ~/fns/*(:t)' in .zshrc; the bit in
  1019.   parentheses removes the directory part of the filenames, leaving
  1020.   just the function names.)
  1021.  
  1022. 3.10: How does base arithmetic work?
  1023.  
  1024.   The ksh syntax is now understood, i.e.
  1025.  
  1026.     let 'foo = 16#ff'
  1027.  
  1028.   or equivalently
  1029.  
  1030.     (( foo = 16#ff ))
  1031.  
  1032.   or even
  1033.  
  1034.     foo=$[16#ff]
  1035.  
  1036.   (note that `foo=$((16#ff))' is now supported).  The original syntax was
  1037.  
  1038.     (( foo = [16]ff ))
  1039.  
  1040.   --- this was based on a misunderstanding of the ksh manual page.  It
  1041.   still works but its use is deprecated.  Then
  1042.  
  1043.     echo $foo
  1044.  
  1045.   gives the answer `255'.  It is possible to declare variables explicitly
  1046.   to be integers, via
  1047.  
  1048.     typeset -i foo
  1049.  
  1050.   which has a different effect: namely the base used in the first
  1051.   assignment (hexadecimal in the example) is subsequently used whenever
  1052.   `foo' is displayed (although the internal representation is unchanged).
  1053.   To ensure foo is always displayed in decimal, declare it as
  1054.  
  1055.     typeset -i 10 foo
  1056.  
  1057.   which requests base 10 for output.  You can change the output base of an
  1058.   existing variable in this fashion.  Using the `$(( ... ))' method will
  1059.   always display in decimal.
  1060.  
  1061. 3.11: How do I get a newline in my prompt?
  1062.  
  1063.   You can place a literal newline in quotes, i.e.
  1064.  
  1065.     PROMPT="Hi Joe,
  1066.     what now?%# "
  1067.  
  1068.   If you have the bad taste to set the option cshjunkiequotes, which
  1069.   inhibits such behaviour, you will have to bracket this with
  1070.   `unsetopt cshjunkiequotes' and `setopt cshjunkiequotes', or put it
  1071.   in your .zshrc before the option is set.
  1072.  
  1073.   Arguably the prompt code should handle `print'-like escapes.  Feel
  1074.   free to write this :-).  Otherwise, you can use
  1075.  
  1076.     PROMPT=$(print "Hi Joe,\nwhat now?%# ")
  1077.  
  1078.   in your initialisation file.
  1079.  
  1080. 3.12: Why does `bindkey ^a command-name' or `stty intr ^-' do something funny?
  1081.  
  1082.   You probably have the extendedglob option set in which case ^ and #
  1083.   are metacharacters.  ^a matches any file except one called a, so the
  1084.   line is interpreted as bindkey followed by a list of files.  Quote the
  1085.   ^ with a backslash or put quotation marks around ^a.
  1086.  
  1087. 3.13: Why can't I bind \C-s and \C-q any more?
  1088.  
  1089.   The control-s and control-q keys now do flow control by default,
  1090.   unless you have turned this off with `stty -ixon' or redefined the
  1091.   keys which control it with `stty start' or `stty stop'.  (This is
  1092.   done by the system, not zsh; the shell simply respects these
  1093.   settings.)  In other words, \C-s stops all output to the terminal,
  1094.   while \C-q resumes it.
  1095.  
  1096.   There is an option NO_FLOW_CONTROL to stop zsh from allowing flow
  1097.   control and hence restoring the use of the keys: put `setopt
  1098.   noflowcontrol' in .zshrc.
  1099.  
  1100. 3.14: How do I execute command `foo' within function `foo'?
  1101.  
  1102.   The command `command foo' does just that.  You don't need this with
  1103.   aliases, but you do with functions.  Note that error messages like
  1104.  
  1105.     zsh: job table full or recursion limit exceeded
  1106.  
  1107.   are a good sign that you tried calling `foo' in function `foo' without
  1108.   using `command'.  If `foo' is a builtin rather than an external
  1109.   command, use `builtin foo' instead.
  1110.  
  1111. 3.15: Why do history substitutions with single bangs do something funny?
  1112.  
  1113.   If you have a command like "echo !-2:$ !$", the first history
  1114.   substitution then sets a default to which later history substitutions
  1115.   with single unqualified bangs refer, so that !$ becomes equivalent to
  1116.   !-2:$.  The option CSH_JUNKIE_HISTORY makes all single bangs refer
  1117.   to the last command.
  1118.  
  1119. 3.16: Why does zsh kill off all my background jobs when I logout?
  1120.  
  1121.   Simple answer: you haven't asked it not to.  Zsh (unlike [t]csh) gives
  1122.   you the option of having background jobs killed or not: the `nohup'
  1123.   option exists if you don't want them killed.  Note that you can always
  1124.   run programs with `nohup' in front of the pipeline whether or not the
  1125.   option is set, which will prevent that job from being killed on
  1126.   logout.  (`nohup' is actually an external command.)
  1127.  
  1128.   The `disown' builtin is very useful in this respect: if zsh informs
  1129.   you that you have background jobs when you try to logout, you can
  1130.   `disown' all the ones you don't want killed when you exit.  This is
  1131.   also a good way of making jobs you don't need the shell to know about
  1132.   (such as commands which create new windows) invisible to the shell.
  1133.  
  1134. 3.17: How do I list all my history entries?
  1135.  
  1136.   Tell zsh to start from entry 1: `history 1'.  Those entries at the
  1137.   start which are no longer in memory will be silently omitted.
  1138.  
  1139. 3.18: How does the alternative loop syntax, e.g. `while {...} {...}' work?
  1140.  
  1141.   Zsh provides an alternative to the traditional sh-like forms with `do',
  1142.  
  1143.     while TEST; do COMMANDS; done
  1144.  
  1145.   allowing you to have the COMMANDS delimited with some other command
  1146.   structure, often `{...}'.  The rules are quite complicated and
  1147.   in most scripts it is probably safer --- and certainly more
  1148.   compatible --- to stick with the sh-like rules.  If you are
  1149.   wondering, the following is a rough guide.
  1150.  
  1151.   To make it work you must make sure the TEST itself is clearly
  1152.   delimited.  For example, this works:
  1153.  
  1154.     while (( i++ < 10 )) { echo i is $i; }
  1155.  
  1156.   but this does _not_:
  1157.  
  1158.     while let "i++ < 10"; { echo i is $i; }   # Wrong!
  1159.  
  1160.   The reason is that after `while', any sort of command list is valid.
  1161.   This includes the whole list `let "i++ < 10"; { echo i $i; }';
  1162.   the parser simply doesn't know when to stop.  Furthermore, it is
  1163.   wrong to miss out the semicolon, as this makes the `{...}' part
  1164.   of the argument to `let'.  A newline behaves the same as a
  1165.   semicolon, so you can't put the brace on the next line as in C.
  1166.  
  1167.   So when using this syntax, the test following the `while' must
  1168.   be wrapped up:  any of `((...))', `[[...]]', `{...}' or
  1169.   `(...)' will have this effect.  (They have their usual syntactic
  1170.   meanings too, of course; they are not interchangeable.)  Note that
  1171.   here too it is wrong to put in the semicolon, as then the case
  1172.   becomes identical to the preceding one:
  1173.  
  1174.     while (( i++ < 10 )); { echo i is $i; }   # Wrong!
  1175.  
  1176.   The same is true of the `if' and `until' constructs:
  1177.  
  1178.     if { true } { echo yes } else { echo no }
  1179.  
  1180.   but with `for', which only needs a list of words, you can get
  1181.   away with it:
  1182.  
  1183.     for foo in a b; { echo foo is $a; bar=$foo; }
  1184.  
  1185.   since the parser knows it only needs everything up to the first
  1186.   semicolon. For the same reason, there is no problem with the `repeat',
  1187.   `case' or `select' constructs; in fact, `repeat' doesn't even
  1188.   need the semicolon since it knows the repeat count is just one word.
  1189.  
  1190.   This is independent of the behaviour of the SHORTLOOPS option (see
  1191.   manual), which you are in any case encouraged even more strongly not
  1192.   to use in programs as it can be very confusing.
  1193.  
  1194. Chapter 4: The mysteries of completion
  1195.  
  1196. Programmable completion using the `compctl' command is one of the most
  1197. powerful, and also potentially confusing, features of zsh; here I give
  1198. a short introduction.  There is a set of example completions supplied
  1199. with the source in Misc/compctl-examples; completion definitions for
  1200. many of the most obvious commands can be found there.
  1201.  
  1202. 4.1: What is completion?
  1203.  
  1204.   `Completion' is where you hit a particular command key (TAB is the
  1205.   standard one) and the shell tries to guess the word you are typing
  1206.   and finish it for you --- a godsend for long file names, in
  1207.   particular, but in zsh there are many, many more possibilities than
  1208.   that.
  1209.  
  1210.   There is also a related process, `expansion', where the shell sees
  1211.   you have typed something which would be turned by the shell into
  1212.   something else, such as a variable turning into its value ($PWD
  1213.   becomes /home/users/mydir) or a history reference (!! becomes
  1214.   everything on the last command line).  In zsh, when you hit TAB it
  1215.   will look to see if there is an expansion to be done; if there is,
  1216.   it does that, otherwise it tries to perform completion.  (You can
  1217.   see if the word would be expanded --- not completed --- by TAB by
  1218.   typing `\C-x g', which lists expansions.)  Expansion is generally
  1219.   fairly intuitive and not under user control; for the rest of the
  1220.   chapter I will discuss completion only.
  1221.  
  1222. 4.2: What sorts of things can be completed?
  1223.  
  1224.   The simplest sort is filename completion, mentioned above.  Unless
  1225.   you have made special arrangements, as described below, then after
  1226.   you type a command name, anything else you type is assumed by the
  1227.   completion system to be a filename.  If you type part of a word and
  1228.   hit TAB, zsh will see if it matches the first part a file name and
  1229.   if it does it will automatically insert the rest.
  1230.  
  1231.   The other simple type is command completion, which applies
  1232.   (naturally) to the first word on the line.  In this case, zsh
  1233.   assumes the word is some command to be executed lying in your $PATH
  1234.   (or something else you can execute, like a builtin comman, a
  1235.   function or an alias) and tries to complete that.
  1236.  
  1237.   Other forms of completion have to be set up by special arrangement.
  1238.   See the manual entry for compctl for a list of all the flags:  you
  1239.   can make commands complete variable names, user names, job names,
  1240.   etc., etc.
  1241.  
  1242.   For example, one common use is that you have an array variable,
  1243.   $hosts, which contains names of other machines you use frequently on
  1244.   the network:
  1245.  
  1246.     hosts=(fred.ph.ku.ac.uk snuggles.floppy-bunnies.com here.there.edu)
  1247.  
  1248.   then you can tell zsh that when you use telnet (or ftp, or ...), the
  1249.   argument will be one of those names:
  1250.  
  1251.     compctl -k hosts telnet ftp ...
  1252.  
  1253.   so that if you type `telnet fr' and hit TAB, the rest of the name
  1254.   will appear by itself.
  1255.  
  1256.   An even more powerful option to compctl (-g) is to tell zsh that
  1257.   only certain sorts of filename are allowed.  The argument to -g is
  1258.   exactly like a glob pattern, with the usual wildcards `*', `?', etc.
  1259.   In the compctl statement it needs to be quoted to avoid it being
  1260.   turned into filenames straight away.  For example,
  1261.  
  1262.     compctl -g '*.(ps|eps)' ghostview
  1263.  
  1264.   tells zsh that if you type TAB on an argument after a ghostview
  1265.   command, only files ending in `.ps' or `.eps' should be considered
  1266.   for completion.
  1267.  
  1268.   Note that flags may be combined; if you have more than one, all the
  1269.   possible completions for all of them are put into the same list, all
  1270.   of them being possible completions.  So
  1271.  
  1272.     compctl -k hosts -f rcp
  1273.  
  1274.   tells zsh that rcp can have a hostname or a filename after it.  (You
  1275.   really need to be able to handle host:file, which is where
  1276.   programmable completion comes in, see 4.4.)
  1277.  
  1278. 4.3: How does zsh deal with ambiguous completions?
  1279.  
  1280.   Often there will be more than one possible completion: two files
  1281.   start with the same characters, for example.  Zsh has a lot of
  1282.   flexibility for what it does here via its options.  The default is
  1283.   for it to beep and completion to stop until you type another
  1284.   character.  You can type \C-D to see all the possible completions.
  1285.   (That's assuming your at the end of the line, otherwise \C-D will
  1286.   delete the next character and you have to use ESC-\C-D.)  This can be
  1287.   changed by the following options, among others:
  1288.  
  1289.    o  with nobeep set, that annoying beep goes away
  1290.    o  with nolistbeep, beeping is only turned off for ambiguous completions
  1291.    o  with autolist set, when the completion is ambiguous you get a
  1292.       list without having to type \C-D
  1293.    o  with listambigous, this is modified so that nothing is listed if
  1294.       there is an unambiguous prefix or suffix to be inserted
  1295.    o  with menucomplete set, one completion is always inserted
  1296.       completely, then when you hit TAB it changes to the next, and so
  1297.       on until you get back to where you started
  1298.    o  with automenu, you only get the menu behaviour when you hit TAB
  1299.       again on the ambiguous completion.
  1300.  
  1301.   Combinations of these are possible; for example, autolist and
  1302.   automenu together give an intuitive combination. 
  1303.  
  1304. 4.4: How do I get started with programmable completion?
  1305.  
  1306.   Finally, the hairiest part of completion.  It is possible to get zsh
  1307.   to consider different completions not only for different commands,
  1308.   but for different words of the same command, or even to look at
  1309.   other words on the command line (for example, if the last word was a
  1310.   particular flag) and decide then.
  1311.  
  1312.   There are really two sorts of things to worry about.  The simpler is
  1313.   alternative completion:  that just means zsh will try one
  1314.   alternative, and only if there are no possible completions try the
  1315.   next.  For example
  1316.  
  1317.     compctl -g '*.ps' + -f lpr
  1318.  
  1319.   says that after lpr you'd prefer to find only `.ps' files, so if
  1320.   there are any, only those are used, but if there aren't any, any
  1321.   old file is a possibility.  You can also have a + with no flags
  1322.   after it, which tells zsh that it's to treat the command like any
  1323.   other if nothing was found.  That's only really useful if your
  1324.   default completion is fancy, i.e. you have done something with
  1325.   `compctl -D' to tell zsh how commands which aren't specially handled
  1326.   are to have their arguments completed.
  1327.  
  1328.   The second sort is the hard one.  Following a `-x', zsh expects that
  1329.   the next thing will be some completion code, which is a single
  1330.   letter followed by an argument in square brackets.  For example
  1331.   `p[1]': `p' is for position, and the argument tells it to look at
  1332.   position 1; that says that this completion only applies to the word
  1333.   immediately after the command.  You can also say `p[1,3]' which says
  1334.   the completion only applies to the word if it's between the first
  1335.   and third words, inclusive, after the command, and so on.  See the
  1336.   list in the `compctl' manual entry for a list of these conditions:
  1337.   some conditions take one argument in the square brackets, some two.
  1338.   Usually, negative numeric arguments count backwards from the end
  1339.   (for example, `p[-1]' applies to the last word on the line).
  1340.  
  1341.   The condition is then followed by the flags as usual (as in 4.2),
  1342.   and possibly other condition/flag sets following a single -; the
  1343.   whole lot ends with a double -- before the command name.  In other
  1344.   words, each extended completion section looks like this:
  1345.  
  1346.     -x <pattern> <flags>... [ - <pattern> <flags>... ...] --
  1347.  
  1348.   Let's look at rcp again: this assumes you've set up $hosts as above.
  1349.   This uses the `n[<n>,<string>]' flag, which tells zsh to look for
  1350.   the <n>'th occurrence of <string> in the word, ignoring anything up
  1351.   to and including that.  We'll use it for completing the bits of
  1352.   rcp's `user@host:file' combination.  (Of course, the file name is on
  1353.   the local machine, not `host', but let's ignore that; it may still
  1354.   be useful.)
  1355.  
  1356.     compctl -k hosts -S ':' + -f -x 'n[1,:]' -f - \ 
  1357.           'n[1,@]' -k hosts -S ':' -- rcp
  1358.  
  1359.   This means: (1) try and complete a hostname (the bit before the
  1360.   `+'), if successful add a `:' (-S for suffix); (2) if that fails
  1361.   move on to try the code after the `+':  look and see if there is a
  1362.   `:' in a word (the `n[1,:]'); if there is, complete filenames
  1363.   (-f) after the first of them; (3) otherwise look for an `@' and
  1364.   complete hostnames after the first of them (the `n[1,@]'), adding a
  1365.   `:' if successful; (4) if all else fails use the `-f' before the
  1366.   `-x' and try to complete files.
  1367.  
  1368.   So the rules for order are (1) try anything before a `+' before
  1369.   anything after it (2) try the conditions after a -x in order until
  1370.   one succeeds (3) use the default flags before the -x if none of the
  1371.   conditions was true.
  1372.  
  1373.   Different conditions can also be combined.  There are three levels
  1374.   of this (in decreasing order of precedence):
  1375.  
  1376.    1) multiple square brackets after a single condition give
  1377.       alternatives:  for example, `s[foo][bar]' says apply the
  1378.       completion if the word begins with `foo' or `bar',
  1379.    2) spaces between conditions mean both must match:  for example,
  1380.       `p[1] s[-]' says this completion only applies for the first word
  1381.       after the command and only if it begins with a `-',
  1382.    3) commas between conditions mean either can match:  for example,
  1383.       `c[-1,-f], s[-f]' means either the previous word (-1 relative to
  1384.       the current one) is -f, or the current word begins with -f ---
  1385.       useful to use the same completion whether or not the -f has a
  1386.       space after it.
  1387.  
  1388.   Here's a useless example just to show a general `-x' completion.
  1389.  
  1390.     compctl -f -x 'c[-1,-u][-1,-U] p[2], s[-u]' -u - \ 
  1391.       'c[-1,-j]' -P % -j -- foobar
  1392.  
  1393.   The way to read this is:  for command `foobar', look and see if (((the
  1394.   word before the current one is -u) or (the word before the current
  1395.   one is -U)) and (the current word is 2)) or (the current word begins
  1396.   with -u); if so, try to complete user names.  If the word before
  1397.   the current one is -j, insert the prefix `%' before the current word
  1398.   if it's not there already and complete job names.  Otherwise, just
  1399.   complete file names.
  1400.  
  1401. 4.5: And if programmable completion isn't good enough?
  1402.  
  1403.   ...then your last resort is to write a shell function to do it for
  1404.   you.  By combining the `-U' and `-K func' flags you can get almost
  1405.   unlimited power.  The `-U' tells zsh that whatever the completion
  1406.   produces is to be used, even if it doesn't fit what's there already
  1407.   (so that gets deleted when the completion is inserted).  The `-K
  1408.   func' tells zsh a function name.  The function is passed what's on
  1409.   the line already, but it can return anything it likes via the
  1410.   `reply' array, and this becomes the set of possible completions.
  1411.   The best way to understand this is to look at `multicomp' and other
  1412.   functions supplied with the zsh distribution.
  1413.  
  1414. Chapter 5: The future of zsh
  1415.  
  1416. 5.1: What bugs are currently known and unfixed? (Plus recent important changes)
  1417.  
  1418.   Here are some of the more well-known ones, very roughly in
  1419.   decreasing order of significance.  Many of these can also be counted
  1420.   against differences from ksh in question 2.1; note that this applies
  1421.   to the latest beta version and that simple bugs are often fixed
  1422.   quite quickly.  There is a file Etc/BUGS in the source distribution
  1423.   with more detail.
  1424.  
  1425.   o  Special variables won't be unset after e.g. `PATH=... read ...',
  1426.      i.e. if used with a builtin command or shell function.
  1427.      (According to POSIX, this is not a bug with `special' builtins.)
  1428.   o  `time' is ignored with builtins and can't be used with `{...}'.
  1429.   o  `set -x' (`setopt xtrace') still has a few glitches.
  1430.   o  The `:q' and `:x' modifiers don't work for variables.
  1431.   o  In vi mode, `u' can go past the original modification point.
  1432.   o  The singlelinezle option has problems with prompts containing escapes.
  1433.   o  The `r' command does not work inside `$(...)' or ``...`'
  1434.      expansions. 
  1435.   o  `typeset' handling is non-optimal, particularly with regard to
  1436.      flags, and is ksh-incompatible in unpredictable ways. 
  1437.  
  1438.   Note that a few recent changes introduce incompatibilities (these
  1439.   are not bugs):
  1440.  
  1441.   Changes after zsh 3.0 (3.1.x is still currently in beta):
  1442.  
  1443.   o  history-search-{forward,backward} (bound to \M-n, \M-p)
  1444.      now only find previous lines where the first word is the same as the
  1445.      current one.  For example,
  1446.  
  1447.       comp<ESC>p
  1448.  
  1449.      will find lines in the history like `comp -edit emacs', but not
  1450.      `compress file' any more.  For an approximation to the old
  1451.      behaviour, use history-beginning-search-{forward,backward} which
  1452.      search for a line with the same prefix up to the cursor position.
  1453.   o  In vi insert mode, the cursor keys no longer work.  The following
  1454.      will bind them:
  1455.  
  1456.        bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \ 
  1457.                       '^[[A' up-line-or-history '^[[B' down-line-or-history
  1458.  
  1459.      (unless your terminal requires `^[O' instead of `^[[').  The
  1460.      rationale is that the insert mode and command mode keymaps for
  1461.      keys with prefixes are now separate.
  1462.  
  1463.   Changes since zsh 2.5:
  1464.  
  1465.   o  The left hand of an assignment is no longer substituted.  Thus,
  1466.      `$1=$2' will not work.  You can use something like `eval
  1467.      "$1=\$2"', which should have the identical effect.
  1468.   o  Signal traps established with the `trap' builtin are now called with
  1469.      the environment of the caller, instead of as a new function level,
  1470.      as in ksh.  Traps established as functions (e.g. `TRAPINT()
  1471.      {...}') work as before.
  1472.   o  The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they used
  1473.      to be the other way around.  (Use of names rather than letters is
  1474.      generally recommended.)
  1475.   o  `[[' is a reserved word, hence must be separated from
  1476.      other characters by whitespace; `{' and `}' are also reserved
  1477.      words if the IGNORE_BRACES option is set.
  1478.   o  The option CSH_JUNKIE_PAREN has been removed:  csh-like code now
  1479.      always does what it looks like it does, so `if ( ... ) ...'
  1480.      executes the code in parentheses in a subshell.  To make this
  1481.      useful, the syntax expected after an `if', etc., is less strict
  1482.      than in other shells.
  1483.   o  On the other hand, `foo=*' does not perform globbing immediately on
  1484.      the right hand side of the assignment; the old behaviour now
  1485.      requires the option GLOB_ASSIGN.  (`foo=(*)' is and has always
  1486.      been the consistent way of doing this.)
  1487.   o  <> performs redirection of input and output to the specified file.
  1488.      For numeric globs, you now need <->.
  1489.   o  The command line qualifiers exec, noglob, command,
  1490.      - are now treated more like builtin commands:  previously they were
  1491.      syntactically special.  This should make it easier to perform tricks with
  1492.      them (disabling, hiding in parameters, etc.).
  1493.   o  The pushd builtin has been rewritten for compatibility with other
  1494.      shells.  The old behavour can be achieved with a shell function.
  1495.   o  The current version now uses ~'s for directory stack substitution
  1496.      instead of ='s.  This is for consistency:  all other directory
  1497.      substitution (~user, ~name, ~+, ...) used a tilde, while
  1498.      =<number> caused problems with =program substitution.
  1499.   o  The `HISTLIT' option was broken in various ways and has been removed:
  1500.      the rewritten history mechanism doesn't alter history lines, making
  1501.      the option unnecessary.
  1502.   o  History expansion is disabled in single-quoted strings, like other
  1503.      forms of expansion -- hence exclamation marks there should not be
  1504.      backslashed.
  1505.   o  The `$HISTCHARS' variable is now `$histchars'.  Currently both
  1506.      are tied together for compatibility.
  1507.   o  The PROMPT_SUBST option now performs backquote expansion -- hence
  1508.      you should quote these in prompts.  (SPROMPT has changed as a result.)
  1509.   o  Quoting in prompts has changed: close parentheses inside ternary
  1510.      expressions should be quoted with a %; history is now %!, not
  1511.      !.  Backslashes are no longer special.
  1512.  
  1513. 5.2: Where do I report bugs, get more info / who's working on zsh?
  1514.  
  1515.   The shell is being maintained by various (entirely self-appointed)
  1516.   subscribers to the mailing list,
  1517.  
  1518.     zsh-workers@math.gatech.edu
  1519.  
  1520.   so mail on any issues (bug reports, suggestions, complaints...)
  1521.   related to the development of the shell should be sent there.  If
  1522.   you want someone to mail you directly, say so.  Most patches to zsh
  1523.   appear there first.
  1524.  
  1525.   Please note when reporting bugs that many exist only on certain
  1526.   architectures, which the developers may not have access to.  In
  1527.   this case debugging information, as detailed as possible, is
  1528.   particularly welcome.
  1529.  
  1530.   Two progressively lower volume lists exist, one with messages
  1531.   concerning the use of zsh,
  1532.  
  1533.     zsh-users@math.gatech.edu
  1534.  
  1535.   and one just containing announcements:  about releases, about major
  1536.   changes in the shell, or this FAQ, for example,
  1537.  
  1538.     zsh-announce@math.gatech.edu
  1539.  
  1540.   (posting to the last one is currently restricted).
  1541.  
  1542.   Note that you should only join one of these lists:  people on
  1543.   zsh-workers receive all the lists, and people on zsh-users will
  1544.   also receive the announcements list.
  1545.  
  1546.   The lists are handled by an automated server.  The instructions for
  1547.   zsh-announce and zsh-users are the same as for zsh-workers: just
  1548.   change zsh-workers to whatever in the following.
  1549.  
  1550.   To join zsh-workers, send email to
  1551.  
  1552.     zsh-workers-request@math.gatech.edu
  1553.  
  1554.   with the *subject* line (this is a change from the old list)
  1555.  
  1556.     subscribe <your-email-address>
  1557.  
  1558.   e.g.
  1559.  
  1560.     Subject:  subscribe P.Stephenson@swansea.ac.uk
  1561.  
  1562.   and you can unsubscribe in the same way.
  1563.   The list maintainer, Richard Coleman, can be reached at
  1564.   coleman@math.gatech.edu.
  1565.  
  1566.   The list from May 1992 to May 1995 is archived in
  1567.     ftp://ftp.sterling.com/zsh/zsh-list/YY-MM
  1568.   where YY-MM are the year and month in digits.
  1569.  
  1570.   Of course, you can also post zsh queries to the Usenet group
  1571.   comp.unix.shell; if all else fails, you could even e-mail me.
  1572.  
  1573. 5.3: What's on the wish-list?
  1574.  
  1575.   With version 3, the code is much cleaner than before, but still
  1576.   bears the marks of the ages and many things could be done much
  1577.   better with a rewrite.  A more efficient set of code for
  1578.   lexing/parsing/execution might also be an advantage.  Volunteers are
  1579.   particularly welcome for these tasks.
  1580.  
  1581.   An improved line editor, with user-definable functions and binding
  1582.   of multiple functions to keystrokes, is being developed.
  1583.  
  1584.   o  Loadable module support (will be in 3.1 but much work still needs doing).
  1585.   o  Ksh compatibility could be improved.
  1586.   o  Option for glob qualifiers to follow perl syntax (now a traditional item).
  1587.   o  Binding of shell functions (or commands?) to key strokes --
  1588.      requires some way of accessing the editing buffer from functions
  1589.      and probably of executing zle functions as a command.
  1590.   o  Users should be able to create their own foopath/FOOPATH array/path
  1591.      combinations.
  1592.  
  1593. Acknowledgments:
  1594.  
  1595. Thanks to zsh-list, in particular Bart Schaefer, for suggestions
  1596. regarding this document.  Zsh has been in the hands of archivists Jim
  1597. Mattson, Bas de Bakker, Richard Coleman and Zoltan Hidvegi, and the
  1598. mailing list has been run by Peter Gray, Rick Ohnemus and Richard
  1599. Coleman, all of whom deserve thanks.  The world is eternally in the
  1600. debt of Paul Falstad for inventing zsh in the first place (though the
  1601. wizzo extended completion is by Sven Wischnowsky).
  1602.  
  1603. Copyright Information:
  1604.  
  1605. This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997. This
  1606. text originates in the U.K. and the author asserts his moral rights
  1607. under the Copyrights, Designs and Patents Act, 1988.
  1608.  
  1609. Permission is hereby granted, without written agreement and without
  1610. license or royalty fees, to use, copy, modify, and distribute this
  1611. documentation for any purpose, provided that the above copyright
  1612. notice appears in all copies of this documentation.  Remember,
  1613. however, that this document changes monthly and it may be more useful
  1614. to provide a pointer to it rather than the entire text.  A suitable
  1615. pointer is "information on the Z-shell can be obtained on the World
  1616. Wide Web at URL http://www.peak.org/zsh/".
  1617.  
  1618.