Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Z-Shell (zsh) FAQ changes this month



This file contains general information on how to find out about zsh,
(the first part of the FAQ up to item 1.1), then any other items which
have changed since last month's posting, then the differences in the
yodl version of the FAQ.  If you would like a complete individual
copy, email me and I will add you to the list.

Note that there was an intermediate FAQ supplied with the 3.1.9 release.
The changes here are still based on last month's posted version.


Archive-Name: unix-faq/shell/zsh
Last-Modified: 2000/06/22
Submitted-By: pws@xxxxxxxxxxxxxxxxxxxxxxxx (Peter Stephenson)
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995--2000 (see end of document)

Changes since issue posted May 2000:

1.5  3.0.8 and 3.1.9 available, also patches for 3.0.8
1.6  Mention Cygwin for Windows version of 3.1
3.5  Mention xterm's eightBitOutput resource.
3.12 Mention new way of displaying numbers in different bases.
4.6  Mention that no upgrades of the old completion system are planned.

This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
for many UNIX systems which is freely available to anyone with FTP
access.  Zsh is among the most powerful freely available Bourne-like
shell for interactive use.

If you have never heard of `sh', `csh' or `ksh', then you are
probably better off to start by reading a general introduction to UNIX
rather than this document.

If you just want to know how to get your hands on the latest version,
skip to question 1.6; if you want to know what to do with
insoluble problems, go to 5.2.

Notation: Quotes `like this' are ordinary textual quotation
marks.  Other uses of quotation marks are input to the shell.

Contents:
Chapter 1:  Introducing zsh and how to install it
1.1. Sources of information
1.2. What is it?
1.3. What is it good at?
1.4. On what machines will it run?  (Plus important compilation notes)
1.5. What's the latest version?
1.6. Where do I get it?
1.7. I don't have root access: how do I make zsh my login shell?

Chapter 2:  How does zsh differ from...?
2.1. sh and ksh?
2.2. csh?
2.3. Why do my csh aliases not work?  (Plus other alias pitfalls.)
2.4. tcsh?
2.5. bash?
2.6. Shouldn't zsh be more/less like ksh/(t)csh?

Chapter 3:  How to get various things to work
3.1. Why does `$var' where `var="foo bar"' not do what I expect?
3.2. In which startup file do I put...?
3.3. What is the difference between `export' and the ALL_EXPORT option?
3.4. How do I turn off spelling correction/globbing for a single command?
3.5. How do I get the meta key to work on my xterm?
3.6. How do I automatically display the directory in my xterm title bar?
3.7. How do I make the completion list use eight bit characters?
3.8. Why do the cursor (arrow) keys not work?
3.9. Why does my terminal act funny in some way?
3.10. Why does zsh not work in an Emacs shell mode any more?
3.11. Why do my autoloaded functions not autoload [the first time]?
3.12. How does base arithmetic work?
3.13. How do I get a newline in my prompt?
3.14. Why does `bindkey ^a command-name' or 'stty intr ^-' do something funny?
3.15. Why can't I bind \C-s and \C-q any more?
3.16. How do I execute command `foo' within function `foo'?
3.17. Why do history substitutions with single bangs do something funny?
3.18. Why does zsh kill off all my background jobs when I logout?
3.19. How do I list all my history entries?
3.20. How does the alternative loop syntax, e.g. `while {...} {...}' work?
3.21. Why is my history not being saved?
3.22. How do I get a variable's value to be evaluated as another variable?
3.23. How do I prevent the prompt overwriting output when there is no newline?
3.24. What's wrong with cut and paste on my xterm?
3.25. How do I get coloured prompts on my colour xterm?

Chapter 4:  The mysteries of completion
4.1. What is completion?
4.2. What sorts of things can be completed?
4.3. How does zsh deal with ambiguous completions?
4.4. How do I complete in the middle of words / just what's before the cursor?
4.5. How do I get started with programmable completion?
4.6. And if programmable completion isn't good enough?

Chapter 5:  The future of zsh
5.1. What bugs are currently known and unfixed? (Plus recent important changes)
5.2. Where do I report bugs, get more info / who's working on zsh?
5.3. What's on the wish-list?
5.4. Will zsh have problems in the year 2000?

Acknowledgments

Copyright
--- End of Contents ---

Chapter 1: Introducing zsh and how to install it

1.1: Sources of information

  Information on zsh is available via the World Wide Web.  The URL
  is http://sunsite.auc.dk/zsh/ .
  The server provides this FAQ and much else and is
  now maintained by Karsten Thygesen and others (mail zsh@xxxxxxxxxxxxxx
  with any related messages).  The FAQ is at http://sunsite.auc.dk/zsh/FAQ/ .
  The site also contains some contributed zsh scripts and functions;
  we are delighted to add more, or simply links to your own collection.

  This document was originally written in YODL, allowing it to be converted
  easily into various other formats.  The master source file lives at
  http://sunsite.auc.dk/zsh/FAQ/zshfaq.yo and the plain text version
  can be found at http://sunsite.auc.dk/zsh/FAQ/zshfaq.txt .

  Another useful source of information is the collection of FAQ articles
  posted frequently to the Usenet news groups comp.unix.questions,
  comp.unix.shells and comp.answers with answers to general questions
  about UNIX.  The fifth of the seven articles deals with shells,
  including zsh, with a brief description of differences.  There is
  also a separate FAQ on shell differences and how to change your
  shell.  Usenet FAQs are available via FTP from rtfm.mit.edu and
  mirrors and also on the World Wide Web; see

    USA         http://www.cis.ohio-state.edu/hypertext/faq/usenet/top.html
    UK          http://www.lib.ox.ac.uk/internet/news/faq/comp.unix.shell.html
    Netherlands http://www.cs.uu.nl/wais/html/na-dir/unix-faq/shell/.html

  You can also get it via email by emailing mail-server@xxxxxxxxxxxx
  with, in the body of the message, `send faqs/unix-faq/shell/zsh'.

  The latest version of this FAQ is also available directly from any
  of the zsh archive sites listed in question 1.6.

  I have been putting together a user guide to complement the manual by
  explaining the most useful features of zsh in a more easy to read way.
  This will be a long project, but a partial version describing how to
  write startup files and how to use the new, more powerful, form for
  completion which first appeared in 3.1.6 (and is not described in this
  FAQ) can be seen by looking at
    http://www.pwstephenson.fsnet.co.uk/computing/
  where it exists in various formats.

  (As a method of reading the following in Emacs, you can type \M-2
  \C-x $ to make all the indented text vanish, then \M-0 \C-x $
  when you are on the title you want.)

  For any more eclectic information, you should contact the mailing
  list:  see question 5.2.

--- End of general information, changed items follow in full ---

1.5: What's the latest version?

  Zsh 3.0.8 is the latest production version. The new major number 3.0
  largely reflects the considerable internal changes in zsh to make it more
  reliable, consistent and (where possible) compatible.  Those planning on
  upgrading their zsh installation should take a look at the list of
  incompatibilities at the end of 5.1.  This is longer than usual
  due to enhanced sh, ksh and POSIX compatibility.

  It is unlikely that there will be more 3.0 releases before 4.0 becomes
  the stable version.  However, a few patches to 3.0.8 are available from
  the patch manager at Sourceforge, http://sourceforge.net/patch/?group_id=4068
  Official patches are posted by Bart Schaefer (user name barts).

  The beta version 3.1.9 is also available.  Development of zsh is usually
  patch by patch, with each intermediate version publicly available.  Note
  that this `open' development system does mean bugs are sometimes
  introduced into the most recent archived version.  These are usually
  fixed quickly.  If you are really interested in getting the latest
  improvements, and less worried about providing a stable environment,
  development versions are uploaded quite frequently to the archive in the
  development subdirectory.

  Note also that as the shell changes, it may become incompatible with
  older versions; see the end of question 5.1 for a partial list.
  Changes of this kind are almost always forced by an awkward or
  unnecessary feature in the original design (as perceived by current
  users), or to enhance compatibility with other Bourne shell
  derivatives, or (most recently) to provide POSIX compliancy.

1.6: Where do I get it?

  The coordinator of development is currently me; the alias
  coordinator@xxxxxxx can be used to contact whoever is in the hot
  seat.  The following are known mirrors (kept frequently up to date); the
  first is the official archive site, currently in Australia.  All are
  available by anonymous FTP.  The major sites keep test versions in the
  `testing' subdirectory: such up-to-the-minute development versions should
  only be retrieved if you actually plan to help test the latest version of
  the shell.  The following list also appears on the WWW at
  http://www.zsh.org .

    Home site ftp://ftp.zsh.org
              http://www.zsh.org/pub/zsh/
    Australia ftp://ftp.ips.gov.au/mirror/zsh/
    Denmark   ftp://sunsite.auc.dk/pub/unix/shells/zsh
    Finland   ftp://ftp.funet.fi/pub/unix/shells/zsh/
    France    ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/
    Germany   ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/
              ftp://ftp.uni-trier.de/pub/unix/shell/zsh/
    Hungary   ftp://ftp.cs.elte.hu/pub/zsh/
              (also http://www.cs.elte.hu/pub/zsh/ )
              ftp://ftp.kfki.hu/pub/packages/zsh/
    Israel    ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/
              http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/
    Italy     ftp://ftp.unina.it/pub/Unix/pkgs/shell/zsh/
    Japan     ftp://ftp.nisiq.net/pub/shells/zsh/
              ftp://ftp.win.ne.jp/pub/shell/zsh/
    Norway    ftp://ftp.uit.no/pub/unix/shells/zsh/
    Poland    ftp://sunsite.icm.edu.pl/pub/unix/shells/zsh/
    Romania   ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
              ftp://ftp.kappa.ro/pub/mirrors/ftp.zsh.org/pub/zsh/
    Slovenia  ftp://ftp.siol.net/mirrors/zsh/
    Sweden    ftp://ftp.lysator.liu.se/pub/unix/zsh/
    UK        ftp://ftp.net.lut.ac.uk/zsh/
              (also by FSP at port 21)
              ftp://sunsite.org.uk/packages/zsh/
    USA       ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/
              ftp://ftp.rge.com/pub/shells/zsh/
              ftp://foad.org/pub/zsh/
              http://foad.org/zsh/

  The Windows port mentioned above is maintained separately by Amol
  Deshpande <amold@xxxxxxxxxxxxx>; please mail Amol directly about any
  Windows-specific problems.  This is quite new, so don't expect it to
  be perfect.  You can get it from:

            ftp://ftp.blarg.net/users/amol/zsh  

  There is no port of 3.1 for Windows, but newer releases compile under
  Cygwin, a freely available UNIX-style environment for the Win32 API.  You
  can find information about this at 
  http://sourceware.cygnus.com/cygwin.

  Likewise the OS/2 port is available from TAMURA Kent
  <kent@xxxxxxxxxxxxxx> at

            http://cgi.din.or.jp/~tkent/tmp/zsh-3.0.0-os2-a01.zip

  Starting from mid-October 1997, there is an archive of patches sent
  to the maintainers' mailing list.  Note that these may not all be
  added to the shell, and some may already have been; you simply have
  to search for something you might want which is not in the version
  you have.  Also, there may be some prerequisites earlier in the
  archive.  It can be found on the zsh WWW pages (as described in
  1.1) at:

            http://sunsite.auc.dk/zsh/Patches/

3.5: How do I get the meta key to work on my xterm?

  As stated in the manual, zsh needs to be told about the meta key by
  using `bindkey -me' or `bindkey -mv' in your .zshrc or on the
  command line.  You probably also need to tell the terminal driver to
  allow the `meta' bit of the character through; `stty pass8' is the
  usual incantation.  Sample .zshrc entry:

    [[ $TERM = "xterm" ]] && stty pass8 && bindkey -me

  or, on SYSVR4-ish systems without pass8,

    [[ $TERM = "xterm" ]] && stty -parenb -istrip cs8 && bindkey -me

  (disable parity detection, don't strip high bit, use 8-bit characters).
  Make sure this comes _before_ any bindkey entries in your .zshrc which
  redefine keys normally defined in the emacs/vi keymap.  You may also
  need to set the eightBitOutput resource in your ~/.Xdefaults
  file, although this is on by default and it's unlikely anybody will
  have tinkered with it.

  You don't need the `bindkey' to be able to define your own sequences
  with the meta key, though you still need the `stty'.

3.12: How does base arithmetic work?

  The ksh syntax is now understood, i.e.

    let 'foo = 16#ff'

  or equivalently

    (( foo = 16#ff ))

  or even

    foo=$((16#ff))

  The original syntax was

    (( foo = [16]ff ))

  --- this was based on a misunderstanding of the ksh manual page.  It
  still works but its use is deprecated.  Then

    echo $foo

  gives the answer `255'.  It is possible to declare variables explicitly
  to be integers, via

    typeset -i foo

  which has a different effect: namely the base used in the first
  assignment (hexadecimal in the example) is subsequently used whenever
  `foo' is displayed (although the internal representation is unchanged).
  To ensure foo is always displayed in decimal, declare it as

    typeset -i 10 foo

  which requests base 10 for output.  You can change the output base of an
  existing variable in this fashion.  Using the `$(( ... ))' method will
  always display in decimal, except that in 3.1.9 there is a new feature
  for selecting a base for displaying here:

    print $(( [#16] 255 ))

4.6: And if programmable completion isn't good enough?

  ...then your last resort is to write a shell function to do it for
  you.  By combining the `-U' and `-K func' flags you can get
  almost unlimited power.  The `-U' tells zsh that whatever the
  completion produces is to be used, even if it doesn't fit what's
  there already (so that gets deleted when the completion is
  inserted).  The `-K func' tells zsh a function name.  The
  function is passed the part of the word already typed, and can read
  the rest of the line with `read -c'.  It can return a set of
  completions via the `reply' array, and this becomes the set of
  possible completions.  The best way to understand this is to look at
  `multicomp' and other functions supplied with the zsh
  distribution.  Almost certainly, however, you are better off using
  the new completion system for anything complicated.  No further
  upgrades are planned for the old system.

--- End of changed items, diff from previous version follows ---
Index: zshfaq.yo
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.yo,v
retrieving revision 1.57
retrieving revision 1.59
diff -u -r1.57 -r1.59
--- zshfaq.yo	2000/05/24 19:24:59	1.57
+++ zshfaq.yo	2000/06/22 19:39:09	1.59
@@ -43,19 +43,23 @@
 whenman(report(ARG1)(ARG2)(ARG3))\
 whenms(report(ARG1)(ARG2)(ARG3))\
 whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/05/24)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/06/22)
 COMMENT(-- the following are for Usenet and must appear first)\
 description(\
 mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/05/24
+mydit(Last-Modified:) 2000/06/22
 mydit(Submitted-By:) email(pws@xxxxxxxxxxxxxxxxxxxxxxxx (Peter Stephenson))
 mydit(Posting-Frequency:) Monthly
 mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
 )
 
-bf(Changes since issue posted April 2000:)
+bf(Changes since issue posted May 2000:)
 description(
-mydit(2.5)  Mention that tt(${var/old/new}) is a little different from bash.
+mydit(1.5)  3.0.8 and 3.1.9 available, also patches for 3.0.8
+mydit(1.6)  Mention Cygwin for Windows version of 3.1
+mydit(3.5)  Mention xterm's tt(eightBitOutput) resource.
+mydit(3.12) Mention new way of displaying numbers in different bases.
+mydit(4.6)  Mention that no upgrades of the old completion system are planned.
 )
 
 This document contains a list of frequently-asked (or otherwise
@@ -296,14 +300,21 @@
 
 sect(What's the latest version?)
 
-  Zsh 3.0.7 is the latest production version. The new major number 3.0
+  Zsh 3.0.8 is the latest production version. The new major number 3.0
   largely reflects the considerable internal changes in zsh to make it more
   reliable, consistent and (where possible) compatible.  Those planning on
   upgrading their zsh installation should take a look at the list of
   incompatibilities at the end of link(5.1)(51).  This is longer than usual
   due to enhanced sh, ksh and POSIX compatibility.
 
-  The beta version 3.1.6 is also available.  Development of zsh is usually
+  It is unlikely that there will be more 3.0 releases before 4.0 becomes
+  the stable version.  However, a few patches to 3.0.8 are available from
+  the patch manager at Sourceforge, \
+url(http://sourceforge.net/patch/?group_id=4068)\
+(http://www.sourceforge.net/patch/?group_id=4068)
+  Official patches are posted by Bart Schaefer (user name tt(barts)).
+
+  The beta version 3.1.9 is also available.  Development of zsh is usually
   patch by patch, with each intermediate version publicly available.  Note
   that this `open' development system does mean bugs are sometimes
   introduced into the most recent archived version.  These are usually
@@ -404,6 +415,12 @@
 (ftp://ftp.blarg.net/users/amol/zsh)  
   )
 
+  There is no port of 3.1 for Windows, but newer releases compile under
+  Cygwin, a freely available UNIX-style environment for the Win32 API.  You
+  can find information about this at 
+  url(http://sourceware.cygnus.com/cygwin)\
+(http://sourceware.cygnus.com/cygwin).
+
   Likewise the OS/2 port is available from email(TAMURA Kent
   <kent@xxxxxxxxxxxxxx>) at
 
@@ -1132,7 +1149,10 @@
   )
   (disable parity detection, don't strip high bit, use 8-bit characters).
   Make sure this comes myem(before) any bindkey entries in your .zshrc which
-  redefine keys normally defined in the emacs/vi keymap.
+  redefine keys normally defined in the emacs/vi keymap.  You may also
+  need to set the tt(eightBitOutput) resource in your tt(~/.Xdefaults)
+  file, although this is on by default and it's unlikely anybody will
+  have tinkered with it.
 
   You don't need the mytt(bindkey) to be able to define your own sequences
   with the meta key, though you still need the mytt(stty).
@@ -1384,7 +1404,11 @@
   )
   which requests base 10 for output.  You can change the output base of an
   existing variable in this fashion.  Using the mytt($(( ... ))) method will
-  always display in decimal.
+  always display in decimal, except that in 3.1.9 there is a new feature
+  for selecting a base for displaying here:
+  verb(
+    print $(( [#16] 255 ))
+  )
 
 
 sect(How do I get a newline in my prompt?)
@@ -1568,8 +1592,8 @@
   Ignore the mytt((e)) for now.  The mytt(:+) means: if the variable
   tt($E) is set, substitute the following, i.e. mytt(\$$E).  This is
   expanded to mytt($EDITOR) by the normal rules.  Finally, the mytt((e)) \
-  means:
-  evaluate the expression you just made.  This gives mytt(emacs).
+  means
+  `evaluate the expression you just made'.  This gives mytt(emacs).
 
   For a standard shell way of doing this, you are stuck with mytt(eval):
   verb(
@@ -1980,7 +2004,9 @@
   completions via the mytt(reply) array, and this becomes the set of
   possible completions.  The best way to understand this is to look at
   mytt(multicomp) and other functions supplied with the zsh
-  distribution.
+  distribution.  Almost certainly, however, you are better off using
+  the new completion system for anything complicated.  No further
+  upgrades are planned for the old system.
 
 
 chapter(The future of zsh)



Messages sorted by: Reverse Date, Date, Thread, Author