* Z-Shell (zsh) FAQ changes this month
@ 1999-03-24 10:46 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-03-24 10:46 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
Changes since issue posted January 1999:
1.1 Mention plain text FAQ location.
5.3 Added list of goodies which will appear in version 3.1.6,
separate from much-truncated wish-list.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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 ---
5.3: What's on the wish-list?
With version 3, the code is much cleaner than before, but still
bears the marks of the ages and many things could be done much
better with a rewrite. A more efficient set of code for
lexing/parsing/execution might also be an advantage. Volunteers are
particularly welcome for these tasks.
Here are some things which are definitely happening, and will probably
appear in zsh 3.1.6.
o Even more powerful new completion system, based on shell functions,
allowing much more detailed control both over generation of matches
for completion and how they are inserted and displayed. A set of
functions which work `out of the box' will be available, including
many functions for external commands: files in tar archives can
be listed for extraction as if they were real files; GNU commands
which accept the `--help' option can generate completion lists for
themselves on the fly, etc., etc.
You can have old-style compctl-based completions for some commands,
and new-style ones for others; you can bind particular completion
commands of your own definition to key-strokes.
o Other completion enhancements: matching control, allowing
case-insensitive matching and wild card anchors, e.g. `z_t<TAB>'
can allow a wildcard before the `_' so that this will expand
to `zle_tricky.c' --- all under user control; completions can
be grouped.
o Case-insensitive and approximate matching in the globbing code:
for example, `(#ia2)readme' matches the string `readme'
case-insensitively with up to two errors, such as README,
READ.ME, _README_, Read!Me!. The new completion system
knows about these, allowing correcting completion, e.g.
`mkaef<TAB>' can be made to complete to `Makefile'.
o Associative arrays, declared with `typeset -A aname'; syntax
for creating, accessing and deleting elements of these.
o Users can create their own foopath/FOOPATH array/path
combinations, just like path and PATH.
o A dynamically loadable library for FTP, complete with a suite of
functions to make it easy to use. This allows you to use the shell's
capabilities for scripting, line editing, completion, I/O redirection,
directory management etc. within an FTP session.
Other future possibilities which have been suggested:
o Further improvements in integrating the line editor with shell
functions.
o Ksh compatibility could be improved.
o Option for glob qualifiers to follow perl syntax (a traditional item).
--- End of changed items, diff from previous version follows ---
Index: zshfaq.txt
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.txt,v
retrieving revision 1.10
retrieving revision 1.12
diff -u -r1.10 -r1.12
--- zshfaq.txt 1999/02/25 10:03:06 1.10
+++ zshfaq.txt 1999/03/24 10:58:44 1.12
@@ -1,19 +1,16 @@
Archive-Name: unix-faq/shell/zsh
-Last-Modified: 1999/02/05
+Last-Modified: 1999/03/24
Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
-Version: $Id: zshfaq.txt,v 1.10 1999/02/25 10:03:06 pws Exp $
+Version: $Id: zshfaq.txt,v 1.12 1999/03/24 10:58:44 pws Exp $
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995--1999 (see end of document)
Changes since issue posted January 1999:
-1.1 deleted the bit saying startup files are not mentioned.
-3.2 New: about startup files.
-3.7 we just found the PRINT_EIGHT_BIT option again...
-3.22 New: about ${(e)...} and ${${...}}.
-5.2 (In wishlist): patch exists for 3.1 to handle tying
- texinputs/TEXINPUTS etc.
+1.1 Mention plain text FAQ location.
+5.3 Added list of goodies which will appear in version 3.1.6,
+ separate from much-truncated wish-list.
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
@@ -105,9 +102,10 @@
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 .
+ 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,
@@ -1329,7 +1327,7 @@
stage?
There is no standard single-stage way of doing this. However, there
- is a zsh idiom (available in all versions of zsh since 5.0) for this:
+ is a zsh idiom (available in all versions of zsh since 3.0) for this:
print ${(e)E:+\$$E}
@@ -1831,18 +1829,46 @@
lexing/parsing/execution might also be an advantage. Volunteers are
particularly welcome for these tasks.
- An improved line editor, with user-definable functions and binding
- of multiple functions to keystrokes, is being developed.
+ Here are some things which are definitely happening, and will probably
+ appear in zsh 3.1.6.
- o Loadable module support (will be in 3.1 but much work still needs
- doing).
+ o Even more powerful new completion system, based on shell functions,
+ allowing much more detailed control both over generation of matches
+ for completion and how they are inserted and displayed. A set of
+ functions which work `out of the box' will be available, including
+ many functions for external commands: files in tar archives can
+ be listed for extraction as if they were real files; GNU commands
+ which accept the `--help' option can generate completion lists for
+ themselves on the fly, etc., etc.
+ You can have old-style compctl-based completions for some commands,
+ and new-style ones for others; you can bind particular completion
+ commands of your own definition to key-strokes.
+ o Other completion enhancements: matching control, allowing
+ case-insensitive matching and wild card anchors, e.g. `z_t<TAB>'
+ can allow a wildcard before the `_' so that this will expand
+ to `zle_tricky.c' --- all under user control; completions can
+ be grouped.
+ o Case-insensitive and approximate matching in the globbing code:
+ for example, `(#ia2)readme' matches the string `readme'
+ case-insensitively with up to two errors, such as README,
+ READ.ME, _README_, Read!Me!. The new completion system
+ knows about these, allowing correcting completion, e.g.
+ `mkaef<TAB>' can be made to complete to `Makefile'.
+ o Associative arrays, declared with `typeset -A aname'; syntax
+ for creating, accessing and deleting elements of these.
+ o Users can create their own foopath/FOOPATH array/path
+ combinations, just like path and PATH.
+ o A dynamically loadable library for FTP, complete with a suite of
+ functions to make it easy to use. This allows you to use the shell's
+ capabilities for scripting, line editing, completion, I/O redirection,
+ directory management etc. within an FTP session.
+
+ Other future possibilities which have been suggested:
+
+ o Further improvements in integrating the line editor with shell
+ functions.
o Ksh compatibility could be improved.
o Option for glob qualifiers to follow perl syntax (a traditional item).
- o Binding of shell functions to key strokes, accessing editing
- buffer from functions, executing zle functions as a command: now
- under development for 3.1.
- o Users should be able to create their own foopath/FOOPATH array/path
- combinations (now exists as a patch for 3.1).
5.4: Will zsh have problems in the year 2000?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-08-29 19:41 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-08-29 19:41 UTC (permalink / raw)
To: zsh-announce
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.
Archive-Name: unix-faq/shell/zsh
Last-Modified: 2000/08/29
Submitted-By: pws@pwstephenson.fsnet.co.uk (Peter Stephenson)
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995--2000 (see end of document)
Changes since issue posted July 2000:
None.
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@sunsite.auc.dk
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@rtfm.mit.edu
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 ---
This space intentionally left blankish.
--- 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.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- zshfaq.yo 2000/07/24 20:49:32 1.60
+++ zshfaq.yo 2000/08/29 19:36:57 1.61
@@ -43,19 +43,19 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/07/24)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/08/29)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/07/24
+mydit(Last-Modified:) 2000/08/29
mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
)
-bf(Changes since issue posted June 2000:)
+bf(Changes since issue posted July 2000:)
description(
-mydit(5.3) Wishlist: Dotfile Generator templates.
+ None.
)
This document contains a list of frequently-asked (or otherwise
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-07-24 20:52 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-07-24 20:52 UTC (permalink / raw)
To: zsh-announce
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.
Archive-Name: unix-faq/shell/zsh
Last-Modified: 2000/07/24
Submitted-By: pws@pwstephenson.fsnet.co.uk (Peter Stephenson)
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995--2000 (see end of document)
Changes since issue posted June 2000:
5.3 Wishlist: Dotfile Generator templates.
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@sunsite.auc.dk
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@rtfm.mit.edu
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 ---
5.3: What's on the wish-list?
With version 3, the code is much cleaner than before, but still
bears the marks of the ages and many things could be done much
better with a rewrite. A more efficient set of code for
lexing/parsing/execution might also be an advantage. Volunteers are
particularly welcome for these tasks.
Here are the latest changes, which appeared in zsh 3.1.6.
o Even more powerful new completion system, based on shell functions,
allowing much more detailed control both over generation of matches
for completion and how they are inserted and displayed. A set of
functions which work `out of the box' will be available, including
many functions for external commands: files in tar archives can
be listed for extraction as if they were real files; GNU commands
which accept the `--help' option can generate completion lists for
themselves on the fly, etc., etc.
You can have old-style compctl-based completions for some commands,
and new-style ones for others; you can bind particular completion
commands of your own definition to key-strokes.
o Other completion enhancements: matching control, allowing
case-insensitive matching and wild card anchors, e.g. `z_t<TAB>'
can allow a wildcard before the `_' so that this will expand
to `zle_tricky.c' --- all under user control; completions can
be grouped; a new completion command, menu-select, allows real menu
selection --- you can move the cursor around to choose a completion.
o Case-insensitive and approximate matching in the globbing code:
for example, `(#ia2)readme' matches the string `readme'
case-insensitively with up to two errors, such as README,
READ.ME, _README_, Read!Me!. The new completion system
knows about these, allowing correcting completion, e.g.
`mkaef<TAB>' can be made to complete to `Makefile'.
o Associative arrays, declared with `typeset -A aname'; syntax
for creating, accessing and deleting elements of these.
o Users can create their own foopath/FOOPATH array/path
combinations, just like path and PATH.
o A dynamically loadable library for FTP, complete with a suite of
functions to make it easy to use. This allows you to use the shell's
capabilities for scripting, line editing, completion, I/O redirection,
directory management etc. within an FTP session.
Other future possibilities which have been suggested:
o Configuration files to enable zsh startup files to be created
with the Dotfile Generator.
o Further improvements in integrating the line editor with shell
functions.
o Ksh compatibility could be improved.
o Option for glob qualifiers to follow perl syntax (a traditional item).
--- 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.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- zshfaq.yo 2000/06/22 19:39:09 1.59
+++ zshfaq.yo 2000/07/24 20:49:32 1.60
@@ -43,23 +43,19 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/06/22)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/07/24)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/06/22
+mydit(Last-Modified:) 2000/07/24
mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
)
-bf(Changes since issue posted May 2000:)
+bf(Changes since issue posted June 2000:)
description(
-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.
+mydit(5.3) Wishlist: Dotfile Generator templates.
)
This document contains a list of frequently-asked (or otherwise
@@ -2251,6 +2247,8 @@
Other future possibilities which have been suggested:
itemize(
+ it() Configuration files to enable zsh startup files to be created
+ with the Dotfile Generator.
it() Further improvements in integrating the line editor with shell
functions.
it() Ksh compatibility could be improved.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-06-22 19:45 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-06-22 19:45 UTC (permalink / raw)
To: zsh-announce
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@pwstephenson.fsnet.co.uk (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@sunsite.auc.dk
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@rtfm.mit.edu
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@zsh.org 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@microsoft.com>; 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@tril.ibm.co.jp> 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@pwstephenson.fsnet.co.uk (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@tril.ibm.co.jp>) 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)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-05-24 19:26 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-05-24 19:26 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted April 2000:
2.5 Mention that ${var/old/new} is a little different from bash.
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@sunsite.auc.dk
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@rtfm.mit.edu
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 ---
2.5: Similarities with bash
The Bourne-Again Shell, bash, is another enhanced Bourne-like shell;
the most obvious difference from zsh is that it does not attempt to
emulate the Korn shell. Since both shells are under active
development it is probably not sensible to be too specific here.
Broadly, bash has paid more attention to standards compliancy
(i.e. POSIX) for longer, and has so far avoided the more abstruse
interactive features (programmable completion, etc.) that zsh has.
In recent years there has been a certain amount of crossover in the
extensions, however. Zsh now (3.1.6) has bash's `${var/old/new}'
feature for replacing the text old with the text(new) in the
parameter $var. Note one difference here: while both shells
implement the syntax `${var/#old/new}' and `${var/%old/new}' for
anchoring the match of old to the start or end of the parameter text,
respectively, in zsh you can't put the `#' or `%' inside a
parameter: in other words `{var/$old/new}' where old begins with
a `#' treats that as an ordinary character in zsh, unlike bash. To
do this sort of thing in zsh you can use (from 3.1.7) the new syntax
for anchors in any pattern, `(#s)' to match the start of a string,
and `(#e)' to match the end. These require the option
EXTENDED_GLOB to be set.
--- 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.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- zshfaq.yo 2000/04/30 14:41:11 1.56
+++ zshfaq.yo 2000/05/24 19:24:59 1.57
@@ -43,21 +43,19 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/04/30)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/05/24)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/04/30
+mydit(Last-Modified:) 2000/05/24
mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
)
-bf(Changes since issue posted March 2000:)
+bf(Changes since issue posted April 2000:)
description(
-mydit(3.8) Mention the `keypad mode' horror and fixes (from Bart).
-mydit(3.25) Rephrased, example for older versions added.
-mydit(5.1) Mention :x and :q modifiers again
+mydit(2.5) Mention that tt(${var/old/new}) is a little different from bash.
)
This document contains a list of frequently-asked (or otherwise
@@ -887,6 +885,20 @@
Broadly, bash has paid more attention to standards compliancy
(i.e. POSIX) for longer, and has so far avoided the more abstruse
interactive features (programmable completion, etc.) that zsh has.
+
+ In recent years there has been a certain amount of crossover in the
+ extensions, however. Zsh now (3.1.6) has bash's `tt(${var/old/new})'
+ feature for replacing the text tt(old) with the text(new) in the
+ parameter tt($var). Note one difference here: while both shells
+ implement the syntax `tt(${var/#old/new})' and `tt(${var/%old/new})' for
+ anchoring the match of tt(old) to the start or end of the parameter text,
+ respectively, in zsh you can't put the `tt(#)' or `tt(%)' inside a
+ parameter: in other words `tt({var/$old/new})' where tt(old) begins with
+ a `tt(#)' treats that as an ordinary character in zsh, unlike bash. To
+ do this sort of thing in zsh you can use (from 3.1.7) the new syntax
+ for anchors in any pattern, `tt((#s))' to match the start of a string,
+ and `tt((#e))' to match the end. These require the option
+ tt(EXTENDED_GLOB) to be set.
sect(Shouldn't zsh be more/less like ksh/(t)csh?)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-04-30 14:41 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-04-30 14:41 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted March 2000:
3.8 Mention the `keypad mode' horror and fixes (from Bart).
3.25 Rephrased, example for older versions added.
5.1 Mention :x and :q modifiers again
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@sunsite.auc.dk
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@rtfm.mit.edu
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 ---
3.8: Why do the cursor (arrow) keys not work?
The cursor keys send different codes depending on the terminal; zsh
only binds the most well known versions. If you see these problems,
try putting the following in your .zshrc:
bindkey "$(echotc kl)" backward-char
bindkey "$(echotc kr)" forward-char
bindkey "$(echotc ku)" up-line-or-history
bindkey "$(echotc kd)" down-line-or-history
If you use vi mode, use `vi-backward-char' and `vi-forward-char'
where appropriate.
Note, however, that up to version 3.0 binding arbitrary multiple key
sequences can cause problems, so check that this works with your set
up first. Also, from version 3.1.3, more sequences are supported by
default, namely those in the form `<ESC>O' followed by A,
B, C or D, as well as the corresponding set beginning
`<ESC>[', so this may be redundant.
A particular problem which sometimes occurs is that there are two
different modes for arrow keys, normal mode and keypad mode, which
send different sequences. Although this is largely a historical
artifact, it sometimes happens that your terminal can be switched from
one mode to the other, for example by a rogue programme that sends the
sequence to switch one way, but not the sequence to switch back. Thus
you are stuck with the effects. Luckily in this case the arrow key
sequences are likely to be standard, and you can simply bind both sets.
The following code does this.
bindkey '\e[A' up-line-or-history
bindkey '\e[B' down-line-or-history
bindkey '\e[C' forward-char
bindkey '\e[D' backward-char
bindkey '\eOA' up-line-or-history
bindkey '\eOB' down-line-or-history
bindkey '\eOC' forward-char
bindkey '\eOD' backward-char
For most even vaguely VT100-compatible terminals, the above eight
instructions are a fairly safe bet for your .zshrc. Of course
you can substitute variant functions for the second argument here too.
3.25: How do I get coloured prompts on my colour xterm?
(Or `color xterm', if you're reading this in black and white.) You need
to find the sequences which generate the various colours from the manual
for your terminal emulator; these are ANSI standard on those I know about
which support colour. With a recent (post 3.1.6) distribution of zsh,
there is a theme system to handle this for you; even if you don't see that,
the installed function ``colors'' (meaning `colours', if you're not
reading this in black and white) gives the escape sequences. You will end
up with code looking like this (borrowed from Oliver Kiddle):
PS1=$'%{\e[1;31m%}<the rest of your prompt here>%{\e[0m%}'
The `$'' form of quoting turns the ``\e'' into a real escape
character; this only works from about version 3.1.4, so if you're using
3.0.x, you need to do something like
PS1="$(print '%{\e[1;31m%}<the rest goes here>%{\e[0m%}')"
The ``%{...%}'' is used in prompts for strings which will
not appear as characters, so that the prompt code doesn't miscalculate the
length of the prompt which would have a bad effect on editing. The
resulting ``<ESC>[1;31m'' makes the prompt red, and the
``<ESC>[0m'' puts printing back to normal so that the rest of the line
is unchanged.
5.1: What bugs are currently known and unfixed? (Plus recent important changes)
Here are some of the more well-known ones, very roughly in
decreasing order of significance. Many of these can also be counted
against differences from ksh in question 2.1; note that this applies
to the latest beta version and that simple bugs are often fixed
quite quickly. There is a file Etc/BUGS in the source distribution
with more detail.
o `time' is ignored with builtins and can't be used with `{...}'.
o When showing completion lists with exactly 80 columns, some
terminals print an extra newline which messes up zsh's logic.
o `set -x' (`setopt xtrace') still has a few glitches; these
are mostly fixed in 3.1.6.
o Zsh's notion of the current line number (via $LINENO) is
sometimes not well handled, particularly when using functions and traps.
This should also work reliably from 3.0.6 and 3.1.6.
o In vi mode, `u' can go past the original modification point.
o The singlelinezle option has problems with prompts containing escapes.
o The `r' command does not work inside `$(...)' or ``...`'
expansions. This is fixed in 3.1.
o `typeset' handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways. 3.1.6 has
been overhauled, but remaining glitches are to be expected.
o Nested closures in extended globbing and pattern matching, such as
[[ fofo = (fo#)# ]]
were not correctly handled, and there were problems with
complicated exclusions using `^' or `~'. These
are fixed in version 3.1.3.
o Handling of the `:q' and `:x' with parameter subsitutions is
erratic: neither work in any 3.0 release, and :x doesn't work in
any release so far.
Note that a few recent changes introduce incompatibilities (these
are not bugs):
Changes after zsh 3.0 (3.1.x is still currently in beta):
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
(don't do AUTO_LIST if there was an unambiguous prefix that could be
inserted, i.e. only list if it is ambiguous what to insert next) are
now set by default. This is in response to complaints that too many
zsh features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o In 3.1.5, history-search-{forward,backward} only find previous
lines where the first word is the same as the current one. For
example,
comp<ESC>p
will find lines in the history like `comp -edit emacs', but not
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there is a different implementation which makes this
closer (though not identical) to the old behaviour, and the
traditional bindings have been restored.. The story for the
{up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \
'^[[A' up-line-or-history '^[[B' down-line-or-history
(unless your terminal requires `^[O' instead of `^[['). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
Changes since zsh 2.5:
o The left hand of an assignment is no longer substituted. Thus,
`$1=$2' will not work. You can use something like `eval
"$1=\$2"', which should have the identical effect.
o Signal traps established with the `trap' builtin are now called with
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they
used to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
words if the IGNORE_BRACES option is set.
o The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so `if ( ... ) ...'
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an `if', etc., is less strict
than in other shells.
o `foo=*' does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (`foo=(*)' is and has always been the
consistent way of doing this.)
o <> performs redirection of input and output to the specified file.
For numeric globs, you now need <->.
o The command line qualifiers exec, noglob, command, - are now
treated more like builtin commands: previously they were
syntactically special. This should make it easier to perform
tricks with them (disabling, hiding in parameters, etc.).
o The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
o The current version now uses ~'s for directory stack substitution
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
o The HISTLIT option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
o The `$HISTCHARS' variable is now `$histchars'. Currently both
are tied together for compatibility.
o The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
o Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a %; history is now %!, not
!. Backslashes are no longer special.
--- 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.53
diff -u -r1.53 zshfaq.yo
--- zshfaq.yo 2000/03/24 20:55:34 1.53
+++ zshfaq.yo 2000/04/30 14:39:09
@@ -43,20 +43,21 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/03/24)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/04/30)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/03/24
+mydit(Last-Modified:) 2000/04/30
mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
-mydit(Version:) $Id: faqpost.txt,v 1.19 2000/04/30 14:41:10 pws Exp $
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
)
-bf(Changes since issue posted February 2000:)
+bf(Changes since issue posted March 2000:)
description(
-mydit(3.25) Now question: coloured prompts on colour xterms.
+mydit(3.8) Mention the `keypad mode' horror and fixes (from Bart).
+mydit(3.25) Rephrased, example for older versions added.
+mydit(5.1) Mention :x and :q modifiers again
)
This document contains a list of frequently-asked (or otherwise
@@ -1190,7 +1191,30 @@
tt(B), tt(C) or tt(D), as well as the corresponding set beginning
mytt(<ESC>[), so this may be redundant.
+ A particular problem which sometimes occurs is that there are two
+ different modes for arrow keys, normal mode and keypad mode, which
+ send different sequences. Although this is largely a historical
+ artifact, it sometimes happens that your terminal can be switched from
+ one mode to the other, for example by a rogue programme that sends the
+ sequence to switch one way, but not the sequence to switch back. Thus
+ you are stuck with the effects. Luckily in this case the arrow key
+ sequences are likely to be standard, and you can simply bind both sets.
+ The following code does this.
+ verb(
+ bindkey '\e[A' up-line-or-history
+ bindkey '\e[B' down-line-or-history
+ bindkey '\e[C' forward-char
+ bindkey '\e[D' backward-char
+ bindkey '\eOA' up-line-or-history
+ bindkey '\eOB' down-line-or-history
+ bindkey '\eOC' forward-char
+ bindkey '\eOD' backward-char
+ )
+ For most even vaguely VT100-compatible terminals, the above eight
+ instructions are a fairly safe bet for your tt(.zshrc). Of course
+ you can substitute variant functions for the second argument here too.
+
sect(Why does my terminal act funny in some way?)
If you are using an OpenWindows cmdtool as your terminal, any
@@ -1606,24 +1630,29 @@
sect(How do I get coloured prompts on my colour xterm?)
-(Or `color xterm', if you're reading this in black and white.) You need to
-find the sequences which generate the various colours from the manual;
-these are ANSI standard on the terminal emulators I know about which
-support colour. With a recent (post 3.1.6) distribution of zsh, there is a
-theme system to handle this for you; even if you don't see that, the
-installed function `mytt(colors)' (meaning `colours', if you're not reading
-this in black and white) gives the escape sequences. You will end up with
-code looking like this (borrowed from Oliver Kiddle):
-verb(
- PS1=$'%{\e[1;31m%}<the rest of your prompt here>%{\e[0m%}'
-)
-The mytt($') form of quoting turns the `mytt(\e)' into a real escape
-character. The `mytt(%{...%})' is used in prompts for strings which will
-not appear as characters, so that the prompt code doesn't miscalculate the
-length of the prompt which would have a bad effect on editing. The
-resulting `mytt(<ESC>[1;31m)' makes the prompt red, and the
-`mytt(<ESC>[0m)' puts printing back to normal so that the rest of the line
-is unchanged.
+ (Or `color xterm', if you're reading this in black and white.) You need
+ to find the sequences which generate the various colours from the manual
+ for your terminal emulator; these are ANSI standard on those I know about
+ which support colour. With a recent (post 3.1.6) distribution of zsh,
+ there is a theme system to handle this for you; even if you don't see that,
+ the installed function `mytt(colors)' (meaning `colours', if you're not
+ reading this in black and white) gives the escape sequences. You will end
+ up with code looking like this (borrowed from Oliver Kiddle):
+ verb(
+ PS1=$'%{\e[1;31m%}<the rest of your prompt here>%{\e[0m%}'
+ )
+ The mytt($') form of quoting turns the `mytt(\e)' into a real escape
+ character; this only works from about version 3.1.4, so if you're using
+ 3.0.x, you need to do something like
+ verb(
+ PS1="$(print '%{\e[1;31m%}<the rest goes here>%{\e[0m%}')"
+ )
+ The `mytt(%{...%})' is used in prompts for strings which will
+ not appear as characters, so that the prompt code doesn't miscalculate the
+ length of the prompt which would have a bad effect on editing. The
+ resulting `mytt(<ESC>[1;31m)' makes the prompt red, and the
+ `mytt(<ESC>[0m)' puts printing back to normal so that the rest of the line
+ is unchanged.
chapter(The mysteries of completion)
@@ -1980,6 +2009,9 @@
complicated exclusions using mytt(^) or mytt(~). These
are fixed in version 3.1.3.
)
+ it() Handling of the mytt(:q) and mytt(:x) with parameter subsitutions is
+ erratic: neither work in any 3.0 release, and tt(:x) doesn't work in
+ any release so far.
Note that a few recent changes introduce incompatibilities (these
are not bugs):
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-03-23 20:58 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-03-23 20:58 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted February 2000:
3.25 Now question: coloured prompts on colour xterms.
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@sunsite.auc.dk
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@rtfm.mit.edu
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 ---
3.25: How do I get coloured prompts on my colour xterm?
(Or `color xterm', if you're reading this in black and white.) You need to
find the sequences which generate the various colours from the manual;
these are ANSI standard on the terminal emulators I know about which
support colour. With a recent (post 3.1.6) distribution of zsh, there is a
theme system to handle this for you; even if you don't see that, the
installed function ``colors'' (meaning `colours', if you're not reading
this in black and white) gives the escape sequences. You will end up with
code looking like this (borrowed from Oliver Kiddle):
PS1=$'%{\e[1;31m%}<the rest of your prompt here>%{\e[0m%}'
The `$'' form of quoting turns the ``\e'' into a real escape
character. The ``%{...%}'' is used in prompts for strings which will
not appear as characters, so that the prompt code doesn't miscalculate the
length of the prompt which would have a bad effect on editing. The
resulting ``<ESC>[1;31m'' makes the prompt red, and the
``<ESC>[0m'' puts printing back to normal so that the rest of the line
is unchanged.
--- 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.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- zshfaq.yo 2000/02/23 20:41:58 1.52
+++ zshfaq.yo 2000/03/24 20:55:34 1.53
@@ -43,20 +43,20 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/02/23)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/03/24)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/02/23
+mydit(Last-Modified:) 2000/03/24
mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
-mydit(Version:) $Id: zshfaq.yo,v 1.52 2000/02/23 20:41:58 pws Exp $
+mydit(Version:) $Id: zshfaq.yo,v 1.53 2000/03/24 20:55:34 pws Exp $
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
)
-bf(Changes since issue posted January 1999:)
+bf(Changes since issue posted February 2000:)
description(
-mydit(1.1) Mention user guide instead of semi-defunct reference card.
+mydit(3.25) Now question: coloured prompts on colour xterms.
)
This document contains a list of frequently-asked (or otherwise
@@ -120,6 +120,7 @@
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?
@@ -1602,6 +1603,27 @@
read; all input is read as continuation lines (this may require the
fixes referred to above in order to be reliable).
)
+
+sect(How do I get coloured prompts on my colour xterm?)
+
+(Or `color xterm', if you're reading this in black and white.) You need to
+find the sequences which generate the various colours from the manual;
+these are ANSI standard on the terminal emulators I know about which
+support colour. With a recent (post 3.1.6) distribution of zsh, there is a
+theme system to handle this for you; even if you don't see that, the
+installed function `mytt(colors)' (meaning `colours', if you're not reading
+this in black and white) gives the escape sequences. You will end up with
+code looking like this (borrowed from Oliver Kiddle):
+verb(
+ PS1=$'%{\e[1;31m%}<the rest of your prompt here>%{\e[0m%}'
+)
+The mytt($') form of quoting turns the `mytt(\e)' into a real escape
+character. The `mytt(%{...%})' is used in prompts for strings which will
+not appear as characters, so that the prompt code doesn't miscalculate the
+length of the prompt which would have a bad effect on editing. The
+resulting `mytt(<ESC>[1;31m)' makes the prompt red, and the
+`mytt(<ESC>[0m)' puts printing back to normal so that the rest of the line
+is unchanged.
chapter(The mysteries of completion)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-02-23 20:49 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-02-23 20:49 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted January 1999:
1.1 Mention user guide instead of semi-defunct reference card.
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?
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@sunsite.auc.dk
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@rtfm.mit.edu
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://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 ---
Only 1.1 changed in substance, so this space intentionally left blank
again.
--- 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.50
retrieving revision 1.52
diff -u -r1.50 -r1.52
--- zshfaq.yo 2000/01/25 21:06:05 1.50
+++ zshfaq.yo 2000/02/23 20:41:58 1.52
@@ -43,20 +43,20 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/1/25)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2000/02/23)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2000/11/25
-mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
-mydit(Version:) $Id: zshfaq.yo,v 1.50 2000/01/25 21:06:05 pws Exp $
+mydit(Last-Modified:) 2000/02/23
+mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
+mydit(Version:) $Id: zshfaq.yo,v 1.52 2000/02/23 20:41:58 pws Exp $
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2000 (see end of document)
)
-bf(Changes since issue posted December 1999:)
+bf(Changes since issue posted January 1999:)
description(
-mydit( ) None. Suggestions on a postcard.
+mydit(1.1) Mention user guide instead of semi-defunct reference card.
)
This document contains a list of frequently-asked (or otherwise
@@ -147,9 +147,8 @@
label(11)
Information on zsh is available via the World Wide Web. The URL
- is url(http://sunsite.auc.dk/zsh/)(http://sunsite.auc.dk/zsh/) (note the \
- change of address from the
- end of April 1998). The server provides this FAQ and much else and is
+ is url(http://sunsite.auc.dk/zsh/)(http://sunsite.auc.dk/zsh/) .
+ The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail \
email(zsh@sunsite.auc.dk)
with any related messages). The FAQ is at \
@@ -188,13 +187,15 @@
The latest version of this FAQ is also available directly from any
of the zsh archive sites listed in question link(1.6)(16).
- There is now a preliminary version of a reference card for
- zsh 3.0, which you can find (while it's being developed) at
- url(http://www.ifh.de/~pws/computing/refcard.ps)
- (http://www.ifh.de/~pws/computing/refcard.ps)
- This is optimised for A4 paper. The tt(LaTeX) source is in the
- same place with the extension tt(.tex). It is not a good place
- from which to learn zsh for the first time.
+ 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
+ url(http://www.pwstephenson.fsnet.co.uk/computing/)
+(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 tt(\M-2
\C-x $) to make all the indented text vanish, then tt(\M-0 \C-x $)
@@ -1371,6 +1372,7 @@
is a neat way of doing what you want. Note that it is the quotes, not
the prompt expansion, which turns the `tt(\n)' into a newline.
+
sect(Why does mytt(bindkey ^a command-name) or mytt(stty intr ^-) do something funny?)
You probably have the extendedglob option set in which case tt(^) and tt(#)
@@ -1619,6 +1621,7 @@
`tt(autoload -U compinit; compinit)' in your tt(.zshrc) should be enough if
the system is installed properly. The rest of this section talks about the
old completion system.
+
sect(What is completion?)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 2000-01-25 21:10 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 2000-01-25 21:10 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted December 1999:
None. Suggestions on a postcard.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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 ---
This space intentionally left blank.
--- End of changed items, diff from previous version follows ---
This space, too, intentionally left blank.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-12-28 12:03 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-12-28 12:03 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted November 1999:
1.5 Latest development versions now in archive.
4.3 Unmisspelled LIST_AMBIGUOUS; added BASH_AUTO_LIST.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.7 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.
The beta version 3.1.6 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.
4.3: How does zsh deal with ambiguous completions?
Often there will be more than one possible completion: two files
start with the same characters, for example. Zsh has a lot of
flexibility for what it does here via its options. The default is
for it to beep and completion to stop until you type another
character. You can type \C-D to see all the possible completions.
(That's assuming you're at the end of the line, otherwise \C-D will
delete the next character and you have to use ESC-\C-D.) This can be
changed by the following options, among others:
o with NO_BEEP set, that annoying beep goes away
o with NO_LIST_BEEP, beeping is only turned off for ambiguous
completions
o with AUTO_LIST set, when the completion is ambiguous you get a
list without having to type \C-D
o with BASH_AUTO_LIST set, the list only happens the second
time you hit tab on an ambiguous completion
o with LIST_AMBIGUOUS, this is modified so that nothing is listed if
there is an unambiguous prefix or suffix to be inserted --- this
can be combined with BASH_AUTO_LIST, so that where both are
applicable you need to hit tab three times for a listing.
o with MENU_COMPLETE set, one completion is always inserted
completely, then when you hit TAB it changes to the next, and so
on until you get back to where you started
o with AUTO_MENU, you only get the menu behaviour when you hit TAB
again on the ambiguous completion.
o Finally, although it affects all completion lists, including
those explicitly requested, note also ALWAYS_LAST_PROMPT, which
causes the cursor to return to the line you were editing after
printing the list, provided that is short enough.
Combinations of these are possible; for example, AUTO_LIST and
AUTO_MENU together give an intuitive combination. Note that
from version 3.1 LIST_AMBIGUOUS is set by default; if you use
autolist, you may well want to `unsetopt listambiguous'.
--- 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.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- zshfaq.yo 1999/12/14 22:03:04 1.47
+++ zshfaq.yo 1999/12/28 12:00:50 1.48
@@ -43,20 +43,21 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1999/11/26)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1999/12/28)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 1999/11/26
+mydit(Last-Modified:) 1999/12/28
mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
mydit(Version:) <Not yet updated due to archive problems>
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--1999 (see end of document)
)
-bf(Changes since issue posted September 1999:)
+bf(Changes since issue posted November 1999:)
description(
-mydit(1.5) Latest production version is 3.0.7.
+mydit(1.5) Latest development versions now in archive.
+mydit(4.3) Unmisspelled LIST_AMBIGUOUS; added BASH_AUTO_LIST.
)
This document contains a list of frequently-asked (or otherwise
@@ -306,7 +307,10 @@
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.
+ 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
+ tt(development) subdirectory.
Note also that as the shell changes, it may become incompatible with
older versions; see the end of question link(5.1)(51) for a partial list.
@@ -1135,7 +1139,7 @@
case $TERM in
sun-cmd+CHAR(41) print -Pn "\e]l%~\e\\"
;;
- *xterm*|rxvt|dtterm|Eterm+CHAR(41) print -Pn "\e]2;%~\a"
+ *xterm*|rxvt|(dt|k|E)term+CHAR(41) print -Pn "\e]2;%~\a"
;;
esac
}
@@ -1724,8 +1728,12 @@
completions
it() with tt(AUTO_LIST) set, when the completion is ambiguous you get a
list without having to type tt(\C-D)
- it() with tt(LIST_AMBIGOUS), this is modified so that nothing is listed if
- there is an unambiguous prefix or suffix to be inserted
+ it() with tt(BASH_AUTO_LIST) set, the list only happens the second
+ time you hit tab on an ambiguous completion
+ it() with tt(LIST_AMBIGUOUS), this is modified so that nothing is listed if
+ there is an unambiguous prefix or suffix to be inserted --- this
+ can be combined with tt(BASH_AUTO_LIST), so that where both are
+ applicable you need to hit tab three times for a listing.
it() with tt(MENU_COMPLETE) set, one completion is always inserted
completely, then when you hit TAB it changes to the next, and so
on until you get back to where you started
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-11-29 22:52 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-11-29 22:52 UTC (permalink / raw)
To: zsh-announce
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.
[ Every time I try sunsite.auc.dk it's down, so I'm posting
this without having yet updated the CVS and WWW versions --- pws ]
Changes since issue posted September 1999:
1.5 Latest production version is 3.0.7.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.7 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.
The beta version 3.1.6 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.
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.
--- End of changed items, diff from previous version follows ---
--- zshfaq.yo.old Fri Nov 26 20:40:02 1999
+++ zshfaq.yo Mon Nov 29 22:50:07 1999
@@ -31,10 +31,10 @@
COMMENT(-- myeit is like eit but fancier text formatting --)\
def(myeit)(0)(\
whenlatex(eit())whenhtml(eit())whenman(eit())whenms(eit())whensgml(eit())\
- whentxt(USECOUNTER(XXenumcounter)CHAR(41)))\
+ whentxt(eit()CHAR(41)))\
def(myeitd)(0)(\
whenlatex(eit())whenhtml(eit())whenman(eit())whenms(eit())whensgml(eit())\
- whentxt(USECOUNTER(XXenumcounter).))\
+ whentxt(.))\
COMMENT(-- don't want headers for text, USENET headers must come first --)\
def(myreport)(3)(\
whentxt(report()()())\
@@ -43,26 +43,20 @@
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
-myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1999/05/24)
+myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1999/11/26)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 1999/09/27
+mydit(Last-Modified:) 1999/11/26
mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
-mydit(Version:) $Id: zshfaq.yo,v 1.46 1999/09/27 12:32:00 pws Exp $
+mydit(Version:) <Not yet updated due to archive problems>
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--1999 (see end of document)
)
-bf(Changes since issue posted July 1999:)
+bf(Changes since issue posted September 1999:)
description(
-mydit(1.4) Don't even mention version 2.5
-mydit(1.6) FTP site changes
-mydit(2.3) $*:q does work, at least in 3.1.6
-mydit(3.12) Don't mention old tt($[...]) format any more
-mydit(4) Briefly mention new 3.1.6 completion
-mydit(5.1) Mention old bindings for history-search have been restored
- along with behaviour.
+mydit(1.5) Latest production version is 3.0.7.
)
This document contains a list of frequently-asked (or otherwise
@@ -301,7 +295,7 @@
sect(What's the latest version?)
- Zsh 3.0.6 is the latest production version. The new major number 3.0
+ Zsh 3.0.7 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
@@ -758,7 +752,6 @@
Here is Bart Schaefer's guide to converting csh aliases for zsh.
- SETCOUNTER(XXenumcounter)(0)
enumerate(
myeit() If the csh alias references "parameters" (tt(\!:1), tt(\!*) etc.),
then in zsh you need a function (referencing tt($1), tt($*) etc.).
@@ -1064,7 +1057,6 @@
This may seem a useful shorthand, but in practice it can have
unhelpful side effects:
- SETCOUNTER(XXenumcounter)(0)
enumerate(
myeit() Since every variable is in the environment as well as remembered
by the shell, the memory for it needs to be allocated twice.
@@ -1275,7 +1267,6 @@
The problem is that there are two possible ways of autoloading a
function (see the AUTOLOADING FUNCTIONS section of the zsh manual
page zshmisc for more detailed information):
- SETCOUNTER(XXenumcounter)(0)
enumerate(
myeit() The file contains just the body of the function, i.e.
there should be no line at the beginning saying mytt(function foo {)
@@ -1875,7 +1866,6 @@
Different conditions can also be combined. There are three levels
of this (in decreasing order of precedence):
- SETCOUNTER(XXenumcounter)(0)
enumerate(
myeit() multiple square brackets after a single condition give
alternatives: for example, mytt(s[foo][bar]) says apply the
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-09-27 12:02 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-09-27 12:02 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted July 1999:
1.4 Don't even mention version 2.5
1.6 FTP site changes
2.3 $*:q does work, at least in 3.1.6
3.12 Don't mention old $[...] format any more
4 Briefly mention new 3.1.6 completion
5.1 Mention old bindings for history-search have been restored
along with behaviour.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.4: On what machines will it run?
From version 3.0, zsh uses GNU autoconf as the installation
mechanism. This considerably increases flexibility over the old
`buildzsh' mechanism. Consequently, zsh should compile and run on
any modern version of UNIX, and a great many not-so-modern versions
too. The file Etc/MACHINES in the distribution has more details.
There are also now separate ports for Windows and OS/2, see `Where
do I get it' below.
If you need to change something to support a new machine, it would be
appreciated if you could add any necessary preprocessor code and
alter configure.in and acconfig.h to configure zsh automatically,
then send the required context diffs to the list (see question
5.2). Please make sure you have the latest version first.
To get it to work, retrieve the source distribution (see question
1.6), un-gzip it, un-tar it and read the INSTALL file in the top
directory. Also read the Etc/MACHINES file for up-to-date
information on compilation on certain architectures.
*Note for users of nawk* (The following information comes from Zoltan
Hidvegi): On some systems nawk is broken and produces an incorrect
signames.h file. This makes the signals code unusable. This often happens
on Ultrix, HP-UX, IRIX (?). Install gawk if you experience such problems.
1.6: Where do I get it?
The coordinator of development is currently me; the alias
coordinator@zsh.org 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.gmd.de/packages/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@microsoft.com>; 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
Likewise the OS/2 port is available from TAMURA Kent
<kent@tril.ibm.co.jp> 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/
2.3: Why do my csh aliases not work? (Plus other alias pitfalls.)
First of all, check you are using the syntax
alias newcmd='list of commands'
and not
alias newcmd 'list of commands'
which won't work. (It tells you if `newcmd' and `list of commands' are
already defined as aliases.)
Otherwise, your aliases probably contain references to the command
line of the form `\!*', etc. Zsh does not handle this behaviour as it
has shell functions which provide a way of solving this problem more
consistent with other forms of argument handling. For example, the
csh alias
alias cd 'cd \!*; echo $cwd'
can be replaced by the zsh function,
cd() { builtin cd "$@"; echo $PWD; }
(the `builtin' tells zsh to use its own `cd', avoiding an infinite loop)
or, perhaps better,
cd() { builtin cd "$@"; print -D $PWD; }
(which converts your home directory to a ~). In fact, this problem is
better solved by defining the special function chpwd() (see the manual).
Note also that the `;' at the end of the function is optional in zsh,
but not in ksh or sh (for sh's where it exists).
Here is Bart Schaefer's guide to converting csh aliases for zsh.
1) If the csh alias references "parameters" (\!:1, \!* etc.),
then in zsh you need a function (referencing $1, $* etc.).
Otherwise, you can use a zsh alias.
2) If you use a zsh function, you need to refer _at_least_ to
$* in the body (inside the { }). Parameters don't magically
appear inside the { } the way they get appended to an alias.
3) If the csh alias references its own name (alias rm "rm -i"),
then in a zsh function you need the "command" keyword
(function rm() { command rm -i "$@" }), but in a zsh alias
you don't (alias rm="rm -i").
4) If you have aliases that refer to each other (alias ls "ls -C";
alias lf "ls -F" ==> lf == ls -C -F) then you must either:
o convert all of them to zsh functions; or
o after converting, be sure your .zshrc defines all of your
aliases before it defines any of your functions.
Those first four are all you really need, but here are four more for
heavy csh alias junkies:
5) Mapping from csh alias "parameter referencing" into zsh function
(assuming SH_WORD_SPLIT and KSH_ARRAYS are NOT set in zsh):
csh zsh
===== ==========
\!* $* (or $argv)
\!^ $1 (or $argv[1])
\!:1 $1
\!:2 $2 (or $argv[2], etc.)
\!$ $*[$#] (or $argv[$#], or $*[-1])
\!:1-4 $*[1,4]
\!:1- $*[1,$#-1] (or $*[1,-2])
\!^- $*[1,$#-1]
\!*:q "$@"
\!*:x $=* ($*:x doesn't work (yet))
6) Remember that it is NOT a syntax error in a zsh function to
refer to a position ($1, $2, etc.) greater than the number of
parameters. (E.g., in a csh alias, a reference to \!:5 will
cause an error if 4 or fewer arguments are given; in a zsh
function, $5 is the empty string if there are 4 or fewer
parameters.)
7) To begin a zsh alias with a - (dash, hyphen) character, use
`alias --':
csh zsh
=============== ==================
alias - "fg %-" alias -- -="fg %-"
8) Stay away from `alias -g' in zsh until you REALLY know what
you're doing.
There is one other serious problem with aliases: consider
alias l='/bin/ls -F'
l() { /bin/ls -la "$@" | more }
`l' in the function definition is in command position and is expanded
as an alias, defining `/bin/ls' and `-F' as functions which call
`/bin/ls', which gets a bit recursive. This can be avoided if you use
`function' to define a function, which doesn't expand aliases. It is
possible to argue for extra warnings somewhere in this mess. Luckily,
it is not possible to define `function' as an alias.
Bart Schaefer's rule is: Define first those aliases you expect to
use in the body of a function, but define the function first if the
alias has the same name as the function.
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.
Chapter 4: The mysteries of completion
Programmable completion using the `compctl' command is one of the most
powerful, and also potentially confusing, features of zsh; here I give
a short introduction. There is a set of example completions supplied
with the source in Misc/compctl-examples; completion definitions for
many of the most obvious commands can be found there.
If this confuses you, you may like to know that there is a new, more
elegant completion system which appeared in version 3.1.6. This is based
on functions called automatically for completion in particular contexts
(for example, there is a function called _cd to handle completion for
the cd command) and is installed automatically with the shell, so all
you need to do, in principal, is to arrange for this to be loaded. Putting
`autoload -U compinit; compinit' in your .zshrc should be enough if
the system is installed properly. The rest of this section talks about the
old completion system.
5.1: What bugs are currently known and unfixed? (Plus recent important changes)
Here are some of the more well-known ones, very roughly in
decreasing order of significance. Many of these can also be counted
against differences from ksh in question 2.1; note that this applies
to the latest beta version and that simple bugs are often fixed
quite quickly. There is a file Etc/BUGS in the source distribution
with more detail.
o `time' is ignored with builtins and can't be used with `{...}'.
o When showing completion lists with exactly 80 columns, some
terminals print an extra newline which messes up zsh's logic.
o `set -x' (`setopt xtrace') still has a few glitches; these
are mostly fixed in 3.1.6.
o Zsh's notion of the current line number (via $LINENO) is
sometimes not well handled, particularly when using functions and traps.
This should also work reliably from 3.0.6 and 3.1.6.
o In vi mode, `u' can go past the original modification point.
o The singlelinezle option has problems with prompts containing escapes.
o The `r' command does not work inside `$(...)' or ``...`'
expansions. This is fixed in 3.1.
o `typeset' handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways. 3.1.6 has
been overhauled, but remaining glitches are to be expected.
o Nested closures in extended globbing and pattern matching, such as
[[ fofo = (fo#)# ]]
were not correctly handled, and there were problems with
complicated exclusions using `^' or `~'. These
are fixed in version 3.1.3.
Note that a few recent changes introduce incompatibilities (these
are not bugs):
Changes after zsh 3.0 (3.1.x is still currently in beta):
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
(don't do AUTO_LIST if there was an unambiguous prefix that could be
inserted, i.e. only list if it is ambiguous what to insert next) are
now set by default. This is in response to complaints that too many
zsh features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o In 3.1.5, history-search-{forward,backward} only find previous
lines where the first word is the same as the current one. For
example,
comp<ESC>p
will find lines in the history like `comp -edit emacs', but not
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there is a different implementation which makes this
closer (though not identical) to the old behaviour, and the
traditional bindings have been restored.. The story for the
{up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \
'^[[A' up-line-or-history '^[[B' down-line-or-history
(unless your terminal requires `^[O' instead of `^[['). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
Changes since zsh 2.5:
o The left hand of an assignment is no longer substituted. Thus,
`$1=$2' will not work. You can use something like `eval
"$1=\$2"', which should have the identical effect.
o Signal traps established with the `trap' builtin are now called with
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they
used to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
words if the IGNORE_BRACES option is set.
o The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so `if ( ... ) ...'
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an `if', etc., is less strict
than in other shells.
o `foo=*' does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (`foo=(*)' is and has always been the
consistent way of doing this.)
o <> performs redirection of input and output to the specified file.
For numeric globs, you now need <->.
o The command line qualifiers exec, noglob, command, - are now
treated more like builtin commands: previously they were
syntactically special. This should make it easier to perform
tricks with them (disabling, hiding in parameters, etc.).
o The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
o The current version now uses ~'s for directory stack substitution
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
o The HISTLIT option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
o The `$HISTCHARS' variable is now `$histchars'. Currently both
are tied together for compatibility.
o The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
o Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a %; history is now %!, not
!. Backslashes are no longer special.
--- 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.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- zshfaq.yo 1999/07/30 09:27:17 1.45
+++ zshfaq.yo 1999/09/27 12:32:00 1.46
@@ -47,13 +47,24 @@
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 1999/07/30
+mydit(Last-Modified:) 1999/09/27
mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
-mydit(Version:) $Id: zshfaq.yo,v 1.45 1999/07/30 09:27:17 pws Exp $
+mydit(Version:) $Id: zshfaq.yo,v 1.46 1999/09/27 12:32:00 pws Exp $
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--1999 (see end of document)
)
+bf(Changes since issue posted July 1999:)
+description(
+mydit(1.4) Don't even mention version 2.5
+mydit(1.6) FTP site changes
+mydit(2.3) $*:q does work, at least in 3.1.6
+mydit(3.12) Don't mention old tt($[...]) format any more
+mydit(4) Briefly mention new 3.1.6 completion
+mydit(5.1) Mention old bindings for history-search have been restored
+ along with behaviour.
+)
+
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
@@ -275,8 +286,7 @@
appreciated if you could add any necessary preprocessor code and
alter configure.in and acconfig.h to configure zsh automatically,
then send the required context diffs to the list (see question
- link(5.2)(52)). Changes based on version 2.5 are very unlikely to
- be useful.
+ link(5.2)(52)). Please make sure you have the latest version first.
To get it to work, retrieve the source distribution (see question
link(1.6)(16)), un-gzip it, un-tar it and read the INSTALL file in the top
@@ -367,6 +377,8 @@
(ftp://sunsite.icm.edu.pl/pub/unix/shells/zsh/)
mydit(Romania) url(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/)
(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/)
+ mydit() url(ftp://ftp.kappa.ro/pub/mirrors/ftp.zsh.org/pub/zsh/)
+(ftp://ftp.kappa.ro/pub/mirrors/ftp.zsh.org/pub/zsh/)
mydit(Slovenia) url(ftp://ftp.siol.net/mirrors/zsh/)
(ftp://ftp.siol.net/mirrors/zsh/)
mydit(Sweden) url(ftp://ftp.lysator.liu.se/pub/unix/zsh/)
@@ -636,7 +648,7 @@
it() Traps and signals:
itemize(
it()* Traps are not local to functions. The option LOCAL_TRAPS is
- be available from 3.1.6.
+ available from 3.1.6.
it() TRAPERR has become TRAPZERR (this was forced by UNICOS which
has SIGERR).
)
@@ -785,7 +797,7 @@
\!:1-4 $*[1,4]
\!:1- $*[1,$#-1] (or $*[1,-2])
\!^- $*[1,$#-1]
- \!*:q "$@" ($*:q doesn't work (yet))
+ \!*:q "$@"
\!*:x $=* ($*:x doesn't work (yet))
)
@@ -1317,9 +1329,9 @@
)
or even
verb(
- foo=$[16#ff]
+ foo=$((16#ff))
)
- (note that `foo=$((16#ff))' is now supported). The original syntax was
+ The original syntax was
verb(
(( foo = [16]ff ))
)
@@ -1606,6 +1618,16 @@
with the source in Misc/compctl-examples; completion definitions for
many of the most obvious commands can be found there.
+If this confuses you, you may like to know that there is a new, more
+elegant completion system which appeared in version 3.1.6. This is based
+on functions called automatically for completion in particular contexts
+(for example, there is a function called tt(_cd) to handle completion for
+the tt(cd) command) and is installed automatically with the shell, so all
+you need to do, in principal, is to arrange for this to be loaded. Putting
+`tt(autoload -U compinit; compinit)' in your tt(.zshrc) should be enough if
+the system is installed properly. The rest of this section talks about the
+old completion system.
+
sect(What is completion?)
`Completion' is where you hit a particular command key (TAB is the
@@ -1963,7 +1985,8 @@
mytt(\M-p) use tt(history-beginning-search-{forward,backward}) which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there is a different implementation which makes this
- closer (though not identical) to the old behaviour. The story for the
+ closer (though not identical) to the old behaviour, and the
+ traditional bindings have been restored.. The story for the
tt({up,down}-line-or-search) commands is similar.
it() In vi insert mode, the cursor keys no longer work. The following
will bind them:
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-07-24 12:20 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-07-24 12:20 UTC (permalink / raw)
To: zsh-announce
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.
Changes since issue posted June 1999:
1.6 FTP site changes
3.9 delete bogus claim that ttyctl code may be updated some day;
add note about possible termcap deinitialization sequences
5.1 80-column display bug.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.6: Where do I get it?
The coordinator of development is currently me; the alias
coordinator@zsh.org 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.gmd.de/packages/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.tohoku.ac.jp/mirror/zsh/
ftp://ftp.nisiq.net/pub/shells/zsh/
ftp://ftp.win.ne.jp/pub/shell/zsh/
Norway ftp://ftp.uit.no/pub/unix/shells/zsh/
Romania ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
Slovenia ftp://ftp.siol.net/pub/unix/shells/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://ftp.math.gatech.edu/pub/zsh/
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@microsoft.com>; 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
Likewise the OS/2 port is available from TAMURA Kent
<kent@tril.ibm.co.jp> 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.9: Why does my terminal act funny in some way?
If you are using an OpenWindows cmdtool as your terminal, any
escape sequences (such as those produced by cursor keys) will be
swallowed up and never reach zsh. Either use shelltool or avoid
commands with escape sequences. You can also disable scrolling from
the cmdtool pane menu (which effectively turns it into a shelltool).
If you still want scrolling, try using an xterm with the scrollbar
activated.
If that's not the problem, and you are using stty to change some tty
settings, make sure you haven't asked zsh to freeze the tty settings:
type
ttyctl -u
before any stty commands you use.
On the other hand, if you aren't using stty and have problems you may
need the opposite: `ttyctl -f' freezes the terminal to protect it
from hiccups introduced by other programmes (kermit has been known to
do this).
A problem I have experienced myself (on an AIX 3.2 workstation with
xterm) is that termcap deinitialization sequences sent by `less'
were causing automargins to be turned off --- not actually a shell
problem, but you might have thought it was. The fix is to put `X'
into the environment variable LESS to stop the sequences being sent.
Other programs (though not zsh) may also send that sequence.
If _that_'s not the problem, and you are having difficulties with
external commands (not part of zsh), and you think some terminal
setting is wrong (e.g. ^V is getting interpreted as `literal next
character' when you don't want it to be), try
ttyctl -u
STTY='lnext "^-"' commandname
(in this example), or just export STTY for all commands to see. Note
that zsh doesn't reset the terminal completely afterwards: just the
modes it uses itself and a number of special processing characters
(see the stty(1) manual page).
5.1: What bugs are currently known and unfixed? (Plus recent important changes)
Here are some of the more well-known ones, very roughly in
decreasing order of significance. Many of these can also be counted
against differences from ksh in question 2.1; note that this applies
to the latest beta version and that simple bugs are often fixed
quite quickly. There is a file Etc/BUGS in the source distribution
with more detail.
o `time' is ignored with builtins and can't be used with `{...}'.
o When showing completion lists with exactly 80 columns, some
terminals print an extra newline which messes up zsh's logic.
o `set -x' (`setopt xtrace') still has a few glitches; these
are mostly fixed in 3.1.6.
o Zsh's notion of the current line number (via $LINENO) is
sometimes not well handled, particularly when using functions and traps.
This should also work reliably from 3.1.6.
o In vi mode, `u' can go past the original modification point.
o The singlelinezle option has problems with prompts containing escapes.
o The `r' command does not work inside `$(...)' or ``...`'
expansions. This is fixed in 3.1.
o `typeset' handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways. 3.1.6 has
been overhauled, but remaining glitches are to be expected.
o Nested closures in extended globbing and pattern matching, such as
[[ fofo = (fo#)# ]]
were not correctly handled, and there were problems with
complicated exclusions using `^' or `~'. These
are fixed in version 3.1.3.
Note that a few recent changes introduce incompatibilities (these
are not bugs):
Changes after zsh 3.0 (3.1.x is still currently in beta):
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
(don't do AUTO_LIST if there was an unambiguous prefix that could be
inserted, i.e. only list if it is ambiguous what to insert next) are
now set by default. This is in response to complaints that too many
zsh features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o In 3.1.5, history-search-{forward,backward} only find previous
lines where the first word is the same as the current one. For
example,
comp<ESC>p
will find lines in the history like `comp -edit emacs', but not
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there will be a different implementation which
makes this closer (though not identical) to the old behaviour.
The story for the {up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \
'^[[A' up-line-or-history '^[[B' down-line-or-history
(unless your terminal requires `^[O' instead of `^[['). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
Changes since zsh 2.5:
o The left hand of an assignment is no longer substituted. Thus,
`$1=$2' will not work. You can use something like `eval
"$1=\$2"', which should have the identical effect.
o Signal traps established with the `trap' builtin are now called with
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they
used to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
words if the IGNORE_BRACES option is set.
o The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so `if ( ... ) ...'
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an `if', etc., is less strict
than in other shells.
o `foo=*' does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (`foo=(*)' is and has always been the
consistent way of doing this.)
o <> performs redirection of input and output to the specified file.
For numeric globs, you now need <->.
o The command line qualifiers exec, noglob, command, - are now
treated more like builtin commands: previously they were
syntactically special. This should make it easier to perform
tricks with them (disabling, hiding in parameters, etc.).
o The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
o The current version now uses ~'s for directory stack substitution
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
o The HISTLIT option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
o The `$HISTCHARS' variable is now `$histchars'. Currently both
are tied together for compatibility.
o The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
o Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a %; history is now %!, not
!. Backslashes are no longer special.
--- 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.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- zshfaq.yo 1999/06/24 12:57:34 1.43
+++ zshfaq.yo 1999/07/24 12:43:15 1.44
@@ -13,7 +13,7 @@
whenhtml(bf(ARG1))\
whenlatex(bf(ARG1))\
whenms(bf(ARG1))\
- whensgml(bf(ARG1)))
+ whensgml(bf(ARG1)))\
def(myem)(1)(\
whentxt(_ARG1_)\
whenhtml(em(ARG1))\
@@ -45,28 +45,21 @@
whensgml(report(ARG1)(ARG2)(ARG3)))
myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1999/05/24)
COMMENT(-- the following are for Usenet and must appear first)\
-description(
+description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 1999/05/24
+mydit(Last-Modified:) 1999/07/24
mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
-mydit(Version:) $Id: zshfaq.yo,v 1.43 1999/06/24 12:57:34 pws Exp $
+mydit(Version:) $Id: zshfaq.yo,v 1.44 1999/07/24 12:43:15 pws Exp $
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--1999 (see end of document)
)
-bf(Changes since issue posted May 1999:)
+bf(Changes since issue posted June 1999:)
description(
-mydit(1.5) 3.1.6 may appear
-mydit(1.6) updated list of archive sites; coordinator@zsh.org alias;
- new coordinator, alas.
-mydit(2.1) mention tt(SHARE_HISTORY); deleted item on
- tt($(echo '\$x')) difference (can't find this any more); function
- definitions aren't local to functions in ksh either, only traps.
-mydit(3.7) tt(PRINT_EIGHT_BIT) will be in 3.0.6
-mydit(3.24) new: cut-and-paste problems
-mydit(5.1) xtrace and LINENO will work better in 3.1.6
-mydit(5.2) no mailing list archive at ftp.sterling.com
-mydit(5.3) New completion command menu-select for 3.1.6
+mydit(1.6) FTP site changes
+mydit(3.9) delete bogus claim that ttyctl code may be updated some day;
+ add note about possible termcap deinitialization sequences
+mydit(5.1) 80-column display bug.
)
This document contains a list of frequently-asked (or otherwise
@@ -371,6 +364,8 @@
mydit() \
url(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
+ mydit(Italy) url(ftp://ftp.unina.it/pub/Unix/pkgs/shell/zsh/)
+(ftp://ftp.unina.it/pub/Unix/pkgs/shell/zsh/)
mydit(Japan) url(ftp://ftp.tohoku.ac.jp/mirror/zsh/)
(ftp://ftp.tohoku.ac.jp/mirror/zsh/)
mydit() url(ftp://ftp.nisiq.net/pub/shells/zsh/)
@@ -394,8 +389,6 @@
(ftp://ftp.math.gatech.edu/pub/zsh/)
mydit() url(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
- mydit() url(ftp://ftp.sterling.com/zsh/)
-(ftp://ftp.sterling.com/zsh/)
mydit() url(ftp://ftp.rge.com/pub/shells/zsh/)
(ftp://ftp.rge.com/pub/shells/zsh/)
mydit() url(ftp://foad.org/pub/zsh/)
@@ -1225,6 +1218,13 @@
from hiccups introduced by other programmes (kermit has been known to
do this).
+ A problem I have experienced myself (on an AIX 3.2 workstation with
+ xterm) is that termcap deinitialization sequences sent by `less'
+ were causing automargins to be turned off --- not actually a shell
+ problem, but you might have thought it was. The fix is to put `tt(X)'
+ into the environment variable tt(LESS) to stop the sequences being sent.
+ Other programs (though not zsh) may also send that sequence.
+
If myem(that)'s not the problem, and you are having difficulties with
external commands (not part of zsh), and you think some terminal
setting is wrong (e.g. tt(^V) is getting interpreted as `literal next
@@ -1238,12 +1238,6 @@
modes it uses itself and a number of special processing characters
(see the tt(stty(1)) manual page).
- At some point there may be an overhaul which allows the terminal
- modes used by the shell to be modified separately from those seen by
- external programmes. This is partially implemented already: from 2.5,
- the shell is less susceptible to mode changes inherited from
- programmes than it used to be.
-
sect(Why does zsh not work in an Emacs shell mode any more?)
@@ -1932,6 +1926,8 @@
itemize(
it() mytt(time) is ignored with builtins and can't be used with mytt({...}).
+ it() When showing completion lists with exactly 80 columns, some
+ terminals print an extra newline which messes up zsh's logic.
it() mytt(set -x) (mytt(setopt xtrace)) still has a few glitches; these
are mostly fixed in 3.1.6.
it() Zsh's notion of the current line number (via tt($LINENO)) is
@@ -1942,7 +1938,8 @@
it() The mytt(r) command does not work inside mytt($(...)) or mytt(`...`)
expansions. This is fixed in 3.1.
it() mytt(typeset) handling is non-optimal, particularly with regard to
- flags, and is ksh-incompatible in unpredictable ways.
+ flags, and is ksh-incompatible in unpredictable ways. 3.1.6 has
+ been overhauled, but remaining glitches are to be expected.
it() Nested closures in extended globbing and pattern matching, such as
verb(
[[ fofo = (fo#)# ]]
@@ -1975,7 +1972,7 @@
mytt(compress file) any more. For this reason, mytt(\M-n) and
mytt(\M-p) use tt(history-beginning-search-{forward,backward}) which
search for a line with the same prefix up to the cursor position.
- From 3.1.6, there is likely to be a different implementation which
+ From 3.1.6, there will be a different implementation which
makes this closer (though not identical) to the old behaviour.
The story for the tt({up,down}-line-or-search) commands is similar.
it() In vi insert mode, the cursor keys no longer work. The following
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-06-24 12:41 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-06-24 12:41 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
Changes since issue posted May 1999:
1.5 3.1.6 may appear
1.6 updated list of archive sites; coordinator@zsh.org alias;
new coordinator, alas.
2.1 mention SHARE_HISTORY; deleted item on
$(echo '\$x') difference (can't find this any more); function
definitions aren't local to functions in ksh either, only traps.
3.7 PRINT_EIGHT_BIT will be in 3.0.6
3.24 new: cut-and-paste problems
5.1 xtrace and LINENO will work better in 3.1.6
5.2 no mailing list archive at ftp.sterling.com
5.3 New completion command menu-select for 3.1.6
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.5 is the latest production version, however a test version of
3.0.6 is doing the rounds and should be released soon. 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.
The beta version 3.1.5 is also available, and 3.1.6 should appear over
the summer. 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.
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@zsh.org 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.gmd.de/packages/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/
Japan ftp://ftp.tohoku.ac.jp/mirror/zsh/
ftp://ftp.nisiq.net/pub/shells/zsh/
ftp://ftp.win.ne.jp/pub/shell/zsh/
Norway ftp://ftp.uit.no/pub/unix/shells/zsh/
Romania ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
Slovenia ftp://ftp.siol.net/pub/unix/shells/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://ftp.math.gatech.edu/pub/zsh/
ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/
ftp://ftp.sterling.com/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@microsoft.com>; 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
Likewise the OS/2 port is available from TAMURA Kent
<kent@tril.ibm.co.jp> 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/
2.1: Differences from sh and ksh
Most features of ksh (and hence also of sh) are implemented in zsh;
problems can arise because the implementation is slightly different.
Note also that not all ksh's are the same either. I have based this
on the 11/16/88f version of ksh; differences from ksh93 will be more
substantial.
As a summary of the status:
1) because of all the options it is not safe to assume a general
zsh run by a user will behave as if sh or ksh compatible;
2) invoking zsh as sh or ksh (or if either is a symbolic link to
zsh) sets appropriate options and improves compatibility (from
within zsh itself, calling `ARGV0=sh zsh' will also work);
3) from version 3.0 onward the degree of compatibility with sh
under these circumstances is very high: zsh can now be used
with GNU configure or perl's Configure, for example;
4) the degree of compatibility with ksh is also high, but a few
things are missing: for example the more sophisticated
pattern-matching expressions are different for versions before
3.1.3 --- see the detailed list below;
5) also from 3.0, the command `emulate' is available: `emulate
ksh' and `emulate sh' set various options as well as changing the
effect of single-letter option flags as if the shell had been
invoked with the appropriate name. Including the commands
`emulate sh; setopt localoptions' in a shell function will
turn on sh emulation for that function only.
The classic difference is word splitting, discussed in 3.1; this
catches out very many beginning zsh users. As explained there, this
is actually a bug in every other shell. The answer is to set
SH_WORD_SPLIT for backward compatibility. The next most classic
difference is that unmatched glob patterns cause the command to
abort; set NO_NOMATCH for those.
Here is a list of various options which will increase ksh
compatibility, though maybe decrease zsh's abilities: see the manual
entries for GLOB_SUBST, IGNORE_BRACES (though brace expansion occurs
in some versions of ksh), KSH_ARRAYS, KSH_GLOB, KSH_OPTION_PRINT,
LOCAL_OPTIONS, NO_BAD_PATTERN, NO_BANG_HIST, NO_EQUALS, NO_HUP,
NO_NOMATCH, NO_RCS, NO_SHORT_LOOPS, PROMPT_SUBST, RM_STAR_SILENT,
POSIX_BUILTINS, SH_FILE_EXPANSION, SH_GLOB, SH_OPTION_LETTERS,
SH_WORD_SPLIT (see question 3.1) and SINGLE_LINE_ZLE.
Note that you can also disable any built-in commands which get in
your way. If invoked as `ksh', the shell will try and set suitable
options.
Here are some differences from ksh which might prove significant for
ksh programmers, some of which may be interpreted as bugs; there
must be more. Note that this list is deliberately rather full and
that most of the items are fairly minor. Those marked `*' perform
in a ksh-like manner if the shell is invoked with the name `ksh', or
if `emulate ksh' is in effect. Capitalised words with underlines
refer to shell options.
o Syntax:
o * Shell word splitting: see question 3.1.
o * Arrays are (by default) more csh-like than ksh-like:
subscripts start at 1, not 0; array[0] refers to array[1];
`$array' refers to the whole array, not $array[0];
braces are unnecessary: $a[1] == ${a[1]}, etc.
The KSH_ARRAYS option is now available.
o Coprocesses are established by `coproc'; `|&' behaves like
csh. Handling of coprocess file descriptors is also different.
o In `cmd1 && cmd2 &', only `cmd2' instead of the whole
expression is run in the background in zsh. The manual implies
this is a bug. Use `{ cmd1 && cmd2 } &' as a workaround.
o Command line substitutions, globbing etc.:
o * Failure to match a globbing pattern causes an error (use
NO_NOMATCH).
o * The results of parameter substitutions are treated as plain text:
`foo="*"; print $foo' prints all files in ksh but `*' in zsh
(uset GLOB_SUBST).
o * $PSn do not do parameter substitution by default (use PROMPT_SUBST).
o * Standard globbing does not allow ksh-style `pattern-lists'.
Equivalents:
----------------------------------------------------------------------
ksh zsh Meaning
----- ----- ---------
!(foo) ^foo Anything but foo.
or foo1~foo2 Anything matching foo1 but foo2[1].
@(foo1|foo2|...) (foo1|foo2|...) One of foo1 or foo2 or ...
?(foo) (foo|) Zero or one occurrences of foo.
*(foo) (foo)# Zero or more occurrences of foo.
+(foo) (foo)## One or more occurrences of foo.
----------------------------------------------------------------------
The `^', `~' and `#' (but not `|')forms require EXTENDED_GLOB.
From version 3.1.3, the ksh forms are fully supported when the
option KSH_GLOB is in effect; for previous versions you
must use the table above.
[1] Note that `~' is the only globbing operator to have a lower
precedence than `/'. For example, `**/foo~*bar*' matches any
file in a subdirectory called `foo', except where `bar'
occurred somewhere in the path (e.g. `users/barstaff/foo' will
be excluded by the `~' operator). As the `**' operator cannot
be grouped (inside parentheses it is treated as `*'), this is
the way to exclude some subdirectories from matching a `**'.
o Unquoted assignments do file expansion after `:'s (intended for
PATHs).
o `integer' does not allow `-i'.
o `typeset' and `integer' have special behaviour for
assignments in ksh, but not in zsh. For example, this doesn't
work in zsh:
integer k=$(wc -l ~/.zshrc)
because the return value from wc includes leading
whitespace which causes wordsplitting. Ksh handles the
assignment specially as a single word.
o Command execution:
o * There is no $ENV variable (use /etc/zshrc, ~/.zshrc;
note also $ZDOTDIR).
o $PATH is not searched for commands specified
at invocation without -c.
o Aliases and functions:
o The order in which aliases and functions are defined is significant:
function definitions with () expand aliases -- see question 2.3.
o Aliases and functions cannot be exported.
o There are no tracked aliases: command hashing replaces these.
o The use of aliases for key bindings is replaced by `bindkey'.
o * Options are not local to functions (use LOCAL_OPTIONS; note this
may always be unset locally to propagate options settings from a
function to the calling level).
o Traps and signals:
o * Traps are not local to functions. The option LOCAL_TRAPS will
be available from 3.1.6.
o TRAPERR has become TRAPZERR (this was forced by UNICOS which
has SIGERR).
o Editing:
o The options emacs, gmacs, viraw are not supported.
Use bindkey to change the editing behaviour: `set -o {emacs,vi}'
becomes `bindkey -{e,v}'; for gmacs, go to emacs mode and use
`bindkey \^t gosmacs-transpose-characters'.
o The `keyword' option does not exist and `-k' is instead
interactivecomments. (`keyword' will not be in the next ksh
release either.)
o Management of histories in multiple shells is different:
the history list is not saved and restored after each command.
(The option SHARE_HISTORY will appear in 3.1.6 and will be
set in ksh compatibility mode to remedy this.)
o `\' does not escape editing chars (use `^V').
o Not all ksh bindings are set (e.g. `<ESC>#'; try `<ESC>q').
o * `#' in an interactive shell is not treated as a comment by
default.
o Built-in commands:
o Some built-ins (r, autoload, history, integer ...)
were aliases in ksh.
o There is no built-in command newgrp: use e.g. `alias
newgrp="exec newgrp"'
o `jobs' has no `-n' flag.
o `read' has no `-s' flag.
o Other idiosyncrasies:
o `select' always redisplays the list of selections on each loop.
3.7: How do I make the completion list use eight bit characters?
If you are sure your terminal handles this, the easiest way from versions
3.0.6 and 3.1 of the shell is to set the option PRINT_EIGHT_BIT. In
principle, this will work automatically if your computer uses the
`locale' system and your locale variables are set properly, as zsh
understands this. However, it is quite complicated, so if it isn't
already set up, trying the option is a lot easier. For earlier versions
of zsh 3, you are stuck with trying to understand locales, see the
setlocale(3) and zshparam(1) manual pages: the simplest
possibility may be to set LC_ALL=en_US. For older versions of the
shell, there is no easy way out.
3.24: What's wrong with cut and paste on my xterm?
On the majority of modern UNIX systems, cutting text from one window and
pasting it into another should work fine. On a few, however, there are
problems due to issues about how the terminal is handled: most programs
expect the terminal to be in `canonical input mode', which means that the
program is passed a whole line of input at a time, while for editing
the shell needs a single character at a time and must be in
`non-canonical input mode'. On the systems in question, input can be
lost or re-ordered when the mode changes. There are actually two
slightly different problems:
1) When you paste something in while a programme is running, so that
the shell only retrieves it later. Traditionally, there was a test
which was used only on systems where the problem was known to exist,
so it is possible some other systems were not handled (for example,
certain versions of IRIX, it appears); also, continuation lines were
not handled properly. A more reliable approach will appear in
versions 3.0.6 and 3.1.6.
2) When the shell is waiting for input, and you paste in a chunk of
text consisting of more than one complete set of commands.
Unfortunately, this is a much harder problem: the line editor is
already active, and needs to be turned off when the first command is
executed. The shell doesn't even know if the remaining text is input
to a command or for the shell, so there's simply nothing it can do.
However, if you have problems you can trick it: type `{' on a line
by itself, then paste the input, then type `}' on a line by
itself. The shell will not execute anything until the final brace is
read; all input is read as continuation lines (this may require the
fixes referred to above in order to be reliable).
5.1: What bugs are currently known and unfixed? (Plus recent important changes)
Here are some of the more well-known ones, very roughly in
decreasing order of significance. Many of these can also be counted
against differences from ksh in question 2.1; note that this applies
to the latest beta version and that simple bugs are often fixed
quite quickly. There is a file Etc/BUGS in the source distribution
with more detail.
o `time' is ignored with builtins and can't be used with `{...}'.
o `set -x' (`setopt xtrace') still has a few glitches; these
are mostly fixed in 3.1.6.
o Zsh's notion of the current line number (via $LINENO) is
sometimes not well handled, particularly when using functions and traps.
This should also work reliably from 3.1.6.
o In vi mode, `u' can go past the original modification point.
o The singlelinezle option has problems with prompts containing escapes.
o The `r' command does not work inside `$(...)' or ``...`'
expansions. This is fixed in 3.1.
o `typeset' handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways.
o Nested closures in extended globbing and pattern matching, such as
[[ fofo = (fo#)# ]]
were not correctly handled, and there were problems with
complicated exclusions using `^' or `~'. These
are fixed in version 3.1.3.
Note that a few recent changes introduce incompatibilities (these
are not bugs):
Changes after zsh 3.0 (3.1.x is still currently in beta):
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
(don't do AUTO_LIST if there was an unambiguous prefix that could be
inserted, i.e. only list if it is ambiguous what to insert next) are
now set by default. This is in response to complaints that too many
zsh features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o In 3.1.5, history-search-{forward,backward} only find previous
lines where the first word is the same as the current one. For
example,
comp<ESC>p
will find lines in the history like `comp -edit emacs', but not
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there is likely to be a different implementation which
makes this closer (though not identical) to the old behaviour.
The story for the {up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \
'^[[A' up-line-or-history '^[[B' down-line-or-history
(unless your terminal requires `^[O' instead of `^[['). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
Changes since zsh 2.5:
o The left hand of an assignment is no longer substituted. Thus,
`$1=$2' will not work. You can use something like `eval
"$1=\$2"', which should have the identical effect.
o Signal traps established with the `trap' builtin are now called with
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they
used to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
words if the IGNORE_BRACES option is set.
o The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so `if ( ... ) ...'
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an `if', etc., is less strict
than in other shells.
o `foo=*' does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (`foo=(*)' is and has always been the
consistent way of doing this.)
o <> performs redirection of input and output to the specified file.
For numeric globs, you now need <->.
o The command line qualifiers exec, noglob, command, - are now
treated more like builtin commands: previously they were
syntactically special. This should make it easier to perform
tricks with them (disabling, hiding in parameters, etc.).
o The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
o The current version now uses ~'s for directory stack substitution
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
o The HISTLIT option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
o The `$HISTCHARS' variable is now `$histchars'. Currently both
are tied together for compatibility.
o The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
o Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a %; history is now %!, not
!. Backslashes are no longer special.
5.2: Where do I report bugs, get more info / who's working on zsh?
The shell is being maintained by various (entirely self-appointed)
subscribers to the mailing list,
zsh-workers@sunsite.auc.dk
so mail on any issues (bug reports, suggestions, complaints...)
related to the development of the shell should be sent there. If
you want someone to mail you directly, say so. Most patches to zsh
appear there first.
Note that this location has just changed (January 1999), and the
instructions to go with it are slightly different --- in particular,
if you are already subscribed, the instructions about how to
unsubscribe are different.
Please note when reporting bugs that many exist only on certain
architectures, which the developers may not have access to. In
this case debugging information, as detailed as possible, is
particularly welcome.
Two progressively lower volume lists exist, one with messages
concerning the use of zsh,
zsh-users@sunsite.auc.dk
and one just containing announcements: about releases, about major
changes in the shell, or this FAQ, for example,
zsh-announce@sunsite.auc.dk
(posting to the last one is currently restricted).
Note that you should only join one of these lists: people on
zsh-workers receive all the lists, and people on zsh-users will
also receive the announcements list.
The lists are handled by an automated server. The instructions for
zsh-announce and zsh-users are the same as for zsh-workers: just
change zsh-workers to whatever in the following.
To join zsh-workers, send email to
zsh-workers-subscribe@sunsite.auc.dk
(the actual content is unimportant). Replace subscribe with
unsubscribe to unsubscribe. The mailing software (ezlm) has
various bells and whistles: you can retrieve archived messages.
Mail zsh-workers-help@sunsite.auc.dk for detailed information.
Adminstrative matters are best sent to
zsh-workers-owner@sunsite.auc.dk. The list maintainer's
real name is Karsten Thygesen <karthy@kom.auc.dk>.
An archive of mailings for the last few years can be found at
http://www.zsh.org/mla/
at the main zsh archive in Australia.
Of course, you can also post zsh queries to the Usenet group
comp.unix.shell; if all else fails, you could even e-mail me.
5.3: What's on the wish-list?
With version 3, the code is much cleaner than before, but still
bears the marks of the ages and many things could be done much
better with a rewrite. A more efficient set of code for
lexing/parsing/execution might also be an advantage. Volunteers are
particularly welcome for these tasks.
Here are some things which are definitely happening, and will probably
appear in zsh 3.1.6.
o Even more powerful new completion system, based on shell functions,
allowing much more detailed control both over generation of matches
for completion and how they are inserted and displayed. A set of
functions which work `out of the box' will be available, including
many functions for external commands: files in tar archives can
be listed for extraction as if they were real files; GNU commands
which accept the `--help' option can generate completion lists for
themselves on the fly, etc., etc.
You can have old-style compctl-based completions for some commands,
and new-style ones for others; you can bind particular completion
commands of your own definition to key-strokes.
o Other completion enhancements: matching control, allowing
case-insensitive matching and wild card anchors, e.g. `z_t<TAB>'
can allow a wildcard before the `_' so that this will expand
to `zle_tricky.c' --- all under user control; completions can
be grouped; a new completion command, menu-select, allows real menu
selection --- you can move the cursor around to choose a completion.
o Case-insensitive and approximate matching in the globbing code:
for example, `(#ia2)readme' matches the string `readme'
case-insensitively with up to two errors, such as README,
READ.ME, _README_, Read!Me!. The new completion system
knows about these, allowing correcting completion, e.g.
`mkaef<TAB>' can be made to complete to `Makefile'.
o Associative arrays, declared with `typeset -A aname'; syntax
for creating, accessing and deleting elements of these.
o Users can create their own foopath/FOOPATH array/path
combinations, just like path and PATH.
o A dynamically loadable library for FTP, complete with a suite of
functions to make it easy to use. This allows you to use the shell's
capabilities for scripting, line editing, completion, I/O redirection,
directory management etc. within an FTP session.
Other future possibilities which have been suggested:
o Further improvements in integrating the line editor with shell
functions.
o Ksh compatibility could be improved.
o Option for glob qualifiers to follow perl syntax (a traditional item).
--- 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.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- zshfaq.yo 1999/05/24 10:07:31 1.42
+++ zshfaq.yo 1999/06/24 12:57:34 1.43
@@ -49,20 +49,24 @@
mydit(Archive-Name:) unix-faq/shell/zsh
mydit(Last-Modified:) 1999/05/24
mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
-mydit(Version:) $Id: zshfaq.yo,v 1.42 1999/05/24 10:07:31 pws Exp $
+mydit(Version:) $Id: zshfaq.yo,v 1.43 1999/06/24 12:57:34 pws Exp $
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--1999 (see end of document)
)
-bf(Changes since issue posted April 1999:)
+bf(Changes since issue posted May 1999:)
description(
-mydit(*.*) Orthography for option names standardised.
-mydit(1.4) don't change config.h.in, change acconfig.h
-mydit(1.6) email zefram@zsh.org
-mydit(2.4) new widget version of tcsh run-fg-editor
-mydit(3.7) should have mentioned tt(PRINT_EIGHT_BIT) is new in 3.1
-mydit(3.23) new: describe tt(PROMPT_CR) option.
-mydit(5.1) Description of tt(LIST_AMBIGUOUS) corrected.
+mydit(1.5) 3.1.6 may appear
+mydit(1.6) updated list of archive sites; coordinator@zsh.org alias;
+ new coordinator, alas.
+mydit(2.1) mention tt(SHARE_HISTORY); deleted item on
+ tt($(echo '\$x')) difference (can't find this any more); function
+ definitions aren't local to functions in ksh either, only traps.
+mydit(3.7) tt(PRINT_EIGHT_BIT) will be in 3.0.6
+mydit(3.24) new: cut-and-paste problems
+mydit(5.1) xtrace and LINENO will work better in 3.1.6
+mydit(5.2) no mailing list archive at ftp.sterling.com
+mydit(5.3) New completion command menu-select for 3.1.6
)
This document contains a list of frequently-asked (or otherwise
@@ -125,6 +129,7 @@
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?
Chapter 4: The mysteries of completion
4.1. What is completion?
@@ -309,11 +314,11 @@
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.5 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.
+ The beta version 3.1.5 is also available, and 3.1.6 should appear over
+ the summer. 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.
Note also that as the shell changes, it may become incompatible with
older versions; see the end of question link(5.1)(51) for a partial list.
@@ -326,17 +331,20 @@
sect(Where do I get it?)
label(16)
- The archive is now run by email(Andrew Main <zefram@zsh.org>).
- The following are known mirrors (kept frequently up to date); the
+ The coordinator of development is currently me; the alias
+ email(coordinator@zsh.org) 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 url(http://www.zsh.org)(http://www.zsh.org) .
+ 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
+ url(http://www.zsh.org)(http://www.zsh.org) .
description(
mydit(Home site) url(ftp://ftp.zsh.org)(ftp://ftp.zsh.org)
+ mydit() url(http://www.zsh.org/pub/zsh/)
+(http://www.zsh.org/pub/zsh/)
mydit(Australia) url(ftp://ftp.ips.gov.au/mirror/zsh/)
(ftp://ftp.ips.gov.au/mirror/zsh/)
mydit(Denmark) url(ftp://sunsite.auc.dk/pub/unix/shells/zsh)
@@ -354,7 +362,9 @@
mydit(Hungary) url(ftp://ftp.cs.elte.hu/pub/zsh/)
(ftp://ftp.cs.elte.hu/pub/zsh/)
mydit() (also url(http://www.cs.elte.hu/pub/zsh/)
- (http://www.cs.elte.hu/pub/zsh/) )
+(http://www.cs.elte.hu/pub/zsh/) )
+ mydit() url(ftp://ftp.kfki.hu/pub/packages/zsh/)
+(ftp://ftp.kfki.hu/pub/packages/zsh/)
mydit(Israel) \
url(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
@@ -363,7 +373,7 @@
(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
mydit(Japan) url(ftp://ftp.tohoku.ac.jp/mirror/zsh/)
(ftp://ftp.tohoku.ac.jp/mirror/zsh/)
- mydit() url(ftp://ftp.nis.co.jp/pub/shells/zsh/)
+ mydit() url(ftp://ftp.nisiq.net/pub/shells/zsh/)
(ftp://ftp.nis.co.jp/pub/shells/zsh/)
mydit() url(ftp://ftp.win.ne.jp/pub/shell/zsh/)
(ftp://ftp.win.ne.jp/pub/shell/zsh/)
@@ -378,8 +388,8 @@
mydit(UK) url(ftp://ftp.net.lut.ac.uk/zsh/)
(ftp://ftp.net.lut.ac.uk/zsh/)
mydit() (also by FSP at port 21)
- mydit() url(ftp://src.doc.ic.ac.uk/packages/unix/shells/zsh/)
-(ftp://src.doc.ic.ac.uk/packages/unix/shells/zsh/)
+ mydit() url(ftp://sunsite.org.uk/packages/zsh/)
+(ftp://sunsite.org.uk/packages/zsh/)
mydit(USA) url(ftp://ftp.math.gatech.edu/pub/zsh/)
(ftp://ftp.math.gatech.edu/pub/zsh/)
mydit() url(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
@@ -388,6 +398,10 @@
(ftp://ftp.sterling.com/zsh/)
mydit() url(ftp://ftp.rge.com/pub/shells/zsh/)
(ftp://ftp.rge.com/pub/shells/zsh/)
+ mydit() url(ftp://foad.org/pub/zsh/)
+(ftp://foad.org/pub/zsh/)
+ mydit() url(http://foad.org/zsh/)
+(http://foad.org/zsh/)
)
The Windows port mentioned above is maintained separately by email(Amol
@@ -464,7 +478,6 @@
endif
)
-
It's not a good idea to put this (even without the -l) into .cshrc,
at least without some tests on what the csh is supposed to be doing,
as that will cause _every_ instance of csh to turn into a zsh and
@@ -577,10 +590,6 @@
it()* The results of parameter substitutions are treated as plain text:
mytt(foo="*"; print $foo) prints all files in ksh but mytt(*) in zsh
(uset tt(GLOB_SUBST)).
- it() The backslash in tt($(echo '\$x')) is treated differently: in \
-ksh, it
- is not stripped, in zsh it is. (The tt(`...`) form gives the same in
- both shells.)
it()* tt($PSn) do not do parameter substitution by default (use \
PROMPT_SUBST).
it()* Standard globbing does not allow ksh-style `pattern-lists'.
@@ -641,11 +650,11 @@
it()* Options are not local to functions (use LOCAL_OPTIONS; note this
may always be unset locally to propagate options settings from a
function to the calling level).
- it() Function definitions themselves are not local to functions.
)
it() Traps and signals:
itemize(
- it() Traps are not local to functions.
+ it()* Traps are not local to functions. The option LOCAL_TRAPS will
+ be available from 3.1.6.
it() TRAPERR has become TRAPZERR (this was forced by UNICOS which
has SIGERR).
)
@@ -660,6 +669,8 @@
release either.)
it() Management of histories in multiple shells is different:
the history list is not saved and restored after each command.
+ (The option tt(SHARE_HISTORY) will appear in 3.1.6 and will be
+ set in ksh compatibility mode to remedy this.)
it() mytt(\) does not escape editing chars (use mytt(^V)).
it() Not all ksh bindings are set (e.g. mytt(<ESC>#); try mytt(<ESC>q)).
it()* mytt(#) in an interactive shell is not treated as a comment by
@@ -1155,15 +1166,16 @@
sect(How do I make the completion list use eight bit characters?)
- If you are sure your terminal handles this, the easiest way from version
- 3.1 of the shell is to set the option tt(PRINT_EIGHT_BIT). In principle,
- this will work automatically if your computer uses the `locale' system
- and your locale variables are set properly, as zsh understands this.
- However, it is quite complicated, so if it isn't already set up, trying
- the option is a lot easier. For 3.0, you are stuck with trying to
- understand locales, see the tt(setlocale(3)) and tt(zshparam(1)) manual
- pages: the simplest possibility may be to set tt(LC_ALL=en_US). For older
- versions of the shell, there is no easy way out.
+ If you are sure your terminal handles this, the easiest way from versions
+ 3.0.6 and 3.1 of the shell is to set the option tt(PRINT_EIGHT_BIT). In
+ principle, this will work automatically if your computer uses the
+ `locale' system and your locale variables are set properly, as zsh
+ understands this. However, it is quite complicated, so if it isn't
+ already set up, trying the option is a lot easier. For earlier versions
+ of zsh 3, you are stuck with trying to understand locales, see the
+ tt(setlocale(3)) and tt(zshparam(1)) manual pages: the simplest
+ possibility may be to set tt(LC_ALL=en_US). For older versions of the
+ shell, there is no easy way out.
sect(Why do the cursor (arrow) keys not work?)
@@ -1538,8 +1550,8 @@
)
produces the same result.
- Future versions of zsh will probably allow you to do this directly,
- with a new flag; mytt(${(P)E}).
+ Versions 3.1.6 of zsh will allow you to do this directly with a new flag;
+ mytt(${(P)E}).
As a slight aside, sometimes people note that the syntax mytt(${${E}})
is valid and expect it to have this effect. It probably ought to, but
@@ -1569,6 +1581,39 @@
prompt (see question link(3.13)(313) for that).
+sect(What's wrong with cut and paste on my xterm?)
+
+ On the majority of modern UNIX systems, cutting text from one window and
+ pasting it into another should work fine. On a few, however, there are
+ problems due to issues about how the terminal is handled: most programs
+ expect the terminal to be in `canonical input mode', which means that the
+ program is passed a whole line of input at a time, while for editing
+ the shell needs a single character at a time and must be in
+ `non-canonical input mode'. On the systems in question, input can be
+ lost or re-ordered when the mode changes. There are actually two
+ slightly different problems:
+ enumerate(
+ myeit() When you paste something in while a programme is running, so that
+ the shell only retrieves it later. Traditionally, there was a test
+ which was used only on systems where the problem was known to exist,
+ so it is possible some other systems were not handled (for example,
+ certain versions of IRIX, it appears); also, continuation lines were
+ not handled properly. A more reliable approach will appear in
+ versions 3.0.6 and 3.1.6.
+ myeit() When the shell is waiting for input, and you paste in a chunk of
+ text consisting of more than one complete set of commands.
+ Unfortunately, this is a much harder problem: the line editor is
+ already active, and needs to be turned off when the first command is
+ executed. The shell doesn't even know if the remaining text is input
+ to a command or for the shell, so there's simply nothing it can do.
+ However, if you have problems you can trick it: type `tt({)' on a line
+ by itself, then paste the input, then type `tt(})' on a line by
+ itself. The shell will not execute anything until the final brace is
+ read; all input is read as continuation lines (this may require the
+ fixes referred to above in order to be reliable).
+ )
+
+
chapter(The mysteries of completion)
Programmable completion using the `compctl' command is one of the most
@@ -1673,7 +1718,7 @@
flexibility for what it does here via its options. The default is
for it to beep and completion to stop until you type another
character. You can type tt(\C-D) to see all the possible completions.
- (That's assuming your at the end of the line, otherwise tt(\C-D) will
+ (That's assuming you're at the end of the line, otherwise tt(\C-D) will
delete the next character and you have to use tt(ESC-\C-D).) This can be
changed by the following options, among others:
itemize(
@@ -1887,13 +1932,15 @@
itemize(
it() mytt(time) is ignored with builtins and can't be used with mytt({...}).
- it() mytt(set -x) (mytt(setopt xtrace)) still has a few glitches.
+ it() mytt(set -x) (mytt(setopt xtrace)) still has a few glitches; these
+ are mostly fixed in 3.1.6.
it() Zsh's notion of the current line number (via tt($LINENO)) is
sometimes not well handled, particularly when using functions and traps.
+ This should also work reliably from 3.1.6.
it() In vi mode, mytt(u) can go past the original modification point.
it() The singlelinezle option has problems with prompts containing escapes.
it() The mytt(r) command does not work inside mytt($(...)) or mytt(`...`)
- expansions. (This is fixed in 3.1.)
+ expansions. This is fixed in 3.1.
it() mytt(typeset) handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways.
it() Nested closures in extended globbing and pattern matching, such as
@@ -1901,8 +1948,8 @@
[[ fofo = (fo#)# ]]
)
were not correctly handled, and there were problems with
- complicated exclusions using mytt(^) or mytt(~). (These
- are fixed in version 3.1.3.)
+ complicated exclusions using mytt(^) or mytt(~). These
+ are fixed in version 3.1.3.
)
Note that a few recent changes introduce incompatibilities (these
@@ -1918,7 +1965,7 @@
zsh features are never noticed by many users. To turn them off,
just put mytt(unsetopt alwayslastprompt listambiguous) in your
tt(.zshrc) file.
- it() tt(history-search-{forward,backward}) now only find previous
+ it() In 3.1.5, tt(history-search-{forward,backward}) only find previous
lines where the first word is the same as the current one. For
example,
verb(
@@ -2051,11 +2098,7 @@
email(zsh-workers-owner@sunsite.auc.dk). The list maintainer's
real name is email(Karsten Thygesen <karthy@kom.auc.dk>).
- The list from May 1992 to May 1995 is archived in
- url(ftp://ftp.sterling.com/zsh/zsh-list/YY-MM)
-(ftp://ftp.sterling.com/zsh/zsh-list/YY-MM)
- where YY-MM are the year and month in digits. More recent
- mailings up to date are to be found at
+ An archive of mailings for the last few years can be found at
url(http://www.zsh.org/mla/)(http://www.zsh.org/mla/)
at the main zsh archive in Australia.
@@ -2089,7 +2132,8 @@
case-insensitive matching and wild card anchors, e.g. mytt(z_t<TAB>)
can allow a wildcard before the mytt(_) so that this will expand
to mytt(zle_tricky.c) --- all under user control; completions can
- be grouped.
+ be grouped; a new completion command, menu-select, allows real menu
+ selection --- you can move the cursor around to choose a completion.
it() Case-insensitive and approximate matching in the globbing code:
for example, mytt((#ia2)readme) matches the string mytt(readme)
case-insensitively with up to two errors, such as tt(README),
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-05-24 9:42 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-05-24 9:42 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
Changes since issue posted April 1999:
*.* Orthography for option names standardised.
1.4 don't change config.h.in, change acconfig.h
1.6 email zefram@zsh.org
2.4 new widget version of tcsh run-fg-editor
3.23 new: describe PROMPT_CR option.
3.7 should have mentioned PRINT_EIGHT_BIT is new in 3.1
5.1 Description of LIST_AMBIGUOUS corrected.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.4: On what machines will it run?
From version 3.0, zsh uses GNU autoconf as the installation
mechanism. This considerably increases flexibility over the old
`buildzsh' mechanism. Consequently, zsh should compile and run on
any modern version of UNIX, and a great many not-so-modern versions
too. The file Etc/MACHINES in the distribution has more details.
There are also now separate ports for Windows and OS/2, see `Where
do I get it' below.
If you need to change something to support a new machine, it would be
appreciated if you could add any necessary preprocessor code and
alter configure.in and acconfig.h to configure zsh automatically,
then send the required context diffs to the list (see question
5.2). Changes based on version 2.5 are very unlikely to
be useful.
To get it to work, retrieve the source distribution (see question
1.6), un-gzip it, un-tar it and read the INSTALL file in the top
directory. Also read the Etc/MACHINES file for up-to-date
information on compilation on certain architectures.
*Note for users of nawk* (The following information comes from Zoltan
Hidvegi): On some systems nawk is broken and produces an incorrect
signames.h file. This makes the signals code unusable. This often happens
on Ultrix, HP-UX, IRIX (?). Install gawk if you experience such problems.
1.6: Where do I get it?
The archive is now run by Andrew Main <zefram@zsh.org>.
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
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.gmd.de/packages/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/ )
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/
Japan ftp://ftp.tohoku.ac.jp/mirror/zsh/
ftp://ftp.nis.co.jp/pub/shells/zsh/
ftp://ftp.win.ne.jp/pub/shell/zsh/
Norway ftp://ftp.uit.no/pub/unix/shells/zsh/
Romania ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
Slovenia ftp://ftp.siol.net/pub/unix/shells/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://src.doc.ic.ac.uk/packages/unix/shells/zsh/
USA ftp://ftp.math.gatech.edu/pub/zsh/
ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/
ftp://ftp.sterling.com/zsh/
ftp://ftp.rge.com/pub/shells/zsh/
The Windows port mentioned above is maintained separately by Amol
Deshpande <amold@microsoft.com>; 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
Likewise the OS/2 port is available from TAMURA Kent
<kent@tril.ibm.co.jp> 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/
2.4: Similarities with tcsh
(The sections on csh apply too, of course.) Certain features have
been borrowed from tcsh, including $watch, run-help, $savehist,
$histlit, periodic commands etc., extended prompts, sched
and which built-ins. Programmable completion was inspired by,
but is entirely different to, tcsh's `complete'. (There is a perl
script called lete2ctl in the Misc directory of the source
distribution to convert `complete' to `compctl' statements.)
This list is not definitive: some features have gone in the other
direction.
If you're missing the editor function run-fg-editor, try something
with `bindkey -s' (which binds a string to a keystroke), e.g.
bindkey -s '^z' '\eqfg %$EDITOR:t\n'
which pushes the current line onto the stack and tries to bring a job
with the basename of your editor into the foreground. `bindkey -s'
allows limitless possibilities along these lines. You can execute
any command in the middle of editing a line in the same way,
corresponding to tcsh's `-c' option:
bindkey -s '^p' '\eqpwd\n'
In both these examples, the `\eq' saves the current input line to
be restored after the command runs; a better effect with multiline
buffers is achieved if you also have
bindkey '\eq' push-input
to save the entire buffer. In recent versions of zsh 3.1, you have
the following more sophisticated option,
run-fg-editor() {
zle push-input
BUFFER="fg %$EDITOR:t"
zle accept-line
}
zle -N run-fg-editor
and can now bind run-fg-editor just like any other editor function.
3.7: How do I make the completion list use eight bit characters?
If you are sure your terminal handles this, the easiest way from version
3.1 of the shell is to set the option PRINT_EIGHT_BIT. In principle,
this will work automatically if your computer uses the `locale' system
and your locale variables are set properly, as zsh understands this.
However, it is quite complicated, so if it isn't already set up, trying
the option is a lot easier. For 3.0, you are stuck with trying to
understand locales, see the setlocale(3) and zshparam(1) manual
pages: the simplest possibility may be to set LC_ALL=en_US. For older
versions of the shell, there is no easy way out.
3.23: How do I prevent the prompt overwriting output when there is no newline?
The problem is, for example,
% echo -n foo
%
and the foo has been overwritten by the prompt %. The answer is
simple: put unsetopt promptcr in your .zshrc. The option PROMPT_CR,
to print a carriage return before a new prompt, is set by default because
a prompt at the right hand side (`$RPROMPT', `$RPS1') will not appear
in the right place, and multi-line editing will be confused about the line
position, unless the line starts in the left hand column. Apart from
PROMPT_CR, you can force this to happen by putting a newline in the
prompt (see question 3.13 for that).
5.1: What bugs are currently known and unfixed? (Plus recent important changes)
Here are some of the more well-known ones, very roughly in
decreasing order of significance. Many of these can also be counted
against differences from ksh in question 2.1; note that this applies
to the latest beta version and that simple bugs are often fixed
quite quickly. There is a file Etc/BUGS in the source distribution
with more detail.
o `time' is ignored with builtins and can't be used with `{...}'.
o `set -x' (`setopt xtrace') still has a few glitches.
o Zsh's notion of the current line number (via $LINENO) is
sometimes not well handled, particularly when using functions and traps.
o In vi mode, `u' can go past the original modification point.
o The singlelinezle option has problems with prompts containing escapes.
o The `r' command does not work inside `$(...)' or ``...`'
expansions. (This is fixed in 3.1.)
o `typeset' handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways.
o Nested closures in extended globbing and pattern matching, such as
[[ fofo = (fo#)# ]]
were not correctly handled, and there were problems with
complicated exclusions using `^' or `~'. (These
are fixed in version 3.1.3.)
Note that a few recent changes introduce incompatibilities (these
are not bugs):
Changes after zsh 3.0 (3.1.x is still currently in beta):
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
(don't do AUTO_LIST if there was an unambiguous prefix that could be
inserted, i.e. only list if it is ambiguous what to insert next) are
now set by default. This is in response to complaints that too many
zsh features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o history-search-{forward,backward} now only find previous
lines where the first word is the same as the current one. For
example,
comp<ESC>p
will find lines in the history like `comp -edit emacs', but not
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there is likely to be a different implementation which
makes this closer (though not identical) to the old behaviour.
The story for the {up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \
'^[[A' up-line-or-history '^[[B' down-line-or-history
(unless your terminal requires `^[O' instead of `^[['). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
Changes since zsh 2.5:
o The left hand of an assignment is no longer substituted. Thus,
`$1=$2' will not work. You can use something like `eval
"$1=\$2"', which should have the identical effect.
o Signal traps established with the `trap' builtin are now called with
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they
used to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
words if the IGNORE_BRACES option is set.
o The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so `if ( ... ) ...'
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an `if', etc., is less strict
than in other shells.
o `foo=*' does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (`foo=(*)' is and has always been the
consistent way of doing this.)
o <> performs redirection of input and output to the specified file.
For numeric globs, you now need <->.
o The command line qualifiers exec, noglob, command, - are now
treated more like builtin commands: previously they were
syntactically special. This should make it easier to perform
tricks with them (disabling, hiding in parameters, etc.).
o The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
o The current version now uses ~'s for directory stack substitution
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
o The HISTLIT option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
o The `$HISTCHARS' variable is now `$histchars'. Currently both
are tied together for compatibility.
o The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
o Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a %; history is now %!, not
!. Backslashes are no longer special.
--- End of changed items, diff from previous version follows ---
Index: zshfaq.txt
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.txt,v
retrieving revision 1.13
retrieving revision 1.15
diff -u -r1.13 -r1.15
--- zshfaq.txt 1999/04/23 12:00:30 1.13
+++ zshfaq.txt 1999/05/24 10:07:31 1.15
@@ -1,15 +1,20 @@
Archive-Name: unix-faq/shell/zsh
-Last-Modified: 1999/04/23
+Last-Modified: 1999/05/24
Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
-Version: $Id: zshfaq.txt,v 1.13 1999/04/23 12:00:30 pws Exp $
+Version: $Id: zshfaq.txt,v 1.15 1999/05/24 10:07:31 pws Exp $
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995--1999 (see end of document)
-Changes since issue posted March 1999:
+Changes since issue posted April 1999:
-1.5 Mention 3.0.6 should appear soon
-5.1 Update on history-search-backward saga
+*.* Orthography for option names standardised.
+1.4 don't change config.h.in, change acconfig.h
+1.6 email zefram@zsh.org
+2.4 new widget version of tcsh run-fg-editor
+3.7 should have mentioned PRINT_EIGHT_BIT is new in 3.1
+3.23 new: describe PROMPT_CR option.
+5.1 Description of LIST_AMBIGUOUS corrected.
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
@@ -69,6 +74,7 @@
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?
Chapter 4: The mysteries of completion
4.1. What is completion?
@@ -209,7 +215,7 @@
If you need to change something to support a new machine, it would be
appreciated if you could add any necessary preprocessor code and
- alter configure.in and config.h.in to configure zsh automatically,
+ alter configure.in and acconfig.h to configure zsh automatically,
then send the required context diffs to the list (see question
5.2). Changes based on version 2.5 are very unlikely to
be useful.
@@ -249,7 +255,7 @@
1.6: Where do I get it?
- The archive is now run by Andrew Main <zefram@tao.co.uk>.
+ The archive is now run by Andrew Main <zefram@zsh.org>.
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
@@ -452,8 +458,8 @@
o * Failure to match a globbing pattern causes an error (use
NO_NOMATCH).
o * The results of parameter substitutions are treated as plain text:
- `foo="*"; print $foo' prints all files in ksh but `*' in zsh.
- (GLOB_SUBST has been added to fix this.)
+ `foo="*"; print $foo' prints all files in ksh but `*' in zsh
+ (uset GLOB_SUBST).
o The backslash in $(echo '\$x') is treated differently: in ksh, it
is not stripped, in zsh it is. (The `...` form gives the same in
both shells.)
@@ -644,7 +650,7 @@
heavy csh alias junkies:
5) Mapping from csh alias "parameter referencing" into zsh function
- (assuming shwordsplit and ksharrays are NOT set in zsh):
+ (assuming SH_WORD_SPLIT and KSH_ARRAYS are NOT set in zsh):
csh zsh
===== ==========
@@ -723,8 +729,18 @@
bindkey '\eq' push-input
- to save the entire buffer.
+ to save the entire buffer. In recent versions of zsh 3.1, you have
+ the following more sophisticated option,
+ run-fg-editor() {
+ zle push-input
+ BUFFER="fg %$EDITOR:t"
+ zle accept-line
+ }
+ zle -N run-fg-editor
+
+ and can now bind run-fg-editor just like any other editor function.
+
2.5: Similarities with bash
The Bourne-Again Shell, bash, is another enhanced Bourne-like shell;
@@ -770,8 +786,8 @@
are split into words when passed to a command or used in a `for foo in
$var' loop. By default, zsh does not have that behaviour: the
- variable remains intact. (This is not a bug! See below.) An option
- (SHWORDSPLIT) exists to provide compatibility.
+ variable remains intact. (This is not a bug! See below.) The option
+ SH_WORD_SPLIT exists to provide compatibility.
For example, defining the function args to show the number of its
arguments:
@@ -805,7 +821,7 @@
args $array
- produces the output `4', regardless of the setting of SHWORDSPLIT.
+ produces the output `4', regardless of the setting of SH_WORD_SPLIT.
Arrays are also much more versatile than single strings. Probably
if this mechanism had always been available there would never have
been automatic word splitting in scalars, which is a sort of
@@ -824,22 +840,22 @@
after which $words is an array with the words of $sentence (note
characters special to the shell, such as the `'' in this example,
must already be quoted), or, less standard but more reliable,
- turning on SHWORDSPLIT for one variable only:
+ turning on SH_WORD_SPLIT for one variable only:
args ${=sentence}
always returns 8 with the above definition of `args'. (In older
- versions of zsh, ${=foo} toggled SHWORDSPLIT; now it forces it on.)
+ versions of zsh, ${=foo} toggled SH_WORD_SPLIT; now it forces it on.)
Note also the "$@" method of word splitting is always available in zsh
functions and scripts (though strictly this does array splitting, not
word splitting). This is more portable than the $*, since it
- will work regardless of the SHWORDSPLIT setting; the other
+ will work regardless of the SH_WORD_SPLIT setting; the other
difference is that $* removes empty arguments from the array.
You can fix the first half of that objection by using ${==*},
- which turns off SHWORDSPLIT for the duration of the expansion.
+ which turns off SH_WORD_SPLIT for the duration of the expansion.
- SHWORDSPLIT is set when zsh is invoked with the names `ksh' or `sh',
+ SH_WORD_SPLIT is set when zsh is invoked with the names `ksh' or `sh',
or (entirely equivalent) when `emulate ksh' or `emulate sh' is in
effect.
@@ -986,12 +1002,15 @@
3.7: How do I make the completion list use eight bit characters?
- If you are sure your terminal handles this, the easiest way is to
- set the option PRINT_EIGHT_BIT. In principle, this will work
- automatically if your computer uses the `locale' system and your
- locale variables are set properly, as zsh understands this.
- However, it is quite complicated, so if it isn't already set up,
- trying the option is a lot easier.
+ If you are sure your terminal handles this, the easiest way from version
+ 3.1 of the shell is to set the option PRINT_EIGHT_BIT. In principle,
+ this will work automatically if your computer uses the `locale' system
+ and your locale variables are set properly, as zsh understands this.
+ However, it is quite complicated, so if it isn't already set up, trying
+ the option is a lot easier. For 3.0, you are stuck with trying to
+ understand locales, see the setlocale(3) and zshparam(1) manual
+ pages: the simplest possibility may be to set LC_ALL=en_US. For older
+ versions of the shell, there is no easy way out.
3.8: Why do the cursor (arrow) keys not work?
@@ -1115,7 +1134,7 @@
incompatible with the old zsh behaviour which allowed you to
redefine the function when you called it.
- From version 3.1, there is an option KSHAUTOLOAD to allow full ksh
+ From version 3.1, there is an option KSH_AUTOLOAD to allow full ksh
compatiblity, i.e. the function _must_ be in the second form
above. If that is not set, zsh tries to guess which form you are
using: if the file contains only a complete definition of the
@@ -1354,6 +1373,22 @@
it, this works). So in `${${E}}', the internal `${...}'
actually does nothing.
+3.23: How do I prevent the prompt overwriting output when there is no newline?
+
+ The problem is, for example,
+
+ % echo -n foo
+ %
+
+ and the foo has been overwritten by the prompt %. The answer is
+ simple: put unsetopt promptcr in your .zshrc. The option PROMPT_CR,
+ to print a carriage return before a new prompt, is set by default because
+ a prompt at the right hand side (`$RPROMPT', `$RPS1') will not appear
+ in the right place, and multi-line editing will be confused about the line
+ position, unless the line starts in the left hand column. Apart from
+ PROMPT_CR, you can force this to happen by putting a newline in the
+ prompt (see question 3.13 for that).
+
Chapter 4: The mysteries of completion
Programmable completion using the `compctl' command is one of the most
@@ -1459,25 +1494,26 @@
delete the next character and you have to use ESC-\C-D.) This can be
changed by the following options, among others:
- o with nobeep set, that annoying beep goes away
- o with nolistbeep, beeping is only turned off for ambiguous completions
- o with autolist set, when the completion is ambiguous you get a
+ o with NO_BEEP set, that annoying beep goes away
+ o with NO_LIST_BEEP, beeping is only turned off for ambiguous
+ completions
+ o with AUTO_LIST set, when the completion is ambiguous you get a
list without having to type \C-D
- o with listambigous, this is modified so that nothing is listed if
+ o with LIST_AMBIGOUS, this is modified so that nothing is listed if
there is an unambiguous prefix or suffix to be inserted
- o with menucomplete set, one completion is always inserted
+ o with MENU_COMPLETE set, one completion is always inserted
completely, then when you hit TAB it changes to the next, and so
on until you get back to where you started
- o with automenu, you only get the menu behaviour when you hit TAB
+ o with AUTO_MENU, you only get the menu behaviour when you hit TAB
again on the ambiguous completion.
o Finally, although it affects all completion lists, including
- those explicitly requested, note also alwayslastprompt, which
+ those explicitly requested, note also ALWAYS_LAST_PROMPT, which
causes the cursor to return to the line you were editing after
printing the list, provided that is short enough.
- Combinations of these are possible; for example, autolist and
- automenu together give an intuitive combination. Note that
- from version 3.1 listambiguous is set by default; if you use
+ Combinations of these are possible; for example, AUTO_LIST and
+ AUTO_MENU together give an intuitive combination. Note that
+ from version 3.1 LIST_AMBIGUOUS is set by default; if you use
autolist, you may well want to `unsetopt listambiguous'.
4.4: How do I complete in the middle of words / just what's before the cursor?
@@ -1680,9 +1716,10 @@
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
- (show matching files when there are several) are now set by
- default. This is in response to complaints that too many zsh
- features are never noticed by many users. To turn them off,
+ (don't do AUTO_LIST if there was an unambiguous prefix that could be
+ inserted, i.e. only list if it is ambiguous what to insert next) are
+ now set by default. This is in response to complaints that too many
+ zsh features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o history-search-{forward,backward} now only find previous
@@ -1717,8 +1754,8 @@
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
- o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they used
- to be the other way around. (Use of names rather than letters is
+ o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they
+ used to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
@@ -1744,7 +1781,7 @@
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
- o The `HISTLIT' option was broken in various ways and has been removed:
+ o The HISTLIT option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-04-23 11:49 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-04-23 11:49 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
Changes since issue posted March 1999:
1.5 Mention 3.0.6 should appear soon
5.1 Update on history-search-backward saga
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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.5 is the latest production version, however a test version of
3.0.6 is doing the rounds and should be released soon. 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.
The beta version 3.1.5 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.
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.
5.1: What bugs are currently known and unfixed? (Plus recent important changes)
Here are some of the more well-known ones, very roughly in
decreasing order of significance. Many of these can also be counted
against differences from ksh in question 2.1; note that this applies
to the latest beta version and that simple bugs are often fixed
quite quickly. There is a file Etc/BUGS in the source distribution
with more detail.
o `time' is ignored with builtins and can't be used with `{...}'.
o `set -x' (`setopt xtrace') still has a few glitches.
o Zsh's notion of the current line number (via $LINENO) is
sometimes not well handled, particularly when using functions and traps.
o In vi mode, `u' can go past the original modification point.
o The singlelinezle option has problems with prompts containing escapes.
o The `r' command does not work inside `$(...)' or ``...`'
expansions. (This is fixed in 3.1.)
o `typeset' handling is non-optimal, particularly with regard to
flags, and is ksh-incompatible in unpredictable ways.
o Nested closures in extended globbing and pattern matching, such as
[[ fofo = (fo#)# ]]
were not correctly handled, and there were problems with
complicated exclusions using `^' or `~'. (These
are fixed in version 3.1.3.)
Note that a few recent changes introduce incompatibilities (these
are not bugs):
Changes after zsh 3.0 (3.1.x is still currently in beta):
o The options ALWAYS_LAST_PROMPT (return to the line you were
editing after displaying completion lists) and LIST_AMBIGUOUS
(show matching files when there are several) are now set by
default. This is in response to complaints that too many zsh
features are never noticed by many users. To turn them off,
just put `unsetopt alwayslastprompt listambiguous' in your
.zshrc file.
o history-search-{forward,backward} now only find previous
lines where the first word is the same as the current one. For
example,
comp<ESC>p
will find lines in the history like `comp -edit emacs', but not
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
From 3.1.6, there is likely to be a different implementation which
makes this closer (though not identical) to the old behaviour.
The story for the {up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \
'^[[A' up-line-or-history '^[[B' down-line-or-history
(unless your terminal requires `^[O' instead of `^[['). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
Changes since zsh 2.5:
o The left hand of an assignment is no longer substituted. Thus,
`$1=$2' will not work. You can use something like `eval
"$1=\$2"', which should have the identical effect.
o Signal traps established with the `trap' builtin are now called with
the environment of the caller, as in ksh, instead of as a new
function level. Traps established as functions (e.g. `TRAPINT()
{...}') work as before.
o The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they used
to be the other way around. (Use of names rather than letters is
generally recommended.)
o `[[' is a reserved word, hence must be separated from
other characters by whitespace; `{' and `}' are also reserved
words if the IGNORE_BRACES option is set.
o The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so `if ( ... ) ...'
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an `if', etc., is less strict
than in other shells.
o `foo=*' does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (`foo=(*)' is and has always been the
consistent way of doing this.)
o <> performs redirection of input and output to the specified file.
For numeric globs, you now need <->.
o The command line qualifiers exec, noglob, command, - are now
treated more like builtin commands: previously they were
syntactically special. This should make it easier to perform
tricks with them (disabling, hiding in parameters, etc.).
o The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
o The current version now uses ~'s for directory stack substitution
instead of ='s. This is for consistency: all other directory
substitution (~user, ~name, ~+, ...) used a tilde, while
=<number> caused problems with =program substitution.
o The `HISTLIT' option was broken in various ways and has been removed:
the rewritten history mechanism doesn't alter history lines, making
the option unnecessary.
o History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
o The `$HISTCHARS' variable is now `$histchars'. Currently both
are tied together for compatibility.
o The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
o Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a %; history is now %!, not
!. Backslashes are no longer special.
--- End of changed items, diff from previous version follows ---
Index: zshfaq.txt
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.txt,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- zshfaq.txt 1999/03/24 10:58:44 1.12
+++ zshfaq.txt 1999/04/23 12:00:30 1.13
@@ -1,16 +1,15 @@
Archive-Name: unix-faq/shell/zsh
-Last-Modified: 1999/03/24
+Last-Modified: 1999/04/23
Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
-Version: $Id: zshfaq.txt,v 1.12 1999/03/24 10:58:44 pws Exp $
+Version: $Id: zshfaq.txt,v 1.13 1999/04/23 12:00:30 pws Exp $
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995--1999 (see end of document)
-Changes since issue posted January 1999:
+Changes since issue posted March 1999:
-1.1 Mention plain text FAQ location.
-5.3 Added list of goodies which will appear in version 3.1.6,
- separate from much-truncated wish-list.
+1.5 Mention 3.0.6 should appear soon
+5.1 Update on history-search-backward saga
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
@@ -227,12 +226,13 @@
1.5: What's the latest version?
- Zsh 3.0.5 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.
+ Zsh 3.0.5 is the latest production version, however a test version of
+ 3.0.6 is doing the rounds and should be released soon. 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.
The beta version 3.1.5 is also available. Development of zsh is
usually patch by patch, with each intermediate version publicly
@@ -1695,8 +1695,9 @@
`compress file' any more. For this reason, `\M-n' and
`\M-p' use history-beginning-search-{forward,backward} which
search for a line with the same prefix up to the cursor position.
- It is possible to write functions which go a little closer to the
- original behaviour; further changes are still possible.
+ From 3.1.6, there is likely to be a different implementation which
+ makes this closer (though not identical) to the old behaviour.
+ The story for the {up,down}-line-or-search commands is similar.
o In vi insert mode, the cursor keys no longer work. The following
will bind them:
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-02-25 9:57 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-02-25 9:57 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
The diff this time is quite large because of numbering changes; questions
which only have changed numbers are not included in full.
Changes since issue posted January 1999:
1.1 deleted the bit saying startup files are not mentioned.
3.2 New: about startup files.
3.7 we just found the PRINT_EIGHT_BIT option again...
3.22 New: about ${(e)...} and ${${...}}.
5.2 (In wishlist): patch exists for 3.1 to handle tying
texinputs/TEXINPUTS etc.
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?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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 .
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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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 ---
3.2: In which startup file do I put...?
When zsh starts up, there are four files you can change which it will
run under various circumstances: .zshenv, .zprofile, .zshrc
and .zlogin. They are usually in your home directory, but the
variable $ZDOTDIR may be set to alter that. Here are a few simple
hints about how to use them. There are also files which the system
administrator can set for all shells; you can avoid running all except
/etc/zshenv by starting zsh with the -f option --- for this
reason it is important for administrators to make sure /etc/zshenv
is as brief as possible.
The order in which the four files are searched (none of them _need_
to exist) is the one just given. However, .zprofile and .zlogin
are only run when the shell is a login shell --- when you first login,
of course, and whenever you start zsh with the -l option. All
login shells are interactive. The order is the only difference
between those; you should decide whether you need things set before or
after .zshrc. These files are a good place to set environment
variables (i.e. `export' commands), since they are passed on to
all shells without you having to set them again, and also to check
that your terminal is set up properly (except that if you want to
change settings for terminal emulator windows like xterm you will
need to put those in .zshrc, since usually you do not get a login
shell here).
The only file you can alter which is started with every zsh (unless
you use the -f option) is .zshenv, so this is a good place to put
things you want even if the shell is non-interactive: options for
changing the the syntax, like EXTENDED_GLOB, any changes to set with
`limit', any more variables you want to make sure are set as for
example $fpath to find functions. You almost certainly do not
want .zshenv to produce any output. Some people prefer not to
use .zshenv for setting options, as this affects scripts; but
making zsh scripts portable usually requires special handling anyway.
Finally, .zshrc is run for every interactive shell; that includes
login shells, but also any other time you start up a shell, such as
simply by typing `zsh' or opening a new terminal emulator window.
This file is the place to change the editing behaviour via options or
`bindkey', control how your history is saved, set aliases unless
you want to use them in scripts too, and for any other clutter which
can't be exported but you only use when interacting directly with the
shell. You probably don't want .zshrc to produce output, either,
since there are occasions when this can be a problem, such as when
using `rsh' from another host. See 3.21 for what to put in .zshrc
to save your history.
3.7: How do I make the completion list use eight bit characters?
If you are sure your terminal handles this, the easiest way is to
set the option PRINT_EIGHT_BIT. In principle, this will work
automatically if your computer uses the `locale' system and your
locale variables are set properly, as zsh understands this.
However, it is quite complicated, so if it isn't already set up,
trying the option is a lot easier.
3.22: How do I get a variable's value to be evaluated as another variable?
The problem is that you have a variable $E containing the string
`EDITOR', and a variable $EDITOR containing the string `emacs',
or something such. How do you get from $E to emacs in one easy
stage?
There is no standard single-stage way of doing this. However, there
is a zsh idiom (available in all versions of zsh since 5.0) for this:
print ${(e)E:+\$$E}
Ignore the `(e)' for now. The `:+' means: if the variable
$E is set, substitute the following, i.e. `\$$E'. This is
expanded to `$EDITOR' by the normal rules. Finally, the `(e)' means:
evaluate the expression you just made. This gives `emacs'.
For a standard shell way of doing this, you are stuck with `eval':
eval echo \$$E
produces the same result.
Future versions of zsh will probably allow you to do this directly,
with a new flag; `${(P)E}'.
As a slight aside, sometimes people note that the syntax `${${E}}'
is valid and expect it to have this effect. It probably ought to, but
in the early days of zsh it was found convenient to have this way of
producing different substitutions on the same parameter; for example,
`${${file##**/}%.*}' removes everything up to the last slash in
`$file', then everything from the last dot on, inclusive (try
it, this works). So in `${${E}}', the internal `${...}'
actually does nothing.
5.3: What's on the wish-list?
With version 3, the code is much cleaner than before, but still
bears the marks of the ages and many things could be done much
better with a rewrite. A more efficient set of code for
lexing/parsing/execution might also be an advantage. Volunteers are
particularly welcome for these tasks.
An improved line editor, with user-definable functions and binding
of multiple functions to keystrokes, is being developed.
o Loadable module support (will be in 3.1 but much work still needs
doing).
o Ksh compatibility could be improved.
o Option for glob qualifiers to follow perl syntax (a traditional item).
o Binding of shell functions to key strokes, accessing editing
buffer from functions, executing zle functions as a command: now
under development for 3.1.
o Users should be able to create their own foopath/FOOPATH array/path
combinations (now exists as a patch for 3.1).
--- End of changed items, diff from previous version follows ---
Index: zshfaq.txt
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- zshfaq.txt 1999/01/25 09:27:49 1.9
+++ zshfaq.txt 1999/02/25 10:03:06 1.10
@@ -1,16 +1,19 @@
Archive-Name: unix-faq/shell/zsh
-Last-Modified: 1999/01/25
+Last-Modified: 1999/02/05
Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
-Version: $Id: zshfaq.txt,v 1.9 1999/01/25 09:27:49 pws Exp $
+Version: $Id: zshfaq.txt,v 1.10 1999/02/25 10:03:06 pws Exp $
Posting-Frequency: Monthly
-Copyright: (C) P.W. Stephenson, 1995, 1996, 1997, 1998, 1999 (see end of document)
+Copyright: (C) P.W. Stephenson, 1995--1999 (see end of document)
-Changes since issue posted December 1998:
+Changes since issue posted January 1999:
-2.1 Finally point out function definitions are not local to
- functions (they never were).
-5.2 Mailing list location has changed.
+1.1 deleted the bit saying startup files are not mentioned.
+3.2 New: about startup files.
+3.7 we just found the PRINT_EIGHT_BIT option again...
+3.22 New: about ${(e)...} and ${${...}}.
+5.2 (In wishlist): patch exists for 3.1 to handle tying
+ texinputs/TEXINPUTS etc.
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
@@ -49,25 +52,27 @@
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. What is the difference between `export' and the ALL_EXPORT option?
-3.3. How do I turn off spelling correction/globbing for a single command?
-3.4. How do I get the meta key to work on my xterm?
-3.5. How do I automatically display the directory in my xterm title bar?
-3.6. How do I make the completion list use eight bit characters?
-3.7. Why do the cursor (arrow) keys not work?
-3.8. Why does my terminal act funny in some way?
-3.9. Why does zsh not work in an Emacs shell mode any more?
-3.10. Why do my autoloaded functions not autoload [the first time]?
-3.11. How does base arithmetic work?
-3.12. How do I get a newline in my prompt?
-3.13. Why does `bindkey ^a command-name' or 'stty intr ^-' do something funny?
-3.14. Why can't I bind \C-s and \C-q any more?
-3.15. How do I execute command `foo' within function `foo'?
-3.16. Why do history substitutions with single bangs do something funny?
-3.17. Why does zsh kill off all my background jobs when I logout?
-3.18. How do I list all my history entries?
-3.19. How does the alternative loop syntax, e.g. `while {...} {...}' work?
-3.20. Why is my history not being saved?
+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?
Chapter 4: The mysteries of completion
4.1. What is completion?
@@ -108,11 +113,10 @@
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. (This article
- also talks about shell startup files which would otherwise rate a
- mention here.) 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
+ 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
@@ -270,6 +274,7 @@
http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/
Japan ftp://ftp.tohoku.ac.jp/mirror/zsh/
ftp://ftp.nis.co.jp/pub/shells/zsh/
+ ftp://ftp.win.ne.jp/pub/shell/zsh/
Norway ftp://ftp.uit.no/pub/unix/shells/zsh/
Romania ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
Slovenia ftp://ftp.siol.net/pub/unix/shells/zsh/
@@ -840,8 +845,56 @@
or (entirely equivalent) when `emulate ksh' or `emulate sh' is in
effect.
-3.2: What is the difference between `export' and the ALL_EXPORT option?
+3.2: In which startup file do I put...?
+ When zsh starts up, there are four files you can change which it will
+ run under various circumstances: .zshenv, .zprofile, .zshrc
+ and .zlogin. They are usually in your home directory, but the
+ variable $ZDOTDIR may be set to alter that. Here are a few simple
+ hints about how to use them. There are also files which the system
+ administrator can set for all shells; you can avoid running all except
+ /etc/zshenv by starting zsh with the -f option --- for this
+ reason it is important for administrators to make sure /etc/zshenv
+ is as brief as possible.
+
+ The order in which the four files are searched (none of them _need_
+ to exist) is the one just given. However, .zprofile and .zlogin
+ are only run when the shell is a login shell --- when you first login,
+ of course, and whenever you start zsh with the -l option. All
+ login shells are interactive. The order is the only difference
+ between those; you should decide whether you need things set before or
+ after .zshrc. These files are a good place to set environment
+ variables (i.e. `export' commands), since they are passed on to
+ all shells without you having to set them again, and also to check
+ that your terminal is set up properly (except that if you want to
+ change settings for terminal emulator windows like xterm you will
+ need to put those in .zshrc, since usually you do not get a login
+ shell here).
+
+ The only file you can alter which is started with every zsh (unless
+ you use the -f option) is .zshenv, so this is a good place to put
+ things you want even if the shell is non-interactive: options for
+ changing the the syntax, like EXTENDED_GLOB, any changes to set with
+ `limit', any more variables you want to make sure are set as for
+ example $fpath to find functions. You almost certainly do not
+ want .zshenv to produce any output. Some people prefer not to
+ use .zshenv for setting options, as this affects scripts; but
+ making zsh scripts portable usually requires special handling anyway.
+
+ Finally, .zshrc is run for every interactive shell; that includes
+ login shells, but also any other time you start up a shell, such as
+ simply by typing `zsh' or opening a new terminal emulator window.
+ This file is the place to change the editing behaviour via options or
+ `bindkey', control how your history is saved, set aliases unless
+ you want to use them in scripts too, and for any other clutter which
+ can't be exported but you only use when interacting directly with the
+ shell. You probably don't want .zshrc to produce output, either,
+ since there are occasions when this can be a problem, such as when
+ using `rsh' from another host. See 3.21 for what to put in .zshrc
+ to save your history.
+
+3.3: What is the difference between `export' and the ALL_EXPORT option?
+
Normally, you would put a variable into the environment by using
`export var'. The command `setopt allexport' causes all
variables which are subsequently set (N.B. not all the ones which
@@ -865,7 +918,7 @@
it immediately afterwards. Only those variables will be automatically
exported.
-3.3: How do I turn off spelling correction/globbing for a single command?
+3.4: How do I turn off spelling correction/globbing for a single command?
In the first case, you presumably have `setopt correctall' in an
initialisation file, so that zsh checks the spelling of each word in
@@ -888,7 +941,7 @@
Note also that a shell function won't work: the no... directives must
be expanded before the rest of the command line is parsed.
-3.4: How do I get the meta key to work on my xterm?
+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
@@ -909,7 +962,7 @@
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.5: How do I automatically display the directory in my xterm title bar?
+3.6: How do I automatically display the directory in my xterm title bar?
You should use the special function `chpwd', which is called when
the directory changes. The following checks that standard output is
@@ -933,38 +986,16 @@
when the xterm starts up you will probably want to call chpwd
directly: just put `chpwd' in .zshrc after it is defined or autoloaded.
-3.6: How do I make the completion list use eight bit characters?
+3.7: How do I make the completion list use eight bit characters?
- A traditional UNIX environment (character terminal and ASCII
- character sets) is not sufficient to be able to handle non-ASCII
- characters, and there are so many possible enhancements that in
- general this is hard. However, if you have something like an xterm
- using a standard character set like ISO-8859-1 (which is often the
- default for xterm), read on. You should also note question
- 3.4 on the subject of eight bit characters.
-
- You are probably creating files with names including non-ASCII
- accented characters, and find they show up in the completion list as
- \M-i or something such. This is because the library routines
- (not zsh itself) which test whether a character is printable have
- replied that it is not; zsh has simply found a way to show them
- anyway.
-
- The answer, under a modern POSIXy operating system, is to find a
- locale where these are treated as printable characters. Zsh has
- handling for locales built in and will recognise when you set a
- relevant variable. You need to look in /usr/lib/locale to find one
- which suits you; the subdirectories correspond to the locale names.
- The simplest possibility is likely to be en_US, so that the simplest
- answer to your problem is to set
-
- LC_CTYPE=en_US
-
- when your terminal is capable of showing eight bit characters. If
- you only have a default domain (called C), you may need to have some
- additional files installed on your system.
+ If you are sure your terminal handles this, the easiest way is to
+ set the option PRINT_EIGHT_BIT. In principle, this will work
+ automatically if your computer uses the `locale' system and your
+ locale variables are set properly, as zsh understands this.
+ However, it is quite complicated, so if it isn't already set up,
+ trying the option is a lot easier.
-3.7: Why do the cursor (arrow) keys not work?
+3.8: Why do the cursor (arrow) keys not work?
The cursor keys send different codes depending on the terminal; zsh
only binds the most well known versions. If you see these problems,
@@ -985,7 +1016,7 @@
B, C or D, as well as the corresponding set beginning
`<ESC>[', so this may be redundant.
-3.8: Why does my terminal act funny in some way?
+3.9: Why does my terminal act funny in some way?
If you are using an OpenWindows cmdtool as your terminal, any
escape sequences (such as those produced by cursor keys) will be
@@ -1027,7 +1058,7 @@
the shell is less susceptible to mode changes inherited from
programmes than it used to be.
-3.9: Why does zsh not work in an Emacs shell mode any more?
+3.10: Why does zsh not work in an Emacs shell mode any more?
(This information comes from Bart Schaefer and other zsh-workers.)
@@ -1056,7 +1087,7 @@
to ~/.emacs.
-3.10: Why do my autoloaded functions not autoload [the first time]?
+3.11: Why do my autoloaded functions not autoload [the first time]?
The problem is that there are two possible ways of autoloading a
function (see the AUTOLOADING FUNCTIONS section of the zsh manual
@@ -1100,7 +1131,7 @@
parentheses removes the directory part of the filenames, leaving
just the function names.)
-3.11: How does base arithmetic work?
+3.12: How does base arithmetic work?
The ksh syntax is now understood, i.e.
@@ -1139,7 +1170,7 @@
existing variable in this fashion. Using the `$(( ... ))' method will
always display in decimal.
-3.12: How do I get a newline in my prompt?
+3.13: How do I get a newline in my prompt?
You can place a literal newline in quotes, i.e.
@@ -1158,14 +1189,14 @@
in your initialisation file.
-3.13: Why does `bindkey ^a command-name' or `stty intr ^-' do something funny?
+3.14: Why does `bindkey ^a command-name' or `stty intr ^-' do something funny?
You probably have the extendedglob option set in which case ^ and #
are metacharacters. ^a matches any file except one called a, so the
line is interpreted as bindkey followed by a list of files. Quote the
^ with a backslash or put quotation marks around ^a.
-3.14: Why can't I bind \C-s and \C-q any more?
+3.15: Why can't I bind \C-s and \C-q any more?
The control-s and control-q keys now do flow control by default,
unless you have turned this off with `stty -ixon' or redefined the
@@ -1178,7 +1209,7 @@
control and hence restoring the use of the keys: put `setopt
noflowcontrol' in your .zshrc file.
-3.15: How do I execute command `foo' within function `foo'?
+3.16: How do I execute command `foo' within function `foo'?
The command `command foo' does just that. You don't need this with
aliases, but you do with functions. Note that error messages like
@@ -1189,7 +1220,7 @@
using `command'. If `foo' is a builtin rather than an external
command, use `builtin foo' instead.
-3.16: Why do history substitutions with single bangs do something funny?
+3.17: Why do history substitutions with single bangs do something funny?
If you have a command like "echo !-2:$ !$", the first history
substitution then sets a default to which later history substitutions
@@ -1197,7 +1228,7 @@
!-2:$. The option CSH_JUNKIE_HISTORY makes all single bangs refer
to the last command.
-3.17: Why does zsh kill off all my background jobs when I logout?
+3.18: Why does zsh kill off all my background jobs when I logout?
Simple answer: you haven't asked it not to. Zsh (unlike [t]csh) gives
you the option of having background jobs killed or not: the `nohup'
@@ -1214,12 +1245,12 @@
Likewise, you can start a background job with `&!' instead of just
`&' at the end, which will automatically disown the job.
-3.18: How do I list all my history entries?
+3.19: How do I list all my history entries?
Tell zsh to start from entry 1: `history 1'. Those entries at the
start which are no longer in memory will be silently omitted.
-3.19: How does the alternative loop syntax, e.g. `while {...} {...}' work?
+3.20: How does the alternative loop syntax, e.g. `while {...} {...}' work?
Zsh provides an alternative to the traditional sh-like forms with `do',
@@ -1274,7 +1305,7 @@
manual), which you are in any case encouraged even more strongly not
to use in programs as it can be very confusing.
-3.20: Why is my history not being saved?
+3.21: Why is my history not being saved?
In zsh, you need to set three variables to make sure your history is
written out when the shell exits. For example,
@@ -1290,6 +1321,41 @@
above. There are also various options affecting history; see the
manual.
+3.22: How do I get a variable's value to be evaluated as another variable?
+
+ The problem is that you have a variable $E containing the string
+ `EDITOR', and a variable $EDITOR containing the string `emacs',
+ or something such. How do you get from $E to emacs in one easy
+ stage?
+
+ There is no standard single-stage way of doing this. However, there
+ is a zsh idiom (available in all versions of zsh since 5.0) for this:
+
+ print ${(e)E:+\$$E}
+
+ Ignore the `(e)' for now. The `:+' means: if the variable
+ $E is set, substitute the following, i.e. `\$$E'. This is
+ expanded to `$EDITOR' by the normal rules. Finally, the `(e)' means:
+ evaluate the expression you just made. This gives `emacs'.
+
+ For a standard shell way of doing this, you are stuck with `eval':
+
+ eval echo \$$E
+
+ produces the same result.
+
+ Future versions of zsh will probably allow you to do this directly,
+ with a new flag; `${(P)E}'.
+
+ As a slight aside, sometimes people note that the syntax `${${E}}'
+ is valid and expect it to have this effect. It probably ought to, but
+ in the early days of zsh it was found convenient to have this way of
+ producing different substitutions on the same parameter; for example,
+ `${${file##**/}%.*}' removes everything up to the last slash in
+ `$file', then everything from the last dot on, inclusive (try
+ it, this works). So in `${${E}}', the internal `${...}'
+ actually does nothing.
+
Chapter 4: The mysteries of completion
Programmable completion using the `compctl' command is one of the most
@@ -1768,14 +1834,15 @@
An improved line editor, with user-definable functions and binding
of multiple functions to keystrokes, is being developed.
- o Loadable module support (will be in 3.1 but much work still needs doing).
+ o Loadable module support (will be in 3.1 but much work still needs
+ doing).
o Ksh compatibility could be improved.
o Option for glob qualifiers to follow perl syntax (a traditional item).
o Binding of shell functions to key strokes, accessing editing
buffer from functions, executing zle functions as a command: now
under development for 3.1.
o Users should be able to create their own foopath/FOOPATH array/path
- combinations.
+ combinations (now exists as a patch for 3.1).
5.4: Will zsh have problems in the year 2000?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1999-01-25 9:19 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1999-01-25 9:19 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
Changes since issue posted December 1998:
2.1 Finally point out function definitions are not local to
functions (they never were).
5.2 Mailing list location has changed.
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. What is the difference between `export' and the ALL_EXPORT option?
3.3. How do I turn off spelling correction/globbing for a single command?
3.4. How do I get the meta key to work on my xterm?
3.5. How do I automatically display the directory in my xterm title bar?
3.6. How do I make the completion list use eight bit characters?
3.7. Why do the cursor (arrow) keys not work?
3.8. Why does my terminal act funny in some way?
3.9. Why does zsh not work in an Emacs shell mode any more?
3.10. Why do my autoloaded functions not autoload [the first time]?
3.11. How does base arithmetic work?
3.12. How do I get a newline in my prompt?
3.13. Why does `bindkey ^a command-name' or 'stty intr ^-' do something funny?
3.14. Why can't I bind \C-s and \C-q any more?
3.15. How do I execute command `foo' within function `foo'?
3.16. Why do history substitutions with single bangs do something funny?
3.17. Why does zsh kill off all my background jobs when I logout?
3.18. How do I list all my history entries?
3.19. How does the alternative loop syntax, e.g. `while {...} {...}' work?
3.20. Why is my history not being saved?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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 .
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. (This article
also talks about shell startup files which would otherwise rate a
mention here.) 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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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 ---
2.1: Differences from sh and ksh
Most features of ksh (and hence also of sh) are implemented in zsh;
problems can arise because the implementation is slightly different.
Note also that not all ksh's are the same either. I have based this
on the 11/16/88f version of ksh; differences from ksh93 will be more
substantial.
As a summary of the status:
1) because of all the options it is not safe to assume a general
zsh run by a user will behave as if sh or ksh compatible;
2) invoking zsh as sh or ksh (or if either is a symbolic link to
zsh) sets appropriate options and improves compatibility (from
within zsh itself, calling `ARGV0=sh zsh' will also work);
3) from version 3.0 onward the degree of compatibility with sh
under these circumstances is very high: zsh can now be used
with GNU configure or perl's Configure, for example;
4) the degree of compatibility with ksh is also high, but a few
things are missing: for example the more sophisticated
pattern-matching expressions are different for versions before
3.1.3 --- see the detailed list below;
5) also from 3.0, the command `emulate' is available: `emulate
ksh' and `emulate sh' set various options as well as changing the
effect of single-letter option flags as if the shell had been
invoked with the appropriate name. Including the commands
`emulate sh; setopt localoptions' in a shell function will
turn on sh emulation for that function only.
The classic difference is word splitting, discussed in 3.1; this
catches out very many beginning zsh users. As explained there, this
is actually a bug in every other shell. The answer is to set
SH_WORD_SPLIT for backward compatibility. The next most classic
difference is that unmatched glob patterns cause the command to
abort; set NO_NOMATCH for those.
Here is a list of various options which will increase ksh
compatibility, though maybe decrease zsh's abilities: see the manual
entries for GLOB_SUBST, IGNORE_BRACES (though brace expansion occurs
in some versions of ksh), KSH_ARRAYS, KSH_GLOB, KSH_OPTION_PRINT,
LOCAL_OPTIONS, NO_BAD_PATTERN, NO_BANG_HIST, NO_EQUALS, NO_HUP,
NO_NOMATCH, NO_RCS, NO_SHORT_LOOPS, PROMPT_SUBST, RM_STAR_SILENT,
POSIX_BUILTINS, SH_FILE_EXPANSION, SH_GLOB, SH_OPTION_LETTERS,
SH_WORD_SPLIT (see question 3.1) and SINGLE_LINE_ZLE.
Note that you can also disable any built-in commands which get in
your way. If invoked as `ksh', the shell will try and set suitable
options.
Here are some differences from ksh which might prove significant for
ksh programmers, some of which may be interpreted as bugs; there
must be more. Note that this list is deliberately rather full and
that most of the items are fairly minor. Those marked `*' perform
in a ksh-like manner if the shell is invoked with the name `ksh', or
if `emulate ksh' is in effect. Capitalised words with underlines
refer to shell options.
o Syntax:
o * Shell word splitting: see question 3.1.
o * Arrays are (by default) more csh-like than ksh-like:
subscripts start at 1, not 0; array[0] refers to array[1];
`$array' refers to the whole array, not $array[0];
braces are unnecessary: $a[1] == ${a[1]}, etc.
The KSH_ARRAYS option is now available.
o Coprocesses are established by `coproc'; `|&' behaves like
csh. Handling of coprocess file descriptors is also different.
o In `cmd1 && cmd2 &', only `cmd2' instead of the whole
expression is run in the background in zsh. The manual implies
this is a bug. Use `{ cmd1 && cmd2 } &' as a workaround.
o Command line substitutions, globbing etc.:
o * Failure to match a globbing pattern causes an error (use
NO_NOMATCH).
o * The results of parameter substitutions are treated as plain text:
`foo="*"; print $foo' prints all files in ksh but `*' in zsh.
(GLOB_SUBST has been added to fix this.)
o The backslash in $(echo '\$x') is treated differently: in ksh, it
is not stripped, in zsh it is. (The `...` form gives the same in
both shells.)
o * $PSn do not do parameter substitution by default (use PROMPT_SUBST).
o * Standard globbing does not allow ksh-style `pattern-lists'.
Equivalents:
----------------------------------------------------------------------
ksh zsh Meaning
----- ----- ---------
!(foo) ^foo Anything but foo.
or foo1~foo2 Anything matching foo1 but foo2[1].
@(foo1|foo2|...) (foo1|foo2|...) One of foo1 or foo2 or ...
?(foo) (foo|) Zero or one occurrences of foo.
*(foo) (foo)# Zero or more occurrences of foo.
+(foo) (foo)## One or more occurrences of foo.
----------------------------------------------------------------------
The `^', `~' and `#' (but not `|')forms require EXTENDED_GLOB.
From version 3.1.3, the ksh forms are fully supported when the
option KSH_GLOB is in effect; for previous versions you
must use the table above.
[1] Note that `~' is the only globbing operator to have a lower
precedence than `/'. For example, `**/foo~*bar*' matches any
file in a subdirectory called `foo', except where `bar'
occurred somewhere in the path (e.g. `users/barstaff/foo' will
be excluded by the `~' operator). As the `**' operator cannot
be grouped (inside parentheses it is treated as `*'), this is
the way to exclude some subdirectories from matching a `**'.
o Unquoted assignments do file expansion after `:'s (intended for
PATHs).
o `integer' does not allow `-i'.
o `typeset' and `integer' have special behaviour for
assignments in ksh, but not in zsh. For example, this doesn't
work in zsh:
integer k=$(wc -l ~/.zshrc)
because the return value from wc includes leading
whitespace which causes wordsplitting. Ksh handles the
assignment specially as a single word.
o Command execution:
o * There is no $ENV variable (use /etc/zshrc, ~/.zshrc;
note also $ZDOTDIR).
o $PATH is not searched for commands specified
at invocation without -c.
o Aliases and functions:
o The order in which aliases and functions are defined is significant:
function definitions with () expand aliases -- see question 2.3.
o Aliases and functions cannot be exported.
o There are no tracked aliases: command hashing replaces these.
o The use of aliases for key bindings is replaced by `bindkey'.
o * Options are not local to functions (use LOCAL_OPTIONS; note this
may always be unset locally to propagate options settings from a
function to the calling level).
o Function definitions themselves are not local to functions.
o Traps and signals:
o Traps are not local to functions.
o TRAPERR has become TRAPZERR (this was forced by UNICOS which
has SIGERR).
o Editing:
o The options emacs, gmacs, viraw are not supported.
Use bindkey to change the editing behaviour: `set -o {emacs,vi}'
becomes `bindkey -{e,v}'; for gmacs, go to emacs mode and use
`bindkey \^t gosmacs-transpose-characters'.
o The `keyword' option does not exist and `-k' is instead
interactivecomments. (`keyword' will not be in the next ksh
release either.)
o Management of histories in multiple shells is different:
the history list is not saved and restored after each command.
o `\' does not escape editing chars (use `^V').
o Not all ksh bindings are set (e.g. `<ESC>#'; try `<ESC>q').
o * `#' in an interactive shell is not treated as a comment by
default.
o Built-in commands:
o Some built-ins (r, autoload, history, integer ...)
were aliases in ksh.
o There is no built-in command newgrp: use e.g. `alias
newgrp="exec newgrp"'
o `jobs' has no `-n' flag.
o `read' has no `-s' flag.
o Other idiosyncrasies:
o `select' always redisplays the list of selections on each loop.
5.2: Where do I report bugs, get more info / who's working on zsh?
The shell is being maintained by various (entirely self-appointed)
subscribers to the mailing list,
zsh-workers@sunsite.auc.dk
so mail on any issues (bug reports, suggestions, complaints...)
related to the development of the shell should be sent there. If
you want someone to mail you directly, say so. Most patches to zsh
appear there first.
Note that this location has just changed (January 1999), and the
instructions to go with it are slightly different --- in particular,
if you are already subscribed, the instructions about how to
unsubscribe are different.
Please note when reporting bugs that many exist only on certain
architectures, which the developers may not have access to. In
this case debugging information, as detailed as possible, is
particularly welcome.
Two progressively lower volume lists exist, one with messages
concerning the use of zsh,
zsh-users@sunsite.auc.dk
and one just containing announcements: about releases, about major
changes in the shell, or this FAQ, for example,
zsh-announce@sunsite.auc.dk
(posting to the last one is currently restricted).
Note that you should only join one of these lists: people on
zsh-workers receive all the lists, and people on zsh-users will
also receive the announcements list.
The lists are handled by an automated server. The instructions for
zsh-announce and zsh-users are the same as for zsh-workers: just
change zsh-workers to whatever in the following.
To join zsh-workers, send email to
zsh-workers-subscribe@sunsite.auc.dk
(the actual content is unimportant). Replace subscribe with
unsubscribe to unsubscribe. The mailing software (ezlm) has
various bells and whistles: you can retrieve archived messages.
Mail zsh-workers-help@sunsite.auc.dk for detailed information.
Adminstrative matters are best sent to
zsh-workers-owner@sunsite.auc.dk. The list maintainer's
real name is Karsten Thygesen <karthy@kom.auc.dk>.
The list from May 1992 to May 1995 is archived in
ftp://ftp.sterling.com/zsh/zsh-list/YY-MM
where YY-MM are the year and month in digits. More recent
mailings up to date are to be found at
http://www.zsh.org/mla/
at the main zsh archive in Australia.
Of course, you can also post zsh queries to the Usenet group
comp.unix.shell; if all else fails, you could even e-mail me.
--- End of changed items, diff from previous version follows ---
Index: zshfaq.txt
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** zshfaq.txt 1998/12/19 13:44:46 1.8
--- zshfaq.txt 1999/01/25 09:27:49 1.9
***************
*** 1,16 ****
Archive-Name: unix-faq/shell/zsh
! Last-Modified: 1998/11/19
Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
! Version: $Id: zshfaq.txt,v 1.8 1998/12/19 13:44:46 pws Exp $
Posting-Frequency: Monthly
! Copyright: (C) P.W. Stephenson, 1995, 1996, 1997, 1998 (see end of document)
! Changes since issue posted November 1998:
! 1.1 Mention email FAQ server
! 2.3 Restore missing double quote in cd() function
! 3.1 Mention ${==*} to turn off SHWORDSPLIT
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
--- 1,16 ----
Archive-Name: unix-faq/shell/zsh
! Last-Modified: 1999/01/25
Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
! Version: $Id: zshfaq.txt,v 1.9 1999/01/25 09:27:49 pws Exp $
Posting-Frequency: Monthly
! Copyright: (C) P.W. Stephenson, 1995, 1996, 1997, 1998, 1999 (see end of document)
! Changes since issue posted December 1998:
! 2.1 Finally point out function definitions are not local to
! functions (they never were).
! 5.2 Mailing list location has changed.
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
***************
*** 511,516 ****
--- 511,517 ----
o * Options are not local to functions (use LOCAL_OPTIONS; note this
may always be unset locally to propagate options settings from a
function to the calling level).
+ o Function definitions themselves are not local to functions.
o Traps and signals:
***************
*** 1697,1709 ****
The shell is being maintained by various (entirely self-appointed)
subscribers to the mailing list,
! zsh-workers@math.gatech.edu
so mail on any issues (bug reports, suggestions, complaints...)
related to the development of the shell should be sent there. If
you want someone to mail you directly, say so. Most patches to zsh
appear there first.
Please note when reporting bugs that many exist only on certain
architectures, which the developers may not have access to. In
this case debugging information, as detailed as possible, is
--- 1698,1715 ----
The shell is being maintained by various (entirely self-appointed)
subscribers to the mailing list,
! zsh-workers@sunsite.auc.dk
so mail on any issues (bug reports, suggestions, complaints...)
related to the development of the shell should be sent there. If
you want someone to mail you directly, say so. Most patches to zsh
appear there first.
+ Note that this location has just changed (January 1999), and the
+ instructions to go with it are slightly different --- in particular,
+ if you are already subscribed, the instructions about how to
+ unsubscribe are different.
+
Please note when reporting bugs that many exist only on certain
architectures, which the developers may not have access to. In
this case debugging information, as detailed as possible, is
***************
*** 1712,1723 ****
Two progressively lower volume lists exist, one with messages
concerning the use of zsh,
! zsh-users@math.gatech.edu
and one just containing announcements: about releases, about major
changes in the shell, or this FAQ, for example,
! zsh-announce@math.gatech.edu
(posting to the last one is currently restricted).
--- 1718,1729 ----
Two progressively lower volume lists exist, one with messages
concerning the use of zsh,
! zsh-users@sunsite.auc.dk
and one just containing announcements: about releases, about major
changes in the shell, or this FAQ, for example,
! zsh-announce@sunsite.auc.dk
(posting to the last one is currently restricted).
***************
*** 1730,1749 ****
change zsh-workers to whatever in the following.
To join zsh-workers, send email to
-
- zsh-workers-request@math.gatech.edu
-
- with the *subject* line (this is a change from the old list)
-
- subscribe <your-email-address>
-
- e.g.
! Subject: subscribe P.Stephenson@swansea.ac.uk
! and you can unsubscribe in the same way.
! The list maintainer, Richard Coleman, can be reached at
! coleman@math.gatech.edu.
The list from May 1992 to May 1995 is archived in
ftp://ftp.sterling.com/zsh/zsh-list/YY-MM
--- 1736,1751 ----
change zsh-workers to whatever in the following.
To join zsh-workers, send email to
! zsh-workers-subscribe@sunsite.auc.dk
! (the actual content is unimportant). Replace subscribe with
! unsubscribe to unsubscribe. The mailing software (ezlm) has
! various bells and whistles: you can retrieve archived messages.
! Mail zsh-workers-help@sunsite.auc.dk for detailed information.
! Adminstrative matters are best sent to
! zsh-workers-owner@sunsite.auc.dk. The list maintainer's
! real name is Karsten Thygesen <karthy@kom.auc.dk>.
The list from May 1992 to May 1995 is archived in
ftp://ftp.sterling.com/zsh/zsh-list/YY-MM
***************
*** 1808,1823 ****
Thanks to zsh-list, in particular Bart Schaefer, for suggestions
regarding this document. Zsh has been in the hands of archivists Jim
Mattson, Bas de Bakker, Richard Coleman, Zoltan Hidvegi and Andrew
! Main, and the mailing list has been run by Peter Gray, Rick Ohnemus
! and Richard Coleman, all of whom deserve thanks. The world is
! eternally in the debt of Paul Falstad for inventing zsh in the first
! place (though the wizzo extended completion is by Sven Wischnowsky).
Copyright Information:
This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997,
! 1998. This text originates in the U.K. and the author asserts his
! moral rights under the Copyrights, Designs and Patents Act, 1988.
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
--- 1810,1826 ----
Thanks to zsh-list, in particular Bart Schaefer, for suggestions
regarding this document. Zsh has been in the hands of archivists Jim
Mattson, Bas de Bakker, Richard Coleman, Zoltan Hidvegi and Andrew
! Main, and the mailing list has been run by Peter Gray, Rick Ohnemus,
! Richard Coleman and Karsten Thygesen, all of whom deserve thanks. The
! world is eternally in the debt of Paul Falstad for inventing zsh in
! the first place (though the wizzo extended completion is by Sven
! Wischnowsky).
Copyright Information:
This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997,
! 1998, 1999. This text originates in the U.K. and the author asserts
! his moral rights under the Copyrights, Designs and Patents Act, 1988.
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] 19+ messages in thread
* Z-Shell (zsh) FAQ changes this month
@ 1998-12-19 13:28 Peter Stephenson
0 siblings, 0 replies; 19+ messages in thread
From: Peter Stephenson @ 1998-12-19 13:28 UTC (permalink / raw)
To: zsh-announce
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
text version of the FAQ. If you would like a complete individual
copy, email me and I will add you to the list.
Changes since issue posted November 1998:
1.1 Mention email FAQ server
2.3 Restore missing double quote in cd() function
3.1 Mention ${==*} to turn off SHWORDSPLIT
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. What is the difference between `export' and the ALL_EXPORT option?
3.3. How do I turn off spelling correction/globbing for a single command?
3.4. How do I get the meta key to work on my xterm?
3.5. How do I automatically display the directory in my xterm title bar?
3.6. How do I make the completion list use eight bit characters?
3.7. Why do the cursor (arrow) keys not work?
3.8. Why does my terminal act funny in some way?
3.9. Why does zsh not work in an Emacs shell mode any more?
3.10. Why do my autoloaded functions not autoload [the first time]?
3.11. How does base arithmetic work?
3.12. How do I get a newline in my prompt?
3.13. Why does `bindkey ^a command-name' or 'stty intr ^-' do something funny?
3.14. Why can't I bind \C-s and \C-q any more?
3.15. How do I execute command `foo' within function `foo'?
3.16. Why do history substitutions with single bangs do something funny?
3.17. Why does zsh kill off all my background jobs when I logout?
3.18. How do I list all my history entries?
3.19. How does the alternative loop syntax, e.g. `while {...} {...}' work?
3.20. Why is my history not being saved?
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/ (note the change of address from the
end of April 1998). The server provides this FAQ and much else and is
now maintained by Karsten Thygesen and others (mail zsh@sunsite.auc.dk
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 .
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. (This article
also talks about shell startup files which would otherwise rate a
mention here.) 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@rtfm.mit.edu
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.
There is now a preliminary version of a reference card for
zsh 3.0, which you can find (while it's being developed) at
http://www.ifh.de/~pws/computing/refcard.ps
This is optimised for A4 paper. The LaTeX source is in the
same place with the extension .tex. It is not a good place
from which to learn zsh for the first time.
(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 ---
2.3: Why do my csh aliases not work? (Plus other alias pitfalls.)
First of all, check you are using the syntax
alias newcmd='list of commands'
and not
alias newcmd 'list of commands'
which won't work. (It tells you if `newcmd' and `list of commands' are
already defined as aliases.)
Otherwise, your aliases probably contain references to the command
line of the form `\!*', etc. Zsh does not handle this behaviour as it
has shell functions which provide a way of solving this problem more
consistent with other forms of argument handling. For example, the
csh alias
alias cd 'cd \!*; echo $cwd'
can be replaced by the zsh function,
cd() { builtin cd "$@"; echo $PWD; }
(the `builtin' tells zsh to use its own `cd', avoiding an infinite loop)
or, perhaps better,
cd() { builtin cd "$@"; print -D $PWD; }
(which converts your home directory to a ~). In fact, this problem is
better solved by defining the special function chpwd() (see the manual).
Note also that the `;' at the end of the function is optional in zsh,
but not in ksh or sh (for sh's where it exists).
Here is Bart Schaefer's guide to converting csh aliases for zsh.
1) If the csh alias references "parameters" (\!:1, \!* etc.),
then in zsh you need a function (referencing $1, $* etc.).
Otherwise, you can use a zsh alias.
2) If you use a zsh function, you need to refer _at_least_ to
$* in the body (inside the { }). Parameters don't magically
appear inside the { } the way they get appended to an alias.
3) If the csh alias references its own name (alias rm "rm -i"),
then in a zsh function you need the "command" keyword
(function rm() { command rm -i "$@" }), but in a zsh alias
you don't (alias rm="rm -i").
4) If you have aliases that refer to each other (alias ls "ls -C";
alias lf "ls -F" ==> lf == ls -C -F) then you must either:
o convert all of them to zsh functions; or
o after converting, be sure your .zshrc defines all of your
aliases before it defines any of your functions.
Those first four are all you really need, but here are four more for
heavy csh alias junkies:
5) Mapping from csh alias "parameter referencing" into zsh function
(assuming shwordsplit and ksharrays are NOT set in zsh):
csh zsh
===== ==========
\!* $* (or $argv)
\!^ $1 (or $argv[1])
\!:1 $1
\!:2 $2 (or $argv[2], etc.)
\!$ $*[$#] (or $argv[$#], or $*[-1])
\!:1-4 $*[1,4]
\!:1- $*[1,$#-1] (or $*[1,-2])
\!^- $*[1,$#-1]
\!*:q "$@" ($*:q doesn't work (yet))
\!*:x $=* ($*:x doesn't work (yet))
6) Remember that it is NOT a syntax error in a zsh function to
refer to a position ($1, $2, etc.) greater than the number of
parameters. (E.g., in a csh alias, a reference to \!:5 will
cause an error if 4 or fewer arguments are given; in a zsh
function, $5 is the empty string if there are 4 or fewer
parameters.)
7) To begin a zsh alias with a - (dash, hyphen) character, use
`alias --':
csh zsh
=============== ==================
alias - "fg %-" alias -- -="fg %-"
8) Stay away from `alias -g' in zsh until you REALLY know what
you're doing.
There is one other serious problem with aliases: consider
alias l='/bin/ls -F'
l() { /bin/ls -la "$@" | more }
`l' in the function definition is in command position and is expanded
as an alias, defining `/bin/ls' and `-F' as functions which call
`/bin/ls', which gets a bit recursive. This can be avoided if you use
`function' to define a function, which doesn't expand aliases. It is
possible to argue for extra warnings somewhere in this mess. Luckily,
it is not possible to define `function' as an alias.
Bart Schaefer's rule is: Define first those aliases you expect to
use in the body of a function, but define the function first if the
alias has the same name as the function.
3.1: Why does `$var' where `var="foo bar"' not do what I expect?
In most Bourne-shell derivatives, multiple-word variables such as
var="foo bar"
are split into words when passed to a command or used in a `for foo in
$var' loop. By default, zsh does not have that behaviour: the
variable remains intact. (This is not a bug! See below.) An option
(SHWORDSPLIT) exists to provide compatibility.
For example, defining the function args to show the number of its
arguments:
args() { echo $#; }
and with our definition of `var',
args $var
produces the output `1'. After
setopt shwordsplit
the same function produces the output `2', as with sh and ksh.
Unless you need strict sh/ksh compatibility, you should ask yourself
whether you really want this behaviour, as it can produce unexpected
effects for variables with entirely innocuous embedded spaces. This
can cause horrendous quoting problems when invoking scripts from
other shells. The natural way to produce word-splitting behaviour
in zsh is via arrays. For example,
set -A array one two three twenty
(or
array=(one two three twenty)
if you prefer), followed by
args $array
produces the output `4', regardless of the setting of SHWORDSPLIT.
Arrays are also much more versatile than single strings. Probably
if this mechanism had always been available there would never have
been automatic word splitting in scalars, which is a sort of
uncontrollable poor man's array.
Note that this happens regardless of the value of the internal field
separator, $IFS; in other words, with `IFS=:; foo=a:b; args $foo'
you get the answer 1.
Other ways of causing word splitting include a judicious use of
`eval':
sentence="Longtemps, je me suis couch\\'e de bonne heure."
eval "words=($sentence)"
after which $words is an array with the words of $sentence (note
characters special to the shell, such as the `'' in this example,
must already be quoted), or, less standard but more reliable,
turning on SHWORDSPLIT for one variable only:
args ${=sentence}
always returns 8 with the above definition of `args'. (In older
versions of zsh, ${=foo} toggled SHWORDSPLIT; now it forces it on.)
Note also the "$@" method of word splitting is always available in zsh
functions and scripts (though strictly this does array splitting, not
word splitting). This is more portable than the $*, since it
will work regardless of the SHWORDSPLIT setting; the other
difference is that $* removes empty arguments from the array.
You can fix the first half of that objection by using ${==*},
which turns off SHWORDSPLIT for the duration of the expansion.
SHWORDSPLIT is set when zsh is invoked with the names `ksh' or `sh',
or (entirely equivalent) when `emulate ksh' or `emulate sh' is in
effect.
--- End of changed items, diff from previous version follows ---
Index: zshfaq.txt
===================================================================
RCS file: /pack/anoncvs/zsh/www/FAQ/zshfaq.txt,v
retrieving revision 1.6
diff -c -r1.6 zshfaq.txt
*** zshfaq.txt 1998/11/24 11:20:10 1.6
--- zshfaq.txt 1998/12/19 13:33:06
***************
*** 1,17 ****
Archive-Name: unix-faq/shell/zsh
! Last-Modified: 1998/10/26
! Submitted-By: pws@amtp.liv.ac.uk (Peter Stephenson)
! Version: $Id: faqpost.txt,v 1.1 1998/12/19 13:37:21 pws Exp $
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995, 1996, 1997, 1998 (see end of document)
! Changes since issue posted October 1998:
! 1.5 Latest beta is 3.1.5.
! 3.1 Another slight addition ("$@" vs. $*) in the
! perennial SHWORDSPLIT question. Changes in some
! functions which used $*.
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
--- 1,16 ----
Archive-Name: unix-faq/shell/zsh
! Last-Modified: 1998/11/19
! Submitted-By: pws@ibmth.df.unipi.it (Peter Stephenson)
! Version: $Id: faqpost.txt,v 1.1 1998/12/19 13:37:21 pws Exp $
Posting-Frequency: Monthly
Copyright: (C) P.W. Stephenson, 1995, 1996, 1997, 1998 (see end of document)
! Changes since issue posted November 1998:
! 1.1 Mention email FAQ server
! 2.3 Restore missing double quote in cd() function
! 3.1 Mention ${==*} to turn of SHWORDSPLIT
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
***************
*** 119,124 ****
--- 118,126 ----
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@rtfm.mit.edu
+ 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.
***************
*** 600,606 ****
can be replaced by the zsh function,
! cd() { builtin cd "$@; echo $PWD; }
(the `builtin' tells zsh to use its own `cd', avoiding an infinite loop)
or, perhaps better,
--- 602,608 ----
can be replaced by the zsh function,
! cd() { builtin cd "$@"; echo $PWD; }
(the `builtin' tells zsh to use its own `cd', avoiding an infinite loop)
or, perhaps better,
***************
*** 830,835 ****
--- 832,839 ----
word splitting). This is more portable than the $*, since it
will work regardless of the SHWORDSPLIT setting; the other
difference is that $* removes empty arguments from the array.
+ You can fix the first half of that objection by using ${==*},
+ which turns off SHWORDSPLIT for the duration of the expansion.
SHWORDSPLIT is set when zsh is invoked with the names `ksh' or `sh',
or (entirely equivalent) when `emulate ksh' or `emulate sh' is in
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2000-08-29 20:26 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-24 10:46 Z-Shell (zsh) FAQ changes this month Peter Stephenson
-- strict thread matches above, loose matches on Subject: below --
2000-08-29 19:41 Peter Stephenson
2000-07-24 20:52 Peter Stephenson
2000-06-22 19:45 Peter Stephenson
2000-05-24 19:26 Peter Stephenson
2000-04-30 14:41 Peter Stephenson
2000-03-23 20:58 Peter Stephenson
2000-02-23 20:49 Peter Stephenson
2000-01-25 21:10 Peter Stephenson
1999-12-28 12:03 Peter Stephenson
1999-11-29 22:52 Peter Stephenson
1999-09-27 12:02 Peter Stephenson
1999-07-24 12:20 Peter Stephenson
1999-06-24 12:41 Peter Stephenson
1999-05-24 9:42 Peter Stephenson
1999-04-23 11:49 Peter Stephenson
1999-02-25 9:57 Peter Stephenson
1999-01-25 9:19 Peter Stephenson
1998-12-19 13:28 Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).