26763: fix problem on failed cd -s to relative path
[zsh.git] / README
blobb2330f60a88d155d88767876cf754547889d2db5
1 -----------------
2 THE Z SHELL (ZSH)
3 -----------------
5 Version
6 -------
8 This is version 4.3.9 of the shell.  This is a development release,
9 but is believed to be reasonably stable.  Sites where the users need to
10 edit command lines with multibyte characters (in particular UTF-8)
11 will probably want to upgrade.  The previous widely released version
12 of the shell was 4.3.6.
14 Installing Zsh
15 --------------
17 The instructions for compiling zsh are in the file INSTALL.  You should
18 also check the file MACHINES in the top directory to see if there
19 are any special instructions for your particular architecture.
21 Note in particular the zsh/newuser module that guides new users through
22 setting basic shell options without the administrator's intervention.  This
23 is turned on by default.  See the section AUTOMATIC NEW USER CONFIGURATION
24 in INSTALL for configuration information.
26 Features
27 --------
29 Zsh is a shell with lots of features.  For a list of some of these, see the
30 file FEATURES, and for the latest changes see NEWS.  For more
31 details, see the documentation.
33 Possible incompatibilities
34 ---------------------------
36 In some 4.3.X releases of zsh, the completion system added a ".."  as a
37 trial completion whenever completing directories.  This was a bug: as
38 documented in the zshcompsys manual, this feature needs to be turned on by
39 a style:
41   zstyle ':completion:*' special-dirs true
44 The rest of this section documents incompatibilities in the shell since the
45 4.2 series of releases.
47 In previous releases of the shell, builtin commands and precommand
48 modifiers that did not accept options also did not recognize the
49 argument "--" as marking the end of option processing without being
50 considered an argument.  This was not documented and was incompatible
51 with other shells.  All such commands now handle this syntax.
53 The configuration option --enable-lfs to enable large file support has
54 been replaced by autoconf's standard --enable-largefile mechanism.
55 As this is usually used whenever necessary, this won't usually
56 be noticeable; however, anyone configuring with --disable-lfs
57 should configure with --disable-largefile instead.
59 The configuration option --with-curses-terminfo has been replaced
60 by the option --with-term-lib="LIBS" where LIBS is a space-separated
61 list of libraries to search for termcap and curses features.
63 The option SH_WORD_SPLIT, used in Bourne/Korn/Posix shell compatibility
64 mode, has been made more like other shells in the case of substitutions of
65 the form ${1+"$@"} (a common trick used to work around problems in older
66 Bourne shells) or any of the related forms with the + replaced by - or =
67 with an optional colon preceding.  Previously, with SH_WORD_SPLIT in
68 effect, this expression would cause splitting on all white space in the
69 shell arguments.  (This was always regarded as a bug but was long-standing
70 behaviour.)  Now it is treated identically to "$@".  The same change
71 applies to expressions with forced splitting such as ${=1+"$@"}, but
72 otherwise the case where SH_WORD_SPLIT is not set is unaffected.
74 Debug traps (`trap ... DEBUG' or the function TRAPDEBUG) now run by default
75 before the command to which they refer instead of after.  This is almost
76 always the right behaviour for the intended purpose of debugging and is
77 consistent with recent versions of other shells.  The option
78 DEBUG_BEFORE_CMD can be unset to revert to the previous behaviour.
80 Previously, process substitutions of the form =(...), <(...) and >(...)
81 were only handled if they appeared as separate command arguments.
82 (However, the latter two forms caused the current argument to be
83 terminated and a new one started even if they occurred in the middle of
84 a string.)  Now all three may be followed by other strings, and the
85 latter two may also be preceeded by other strings.  Remaining
86 limitations on their use (to reduce incompatibilities to a minimum)
87 are documented in the zshexpn.1 manual.
89 In previous versions of the shell it was possible to use index 0 in an
90 array or string subscript to refer to the same element as index 1 if the
91 option KSH_ARRAYS was not in effect.  This was a limited approximation to
92 the full KSH_ARRAYS handling and so was not very useful.  In this version
93 of the shell, this behaviour is only provided when the option
94 KSH_ZERO_SUBSCRIPT is set.  Note that despite the name this does not provide
95 true compatibility with ksh or other shells and KSH_ARRAYS should still be
96 used for that purpose.  By default, the option is not set; an array
97 subscript that evaluates to 0 returns an empty string or array element and
98 attempts to write to an array or string range including only a zero
99 subscript are treated as an error.  Writes to otherwise valid ranges that
100 also include index zero are allowed; hence for example the assignment
101   array[(R)notfound,(r)notfound]=()
102 (where the string "notfound" does not match an element in $array) sets the
103 entire array to be empty, as in previous versions of the shell.
104 KSH_ZERO_SUBSCRIPT is irrelevant when KSH_ARRAYS is set.  Also as in previous
105 versions, attempts to write to non-existent elements at the end of an array
106 cause the array to be suitably extended.  This difference means that, for
107 example
108   array[(R)notfound]=(replacement)
109 is an error if KSH_ZERO_SUBSCRIPT is not set (new behaviour), while
110   array[(r)notfound]=(replacement)
111 causes the given value to be appended to the array (same behaviour as
112 previous versions).
114 The "exec" precommand modifier now takes various options for compatibility
115 with other shells.  This means that whereas "exec -prog" previously
116 tried to execute a command name "-prog", it will now report an error
117 in option handling.  "exec -- -prog" will execute "-prog".  If
118 the option EQUALS is set, as it is by default in zsh's native mode,
119 "exec =-prog" behaves the same way in all versions of zsh provided
120 the command can be found.
122 The "unset" builtin now does not regard the unsetting of non-existent
123 variables as an error, so can still return status 0 (depending on the
124 handling of other arguments).  This appears to be the standard shell
125 behaviour.
127 The variable BAUD is no longer set automatically by the shell.
128 In previous versions it was set to the baud rate reported by
129 the terminal driver in order to initialise the line editor's
130 compensation mechanism for slow baud rates.  However, the baud
131 rate so reported is very rarely related to the limiting speed of
132 screen updates on modern systems.  Users who need the compensation
133 mechanism should set BAUD to an appropriate rate by hand.
135 The variable HOME is no longer set by the shell if zsh is emulating any
136 other shell at startup; it must be present in the environment or set
137 subsequently by the user.  It is valid for the variable to be unset.
139 Parameter substitutions in the form ${param//#%search/replace} match
140 against "search" anchored at both ends of the parameter value.  Previously
141 this syntax would have matched against "%search", anchored only at the head
142 of the value.  The form ${param//#$search/replace} where the value
143 $search starts with "%" considers the "%" to be part of the search
144 string as before.
146 The MULTIBYTE option is on by default where it is available; this
147 causes many operations to recognise characters as in the current locale.
148 Older versions of the shell always assumed a character was one byte.
149 In some places the width of the character will be used; this is transparent
150 when used for calculations of screen position, but also occurs, for
151 example, in calculations of padding width.  Note that MULTIBYTE is
152 not automatically set when emulating Bourne- and POSIX-style shells;
153 for interative use of these emulations it may be necessary to set
154 it by hand.
156 Zsh has previously been lax about whether it allows octets with the
157 top bit set to be part of a shell identifier.  Older versions of the shell
158 assumed all such octets were allowed in identifiers, however the POSIX
159 standard does not allow such characters in identifiers.  The older
160 behaviour is still obtained with --disable-multibyte in effect.
161 With --enable-multibyte in effect (this is now the default anywhere
162 it is supported) there are three possible cases:
163   MULTIBYTE option unset:  only ASCII characters are allowed; the
164     shell does not attempt to identify non-ASCII characters at all.
165   MULTIBYTE option set, POSIX_IDENTIFIERS option unset: in addition
166     to the POSIX characters, any alphanumeric characters in the
167     local character set are allowed.  Note that scripts and functions that
168     take advantage of this are non-portable; however, this is in the spirit
169     of previous versions of the shell.  Note also that the options must
170     be set before the shell parses the script or function; setting
171     them during execution is not sufficient.
172   MULITBYTE option set, POSIX_IDENTIFIERS set:  only ASCII characters
173     are allowed in identifiers even though the shell will recognise
174     alphanumeric multibyte characters.
176 The sched builtin now keeps entries in time order.  This means that
177 after adding an entry the index of an existing entry used for deletion
178 may change, if that entry had a later time than the new entry.  However,
179 deleting a entry with a later time will now never change the index of an
180 entry with an earlier time, which could happen with the previous method.
182 The completion style pine-directory must now be set to use completion
183 for PINE mailbox folders; previously it had the default ~/mail.  This
184 change was necessary because otherwise recursive directories under
185 ~/mail were searched by default, which could be a considerable unnecessary
186 hit for anyone not using PINE.  The previous default can be restored with:
187   zstyle ':completion:*' pine-directory ~/mail
189 The completion style fake-files now allows patterns as directories,
190 for example the value '/home/*:.snapshot' is now valid.  This will
191 only cause problems in the unlikely event that a directory in the style
192 has a pattern character in it.
194 The default maximum function depth (configurable with
195 --enable-max-function-depth) has been decreased to 1000 from 4096.  The
196 previous value was observed to be small enough that crashes still occurred
197 on some fairly common PC configurations.  This change is only likely to
198 affect some highly specialised uses of the shell.
200 The variables HISTCHARS and histchars now reject any attempt to
201 set non-ASCII characters for history or comments.  Multibyte characters
202 have never worked and the most consistent change was to restrict the
203 set to portable characters only.
205 Writers of add-on modules should note that the API has changed
206 significantly to allow user control of individual features provided by
207 modules.  See the documentation for zmodload -F and
208 Etc/zsh-development-guide, in that order.
210 Documentation
211 -------------
213 There are a number of documents about zsh in this distribution:
215 Doc/Zsh/*.yo    The master source for the zsh documentation is written in
216                 yodl.  Yodl is a document language written by Karel Kubat.
217                 It is not required by zsh but but it is a nice program so
218                 you might want to get it anyway, especially if you are a
219                 zsh developer.  It can be downloaded from
220                 ftp://yodl.sourceforge.net/
222 Doc/zsh*.1      Man pages in nroff format.  These will be installed
223                 by "make install.man" or "make install".  By default,
224                 these will be installed in /usr/local/man/man1, although
225                 you can change this with the --mandir option to configure
226                 or editing the user configuration section of the top level
227                 Makefile.
229 Doc/zsh.texi    Everything the man pages have, but in texinfo format.  These
230                 will be installed by "make install.info" or "make install".
231                 By default, these will be installed in /usr/local/info,
232                 although you can change this with the --infodir option to
233                 configure or editing the user configuration section of the
234                 top level Makefile.  Version 4.0 or above of the
235                 Texinfo tools are recommended for processing this file.
237 Also include in the distribution are:
239 Doc/intro.ms    An introduction to zsh in troff format using the ms
240                 macros.  This document explains many of the features
241                 that make zsh more equal than other shells.
242                 Unfortunately this is based on zsh-2.5 so some examples
243                 may not work without changes but it is still a good
244                 introduction.
246 For more information, see the website, as described in the META-FAQ.
248 If you do not have the necessary tools to process these documents, PDF,
249 Info and DVI versions are available in the separate file zsh-doc.tar.gz at
250 the archive sites listed in the META-FAQ.
252 The distribution also contains a Perl script in Utils/helpfiles which
253 can be used to extract the descriptions of builtin commands from the
254 zshbuiltins manual page.  See the comments at the beginning of the
255 script about its usage.  The files created by this script can be used
256 by example function run-help located in the subdirectory Functions/Misc to
257 show information about zsh builtins and run `man' on external commands.
258 For this the shell variable HELPDIR should point to a directory containing
259 the files generated by the helpfiles script.  run-help should be
260 unaliased before loading the run-help function.  After that this function
261 will be executed by the run-help ZLE function which is by default bound
262 to ESC-h in emacs mode.
264 Examples
265 --------
267 Examples of zsh startup files are located in the subdirectory
268 StartupFiles.  Examples of zsh functions and scripts are located in
269 the subdirectory Functions.  Examples of completion control commands
270 (compctl) are located in the file Misc/compctl-examples.
272 Zsh FTP Sites, Web Pages, and Mailing Lists
273 -------------------------------------------
275 The current list of zsh FTP sites, web pages, and mailing lists can be
276 found in the META-FAQ.  A copy is included in this distribution and is
277 available separately at any of the zsh FTP sites.
279 Common Problems and Frequently Asked Questions
280 ----------------------------------------------
282 Zsh has a list of Frequently Asked Questions (FAQ) maintained by Peter
283 Stephenson <pws@zsh.org>.  It covers many common problems encountered
284 when building, installing, and using zsh.  A copy is included in this
285 distribution in Etc/FAQ and is available separately at any of the zsh
286 ftp sites.
288 Zsh Maintenance and Bug Reports
289 -------------------------------
291 Zsh is currently maintained by the members of the zsh-workers mailing list
292 and coordinated by Peter Stephenson <coordinator@zsh.org>.  Please send
293 any feedback and bugs reports to <zsh-workers@sunsite.dk>.
295 Reports are most helpful if you can reproduce the bug starting zsh with
296 the -f option.  This skips the execution of local startup files except
297 /etc/zshenv.  If a bug occurs only when some options set try to locate
298 the option which triggers the bug.
300 There is a script "reporter" in the subdirectory Util which will print out
301 your current shell environment/setup.  If you cannot reproduce the bug
302 with "zsh -f", use this script and include the output from sourcing this
303 file.  This way, the problem you are reporting can be recreated.
305 The known bugs in zsh are listed in the file Etc/BUGS.  Check this as
306 well as the Frequently Asked Questions (FAQ) list before sending a bug
307 report.  Note that zsh has some features which are not compatible with
308 sh but these are not bugs.  Most of these incompatibilities go away
309 when zsh is invoked as sh or ksh (e.g. using a symbolic link).
311 If you send a bug report to the list and are not a subscriber, please
312 mention this in your message if you want a response.
314 If you would like to contribute to the development and maintenance of zsh,
315 then you should join the zsh-workers mailing list (check the META-FAQ
316 for info on this).  You should also read the "zsh-development-guide"
317 located in the subdirectory Util.
319 Contributors
320 ------------
322 The people who have contributed to this software project are listed
323 in Etc/CONTRIBUTORS.