1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-14 03:26:16 +02:00

Initial revision

This commit is contained in:
Tanaka Akira 1999-04-15 18:05:35 +00:00
commit c175751b50
113 changed files with 27065 additions and 0 deletions

10
.cvsignore Normal file
View File

@ -0,0 +1,10 @@
Makefile
META-FAQ
config.cache
config.h
config.h.in
config.log
config.status
configure
stamp-h
stamp-h.in

7
.distfiles Normal file
View File

@ -0,0 +1,7 @@
DISTFILES_SRC='
.cvsignore .distfiles Makefile.in
ChangeLog ChangeLog.3.0 INSTALL META-FAQ README
acconfig.h aclocal.m4 aczsh.m4 configure.in
configure config.h.in stamp-h.in
config.guess config.sub install-sh mkinstalldirs
'

5
.lastloc Normal file
View File

@ -0,0 +1,5 @@
(("/home/user2/pws/src/zsh-3.1.5/patchlist.txt" . 861)
("/home/user2/pws/src/zsh-3.1.5/patch-match" . 74776)
("/home/user2/pws/src/zsh-3.1.5/sven_fix2.dif" . 6081)
("/home/user2/pws/src/zsh-3.1.5/ci_notes.txt" . 1267)
("/home/user2/pws/src/zsh-3.1.5/configure.in" . 28530))

2328
ChangeLog Normal file
View File

@ -0,0 +1,2328 @@
Thu Oct 29 21:51:10 1998 Andrew Main <zefram@zsh.org>
* Config/version.mk: Version 3.1.5.
* Doc/Makefile.in, Doc/META-FAQ.yo: Format the plain-ASCII
META-FAQ in a manner consistent with the other plain-ASCII
documents.
* Src/exec.c: Retry reading from a pipe on EINTR, to avoid
getting truncated output. (schaefer, u1880)
* acconfig.h, aczsh.m4, configure.in, Src/compat.c, Src/system.h,
Src/watch.c: New zsh_STRUCT_MEMBER macro for structure member
tests (changes names of some existing preprocessor defines).
Test for d_ino and d_stat in struct dire[nc]t. New code in
zgetdir() to make use of d_stat if available.
* Src/params.c, Src/system.h, Src/watch.c: Move definition of
DEFAULT_WATCHFMT into watch.c (where the decision about which
utmp structure to use is made).
* Doc/Zsh/metafaq.yo: Another mirror (sunsite.doc.ic.ac.uk).
Wed Oct 28 21:02:28 1998 Andrew Main <zefram@zsh.org>
* Src/builtin.c: More accurate test for ncurses, for the benefit
of systems where ncurses' termcap.h is used.
* Etc/BUGS, Etc/CONTRIBUTORS, Etc/FEATURES, Etc/MACHINES,
Etc/NEWS, INSTALL, README, Util/zsh-development-guide:
Consistent formatting.
* Etc/NEWS: List universal-argument and POSIX character classes.
* Doc/Zsh/metafaq.yo, Etc/CONTRIBUTORS: Use more zsh.org email
addresses.
Tue Oct 27 20:23:18 1998 Andrew Main <zefram@zsh.org>
* Etc/FAQ.yo: New version, 1998-10-26. (pws)
Mon Oct 26 21:13:42 1998 Andrew Main <zefram@zsh.org>
* Doc/Zsh/guide.yo, Doc/Zsh/metafaq.yo, Etc/CONTRIBUTORS,
Functions/checkmail, Functions/run-help, Functions/zed,
Misc/compctl-examples, Misc/lete2ctl, README,
Src/Builtins/rlimits.awk, Src/Zle/zle_main.c, Src/makepro.awk,
Src/signames.awk, Util/helpfiles, Util/reporter: Consistently
use zsh.org email addresses where available. Remove some
stray individual credits from the source, in favour of the
more usual credit in ChangeLog and CONTRIBUTORS files.
* acconfig.h, configure.in, Src/watch.c: Some systems have ut_tv
in struct utmpx, rather than ut_xtime or ut_time.
Sun Oct 25 21:04:01 1998 Andrew Main <zefram@zsh.org>
* Src/exec.c: Save and restore simple_pline. (pws, 4390)
* Src/loop.c: Set isfirstln to get the right behaviour on ^D
in select. (pws, 4389)
* Src/exec.c: Don't fail to AUTO_CD if there is an improperly
hashed external command of the same name. (pws, 4426;
schaefer, 4434)
* Src/builtin.c: getopts wasn't resetting all its counters
correctly. (schaefer, 4416)
* Src/Zle/zle_tricky.c: Prevent removable suffixes remaining in
effect when a new completion is attempted.
* Doc/Zsh/compctl.yo: Add an example of usage of n[...] to the
compctl manual. (pws, u1857)
* Src/Zle/zle_main.c, Src/Zle/zle_misc.c: Give ungetkey()
external linkage.
* Doc/Zsh/zle.yo, Src/Zle/zle_misc.c: Make universal-argument
accept a typed integer, EMACS-style. (pws, 4425)
* Src/Zle/zle.h, Src/Zle/zle_misc.c: Fix neg-argument. (pws,
4420)
Sat Oct 17 17:12:31 1998 Andrew Main <zefram@zsh.org>
* Doc/Zsh/mod_files.yo: Note that mv won't move across devices.
* Doc/Zsh/expn.yo: Add some examples to the parameter expansion
section. (schaefer, 4402)
* Src/jobs.c: Unset STAT_DONE when adding a process to a job,
in case $() processes finish before all the processes have
been started. (pws, 4397)
* Doc/Zsh/builtins.yo, Src/builtin.c, Src/hashtable.c, Src/zsh.h:
type/whence/where/which -w gives machine-readable output.
(pws, 4388)
* Doc/Zsh/builtins.yo: Document the effect of unset on a local
parameter.
* Src/params.c: unset should not remove the localness of a
local parameter. (pws, 4317)
* Src/compat.c, Src/prototypes.h: Give gethostname() the right
prototype (the length argument is a size_t), and implement it
to spec.
* Doc/Zsh/metafaq.yo: New address for web-based mailing list
archive (http://www.zsh.org/mla/).
* Doc/Zsh/metafaq.yo: New mirror (foad.org).
Thu Oct 15 19:07:17 1998 Andrew Main <zefram@zsh.org>
* configure.in, Src/Modules/cap.c, Src/utils.c: Check for the
existence of cap_get_proc() rather than cap_init(), because
some systems have a different cap_init().
* Etc/MACHINES: Format changes. Removed some entries that didn't
actually contain any intelligible information.
* Etc/MACHINES: Tested on FreeBSD 2.2.7. (Roland Jesse
<jesse@prinz-atm.cs.uni-magdeburg.de>, u1770)
* acconfig.h, configure.in, Src/watch.c: Handle systems where
struct utmpx has a member named ut_time rather than ut_xtime.
* Src/parse.c: Do not require a separator after esac. (hzoli,
4376)
* Doc/Makefile.in: Ignore errors from makeinfo.
* Src/Zle/zle_thingy.c: Use permanent allocation when executing
widgets. (schaefer, 4350)
* Functions/multicomp: Fix for leading tildes; made
case-insensitive. (schaefer, 4342)
* Src/Zle/zle_utils.c: Fix an uninitialised pointer in
mkundoent(). (pws, 4315)
* config.guess: Support Netwinder (arm-unknown-linux).
(Jason Naughton <jnaughto@ee.ryerson.ca>, 4308)
* configure.in: Dynamic linking on OSF. (<simond@informix.com>,
4258)
* Misc/lete2ctl: Update for Perl5.004. Use compctl -/ and -W.
Some other fixes. (pws, 4245)
* Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo: Minor typo fixes.
(schaefer, 4232)
* Src/signals.h: A variable was being modified twice without an
intervening sequence point. (Gray Watson <gwatson@lycos.com>,
4221)
* Makefile.in: Remove spurious ";\". (Gray Watson
<gwatson@lycos.com>, 4221)
Tue Oct 13 21:42:47 1998 Andrew Main <zefram@zsh.org>
* Doc/Zsh/expn.yo, Src/glob.c: Add the [:blank:] character class
required by POSIX, which has no corresponding ctype macro.
* Doc/Zsh/expn.yo, Misc/globtests, Src/glob.c, Src/lex.c:
Add POSIX globbing character classes ([:alnum:] etc.).
(pws, 4209+4212)
Sun Oct 11 20:39:06 1998 Andrew Main <zefram@zsh.org>
* Src/Zle/zle_tricky.c: Make compctl -S '' work properly (i.e.,
suppress the addition of the default suffix). (schaefer, u1668)
* Src/loop.c: Fix the handling of empty user input to select.
(schaefer, 4200)
* Src/utils.c: Y2K bugfix in %y sequence in ztrftime().
(zefram, 4198)
* Src/init.c, Src/main.c: Abort on parse errors, except when
reading input from stdin. (pws, 4191; some semantic changes
by zefram)
* Misc/compctl-examples: Fix the setopt completion in the case
where KSH_OPTION_PRINT is set. (schaefer, 4176)
* Doc/Zsh/compctl.yo: Mention the read builtin in the
documentation of compctl -K. (sven, 4150)
* Src/Zle/zle_tricky.c: Fixed a bug where completing in a word
could duplicate part of the word due to it being in both the
common prefix and the common suffix. (sven, 4147)
* Doc/Zsh/builtins.yo, Doc/Zsh/compat.yo, Doc/Zsh/expn.yo,
Doc/Zsh/grammar.yo, Doc/Zsh/intro.yo, Doc/Zsh/options.yo,
Doc/Zsh/params.yo, Doc/Zsh/restricted.yo, Doc/Zsh/zle.yo:
Spelling/typo fixes in documentation. (schaefer, 4136)
* Misc/compctl-examples: Better implementations of the CVS
compctl functions. (schaefer, 4130)
Sun Sep 27 18:31:55 1998 Andrew Main <zefram@zsh.org>
* Doc/zsh.yo, Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo,
Doc/Zsh/expn.yo, Doc/Zsh/grammar.yo, Doc/Zsh/guide.yo,
Doc/Zsh/intro.yo, Doc/Zsh/params.yo, Doc/Zsh/redirect.yo,
Doc/Zsh/zle.yo: Clarification of the expansion documentation.
Several other documentation bugfixes. (schaefer, 4116)
* Src/Modules/rlimits.awk: Cosmetic fix of the generated file.
* Src/Modules/rlimits.awk: Avoid using the sub() function,
which some older awks lack.
* Doc/Zsh/grammar.yo: List "builtin" as a precommand modifier.
* Doc/Zsh/builtins.yo: Fuller details of the interaction between
options of the read builtin. (schaefer, 4109)
* Src/Modules/stat.c: The ls-style mode string was not being
terminated. (Goran Larsson <hoh@lorelei.approve.se>, 4105)
* Src/Zle/zle_hist.c: Make use of repeat count in history
searches. (wayne, 4104)
* Src/Zle/zle_hist.c: Some bugfixes and code simplifications
for {vi-,}{up,down}-line-or-{history,search}. (wayne, 4086)
Sat Sep 26 16:08:53 1998 Andrew Main <zefram@zsh.org>
* Etc/zsh-development-guide: Expanded the section on C coding
style. Added some notes about documentation.
* configure.in, Src/exec.c, Src/glob.c, Src/hashtable.c,
Src/init.c, Src/params.c, Src/system.h, Src/utils.c,
Src/Modules/stat.c, Src/Zle/zle_tricky.c: Cope with systems
that lack <pwd.h>, <grp.h>, nice(), getpw{ent,nam,uid}(),
getgr{gid,nam}().
* Doc/Zsh/metafaq.yo: uiarchive now mirrors ftp.zsh.org.
* Doc/ztexi.yo, Doc/Zsh/expn.yo, Doc/Zsh/options.yo,
Doc/Zsh/redirect.yo, Doc/Zsh/zle.yo: Some minor documentation
fixes. (schaefer, 4045)
* Src/hist.c, Src/input.c, Src/parse.c: Simplification and
bugfixes of the input flushing code on history and parse
errors. (pws, 4172)
* configure.in: Use "1,$s" instead of ",s" in the generated
ed script, for compatibility with historical systems.
Mon Sep 21 19:16:03 1998 Andrew Main <zefram@zsh.org>
* Src/Makefile.in: Clean up conditionals in install/uninstall
rules.
* Config/clean.mk, Config/config.mk, Src/Makemod.in.in: Avoid
empty argument list in for loops, for /bin/sh.
* aczsh.m4, configure.in, Etc/MACHINES: Check for systems with
broken static/shared library combinations, such as SINIX.
* Doc/Zsh/params.yo, Src/builtin.c, Src/params.c: Make PWD and
OLDPWD parameters non-special. (hzoli, 3990; doc by zefram)
* Src/builtin.c: Don't crash when exporting an unset special
parameter. (hzoli, 3983)
* Src/Zle/zle_utils.c: Mark sticks to preceding character instead
of the following one. (wayne, 3969)
* Src/builtin.c, Src/init.c, Src/utils.c: Set stdin to read
blockingly where appropriate. (hzoli, 3950; POSIXification
by zefram)
Mon Sep 14 14:44:32 1998 Andrew Main <zefram@zsh.org>
* Makefile.in, configure.in, Config/.distfiles, Config/config.mk,
Config/defs.mk, Config/version.mk, Doc/.cvsignore,
Doc/.distfiles, Doc/Makefile.in, Doc/paths.yo.in,
Doc/zman.yo, Doc/zsh.yo, Doc/ztexi.yo, Doc/Zsh/builtins.yo,
Doc/Zsh/filelist.yo, Doc/Zsh/files.yo, Doc/Zsh/mod_comp1.yo,
Doc/Zsh/modules.yo, Doc/Zsh/options.yo, Doc/Zsh/params.yo,
Etc/Makefile.in, Src/.distfiles, Src/Makefile.in,
Src/Makemod.in.in, Src/version.h, Src/zsh.mdd: Move version
data into a single file, Config/version.mk. Remove all site
dependencies from the documentation. Some related Makefile
cleanups.
Sun May 31 09:28:18 1998 Andrew Main <zefram@zsh.org>
* Src/version.h: Version 3.1.4.
* Doc/paths.yo.in: New date.
* configure.in, aczsh.m4, acconfig.h, Src/system.h,
Src/watch.c: Don't confuse utmp and utmpx files. Don't rely
on having a utmp structure at all.
* Src/system.h, Src/Modules/clone.c, Src/Modules/files.c,
Src/builtin.c, Src/compat.c, Src/exec.c, Src/hist.c, Src/init.c,
Src/utils.c: Use O_NOCTTY on all open() calls, to get consistent
behaviour (no controlling tty) on all systems.
* Doc/Zsh/grammar.yo: Correct and clarify the "simple commands &
pipelines" section. (schaefer, u1548; markup and some additions
by zefram)
* Src/params.c: When unsetting paired special parameters (e.g.,
CDPATH/cdpath), don't try to remove names that don't exist.
(hzoli, 3974)
Sat May 30 16:16:13 1998 Andrew Main <zefram@zsh.org>
* Src/system.h: #define _XPG_IV on SINIX (Reliant UNIX). It is
reported that this is necessary in order to get the right
version of gettimeofday().
* Doc/Zsh/grammar.yo, Src/lex.c, Src/subst.c, Src/utils.c,
Etc/NEWS: ksh93 $'' syntax. (hzoli, 3952; documentation
clarifications by zefram)
Thu May 28 21:13:04 1998 Andrew Main <zefram@zsh.org>
* Functions/checkmail: Zero-length folders don't count as
containing new mail, regardless of when they've been examined.
(hzoli, 3963)
* Src/glob.c: When globbing `foo/', stat `foo/.', so that only
directories are matched (as POSIX requires). With (-T)
qualifier, dangling symlinks should be matched as normal.
With (T-/), etc., stat the pathname *before* modification by
(T). (hzoli, 3960)
* Src/Modules/stat.c: Some old K&R compilers don't like automatic
aggregate initialisation. (hzoli, 3962)
* Src/glob.c: tail was assumed to be NULL when pattern parsing
was called. (hzoli, 3961)
* Src/builtin.c: Fix off-by-one allocation bug in read.
(hzoli, 3951)
* Src/builtin.c: Cleanup of read builtin. Also backslash should
quote characters, as well as performing line continuation.
(hzoli, 3949)
* Src/Zle/zle_tricky.c: Remove prototype cast for
yp_callback.foreach, because on some systems the prototype
is wrong. (hzoli, 3948)
* Src/math.c: Avoid an unbalanced stack error on $((0x1+0x1)).
(hzoli, 3947)
* Src/params.c: PM_UNIQUE should persist across changes of
parameter type. (hzoli, 3946)
* Etc/NEWS: List major changes from 3.0.
Tue May 26 21:39:06 1998 Andrew Main <zefram@zsh.org>
* Src/glob.c, Doc/Zsh/expn.yo: `~' alone should not trigger
globbing.
Mon May 25 21:13:41 1998 Andrew Main <zefram@zsh.org>
* Src/mkmakemod.sh, configure.in, aczsh.m4: Link modules against
$(LIBS), and include -lc in $(LIBS), in case a module requires
a function that only exists in static libraries.
* Src/makepro.awk: Change `\{' to `[{]' in regexps, because some
nawks dislike the former.
* configure.in: Use tr to avoid giving backslashes to echo
(which may interpret them).
Fri May 1 19:39:12 1998 Andrew Main <zefram@zsh.org>
* Doc/Zsh/metafaq.yo: ftp.math.technion.ac.il now mirrors
ftp.zsh.org.
Thu Apr 30 20:19:47 1998 Andrew Main <zefram@fysh.org>
* Src/version.h: Version 3.1.3.
* Doc/paths.yo.in: New date.
* Src/Modules/stat.c: Remove some unused variables.
* configure.in: Start of configuration for dynamic modules
on netbsd. (gcw)
* Doc/Zsh/metafaq.yo: New mirror (ftp.roedu.net). ftp.cs.elte.hu
and ftp.cenatls.cena.dgac.fr now mirror ftp.zsh.org.
Wed Apr 29 20:24:16 1998 Andrew Main <zefram@fysh.org>
* many files: Remove RCS Id lines.
* Etc/pubring.pgp: Change mason's DSS/DH key.
* Doc/Zsh/metafaq.yo: New mirror (sunsite.auc.dk).
ftp.math.gatech.edu now mirrors ftp.zsh.org.
Tue Apr 28 23:18:44 1998 Andrew Main <zefram@fysh.org>
* Doc/Zsh/metafaq.yo: New primary archive, ftp.zsh.org.
* Etc/FAQ.yo: New version, 1998-04-24. (pws)
* Etc/FTP-README, Etc/pubring.pgp, Etc/.distfiles: Include these
files from the FTP site in the distribution.
* configure.in, Util/mkdisttree.sh, Config/, Config/clean.mk,
Config/config.mk, Config/defs.mk Makefile.in,
Doc/Makefile.in, Etc/Makefile.in, Functions/Makefile.in,
Misc/Makefile.in, Src/Makefile.in, Src/Makemod.in.in,
StartupFiles/Makefile.in, Util/Makefile.in, .distfiles,
Config/.distfiles, Doc/.distfiles, Doc/Zsh/.distfiles,
Etc/.distfiles, Functions/.distfiles, Misc/.distfiles,
Src/.distfiles, Src/Builtins/.distfiles, Src/Modules/.distfiles,
Src/Zle/.distfiles, StartupFiles/.distfiles, Util/.distfiles:
Modify config.status to add a file inclusion facility;
this is used to remove common code from many Makefiles.
New distribution-building mechanism: `.distfiles' files list
the files to go in the distribution, and Util/mkdisttree.sh
processes these. As a result, directories in which nothing
is ever built no longer need Makefiles.
Sun Apr 26 22:08:06 1998 Andrew Main <zefram@fysh.org>
* configure.in, Src/mkmakemod.sh: Modify config.status to allow
.in files in the build tree.
Sun Apr 26 19:35:17 1998 Andrew Main <zefram@fysh.org>
* Src/glob.c: Glob patterns with | alternation at the top level
were not setting C_LAST flags correctly. (zefram, 3876)
Sun Apr 26 13:49:28 1998 Andrew Main <zefram@fysh.org>
* Src/cond.c, Src/glob.c, Src/system.h, Src/utils.c,
Src/Modules/files.c, Src/Modules/stat.c, Src/Zle/zle_tricky.c:
Use POSIX S_I* macros instead of fixed octal values. (zefram,
3875)
* configure.in, Src/params.c, Src/system.h: Don't need configure
test for sizeof(long).
* configure.in, Src/cond.c, Src/glob.c, Src/system.h,
Src/Modules/files.c, Src/Modules/stat.c, Src/Zle/zle_tricky.c:
Use S_IS* macros in all cases instead of S_IF*. Define S_IS*
macros for file types that don't exist, to avoid needing
conditionals; support readlink() similarly. Add more file
type letters to the stat module. (zefram, 3874)
Sat Apr 25 22:58:34 1998 Andrew Main <zefram@fysh.org>
* Src/Zle/zle_misc.c: Fix an array overrun in suffix removal,
caused by a signed/unsigned char mixup. (zefram, 3873)
Sat Apr 25 17:15:32 1998 Andrew Main <zefram@fysh.org>
* Src/utils.c: Make CHASE_LINKS take effect on cd, as documented.
(zefram, 3872)
* Misc/globtest, Misc/globtest.ksh, Src/glob.c: Fix for exclusions
nested inside more complex glob patterns. (pws, 3870)
Thu Apr 23 21:21:29 1998 Andrew Main <zefram@fysh.org>
* META-FAQ, Doc/META-FAQ.yo, Doc/Makefile.in, Doc/Zsh/guide.yo,
Doc/Zsh/intro.yo, Doc/Zsh/metafaq.yo, Doc/Zsh/seealso.yo:
Generate the META-FAQ and the related parts of the documentation
from a common source (Doc/Zsh/metafaq.yo). Updated list of
mirror sites.
* Src/exec.c: Back out patch 3859. NO_CLOBBER should allow
opening non-regular files (POSIX.2 clause 3.7.2). Instead fix
the errno handling. (zefram, 3869)
Wed Apr 22 21:11:30 1998 Andrew Main <zefram@fysh.org>
* Etc/BUGS, Etc/MACHINES: sed is no longer used for generating
prototypes. We also now know about /proc/self/fd.
* Misc/compctl-examples: Remove some code to cope with very old
zsh versions.
* Etc/CONTRIBUTORS, Util/zsh-development-guide, Doc/Zsh/intro.yo,
META-FAQ, README: New coordinator.
* Src/exec.c: NO_CLOBBER should prevent opening FIFOs, not just
overwriting regular files. (zefram, 3859)
Wed Apr 8 20:29:28 1998 Andrew Main <zefram@fysh.org>
* Src/version.h: Version 3.1.2-zefram4.
* Src/Zle/zle_keymap.c: Bind "^[OA" etc. as well as "^[[A".
Change vi arrow key bindings to match vi practice. (zefram)
* Src/jobs.c: Don't read tty settings when ZLE is active.
(pws, 3818)
* Src/Zle/zle_keymap.c: Don't set errflag in bindkey. (pws, 3815)
* Etc/FAQ: New FAQ version, 1998-03-24. (pws, a76)
* Misc/compctl-examples: tar completion that lists files in
the archive. (pws, u1409)
* Src/glob.c: Fix foo(:s/foo/bar). (pws, 3808)
* Src/subst.c: Fix ${i:s/foo/bar}. (pws, 3806)
* Doc/Zsh/expn.yo: Mention in the parameter expansion section
that history modifiers can be used. (pws, 3805)
Mon Apr 6 21:45:30 1998 Andrew Main <zefram@fysh.org>
* Doc/Zsh/expn.yo, Doc/Zsh/options.yo, Src/glob.c, Src/options.c,
Src/parse.c: More glob changes:
+ remove `-(...)' glob qualifier syntax
+ allow normal qualifier syntax with KSH_GLOB
+ add option BARE_GLOB_QUAL (emulation-relevant, zsh-only)
that enables glob qualifiers
+ remove the paren twiddling when using patterns in [[ ]]
and case
(zefram)
* Misc/globtests, Misc/globtests.ksh: More tests for exclusions,
which currently don't work properly. (zefram)
Sun Apr 5 20:00:40 1998 Andrew Main <zefram@fysh.org>
* Doc/Zsh/expn.yo, Doc/Zsh/options.yo, Src/glob.c: Glob changes:
+ KSH_GLOB doesn't affect parens that are not preceded by the
special characters
+ correctly handle combinations like ?(foo)##
+ parens always trigger globbing
+ with EXTENDED_GLOB, embedded `~' triggers globbing,
as the documentation already states
+ remove incorrect special handling of (^...)
+ general documentation cleanup
(zefram)
* Doc/Zsh/expn.yo, Doc/Zsh/options.yo, Misc/globtests,
Misc/globtests.ksh, Src/glob.c, Src/options.c, Src/parse.c,
Src/zsh.h: KSH_GLOB. (pws, 3764)
Sat Apr 4 15:44:05 1998 Andrew Main <zefram@fysh.org>
* Src/Zle/zle_tricky.c: expand-or-complete-prefix rewrite.
(pws, 3770)
Wed Mar 25 21:51:15 1998 Andrew Main <zefram@fysh.org>
* Src/builtin.c: getopts bugfixes. (bugs pointed out by Bernd
Eggink <eggink@uni-hamburg.de>, 3797)
* Misc/compctl-examples: Completions for ssh, nslookup, telnet,
ping, finger and gdb. (<mirar@idonex.se>, u1274; some fiddling)
* Misc/compctl-examples: pine completion. (pws, u1359)
Tue Mar 24 21:36:47 1998 Andrew Main <zefram@fysh.org>
* Src/compat.c, Src/prototypes.h: gettimeofday() returns int,
not void. (zefram)
* Misc/compctl-examples: cvs completion. (<mirar@idonex.se>,
u1243; much fiddling)
* Misc/compctl-examples: lynx completion. (Oliver Kiddle
<opk101@cs.york.ac.uk>, 3760; some fiddling for portability)
Mon Mar 23 21:18:11 1998 Andrew Main <zefram@fysh.org>
* Src/loop.c: Don't reprint the select list after non-empty input.
(Bernd Eggink <eggink@uni-hamburg.de>, 3796)
* configure.in: Display module compiler flags. (zefram)
* Src/signames.awk, Src/Builtins/rlimits.awk: Remove leading
zeros from decimal constants to avoid interpretation as octal.
* configure.in: define CLOBBERS_TYPEAHEAD for SINIX. (Andrej
Borsenkow <borsenkow.msk@sni.de>, 3737)
* Misc/compctl-examples: mount completion. (Stefan Monnier
<monnier@tequila.systemsz.cs.yale.edu>, u1238)
Sun Mar 22 19:02:04 1998 Andrew Main <zefram@fysh.org>
* Doc/Zsh/prompt.yo, Src/utils.c: %L strftime sequence to do %l
without fill. (pws, 3731)
* Src/prompt.c, Doc/Zsh/prompt.yo: %L prompt escape for $SHLVL.
(Phil Pennock <bear@dcs.warwick.ac.uk>)
* Src/Makefile.in: Use LD_RUN_PATH instead of -R. (Andrej
Borsenkow <borsenkow.msk@sni.de>, 3739)
* Etc/FAQ: New FAQ version, 1998-03-02. (pws, a75)
Thu Jan 15 23:28:02 1998 Andrew Main <zefram@fysh.org>
* Src/makepro.awk, Src/mkmakemod.sh, Src/mkmodindex.sh:
Portability fixes. (zefram, 3713)
* configure.in: Test for yp_all(), not getdomainname(), to see
if -lnsl is required. (zefram, 3715)
* Makefile.in, Src/Makefile.in, Src/Makemod.in.in: Accept
$(INSTALL) being a relative pathname, set by configure.
(zefram, 3716)
* configure.in, Src/Makefile.in: More logical name for libzsh.
Install/uninstall/clean libzsh. Link with a -R option to
indicate where libzsh will be installed. (zefram, 3714)
* Src/glob.c: Don't use up more digits in a <-> glob pattern
than the range can match. There are still several cases that
don't work; backtracking is required. (pws, 3680)
Sun Jan 11 19:22:13 1998 Andrew Main <zefram@fysh.org>
* Src/version.h: Version 3.1.2-zefram3.
* Src/builtins.c: Rewrote getopts to remove its various bugs.
Sun Jan 11 14:22:50 1998 Andrew Main <zefram@fysh.org>
* Doc/Makefile.in, Etc/Makefile.in, Functions/Makefile.in,
Makefile.in, Misc/Makefile.in, Src/Makefile.in,
Src/Makemod.in.in, StartupFiles/Makefile.in, Util/Makefile.in:
Pass on all configuration variables to all Makefiles.
* Src/mkmakemod.sh: Fix $sed_normalise script to allow for
compilation in the source tree.
Sat Jan 10 23:56:33 1998 Andrew Main <zefram@fysh.org>
* Src/version.h: Version 3.1.2-zefram2.
* Doc/Zsh/compctl.yo, Src/Zle/comp.h, Src/Zle/comp1.c,
Src/Zle/compctl.c, Src/Zle/zle_tricky.c: compctl -Y is like -X,
but performs expansion on the string. compctl -y allows the
displayed completions to be user-generated. (pws, 3636)
Sat Jan 10 16:27:30 1998 Andrew Main <zefram@fysh.org>
* Misc/compctl-examples: Use compctl -W where appropriate.
* Doc/Zsh/compctl.yo, Src/Zle/comp.h, Src/Zle/compctl.c,
Src/Zle/zle_tricky.c: compctl -W applies an invisible prefix
when matching pathnames. (pws, 3498+3502)
* Misc/compctl-examples: Use compctl -/ where appropriate.
* Doc/Zsh/compctl.yo, Src/Zle/comp.h, Src/Zle/compctl.c,
Src/Zle/zle_tricky.c: compctl -/ completes directories in the
manner of -f. (pws, 3492+3493+3495+3502)
Sat Jan 10 00:36:04 1998 Andrew Main <zefram@fysh.org>
* Makefile.in, Src/Makefile.in, Src/Makemod.in.in: make clean
fixes.
Fri Jan 9 21:04:38 1998 Andrew Main <zefram@fysh.org>
* Src/system.h, Src/zsh.h, Src/utils.c, Src/parse.c: Don't
depend on any relation between sizes of ints and pointers when
duplicating/freeing structures.
* Src/Zle/zle_refresh.c: Refresh bugfix. (schaefer, 3511)
* Util/helpfiles: Updated. (pws, 3598)
* Doc/Zsh/intro.yo: Mention the list archives.
* configure.in: Prefer -lcurses to -ltermcap on HP-UX 10.*.
(pws, 3360)
Fri Jan 9 01:28:46 1998 Andrew Main <zefram@fysh.org>
* Src/Makefile.in: ansi2knr was being built as a.out.
Wed Jan 7 23:44:16 1998 Andrew Main <zefram@fysh.org>
* Src/glob.c, Misc/globtests: Backtrack in globbing, to support
nested closures. (pws, 3513+3514+3515+3525)
* Doc/Zsh/expn.yo: Clarifications and corrections to the
documentation for history expansion modifiers. (pws, 3549)
* Src/subst.c: Fix for a typo that made RC_EXPAND_PARAM expansion
of an empty array go horribly wrong. (hzoli, 3548)
* Src/builtin.c, Src/hist.c: Neater method to remove fc commands
from the history list. (pws, 3531)
* Src/builtin.c, Src/init.c, Src/main.c: Make $(r) work.
(pws, 3526)
Wed Jan 7 22:17:31 1998 Andrew Main <zefram@fysh.org>
* Doc/Zsh/options.yo, Src/Zle/zle_tricky.c: Completion in brace
expansion, with magic suffix removal on `,' and `}' triggered by
AUTO_PARAM_KEYS. (pws, 3438; suffix code rewritten by zefram)
* Src/Zle/zle_tricky.c, Doc/Zsh/compctl.yo: Print -X explanation
iff there was not a unique match, rather than iff there were
no matches. (code: hzoli, 3423. doc: pws, 3424)
Wed Jan 7 20:44:46 1998 Andrew Main <zefram@fysh.org>
* Src/init.c, Doc/Zsh/func.yo: preexec shell function is run
immediately before running each command. (pws, u1068)
* Src/Zle/zle_main.c: Select keymap earlier; apparently
this avoids a crash in some circumstances. (Bernd Eggink
<eggink@uni-hamburg.de>, 3625)
* Src/mem.c: zrealloc() should check for out-of-memory condition.
(hzoli, 3522)
* Src/subst.c: A fix for `a="a "; print -l ${(o)=a}b'. (hzoli,
3522)
* Src/rlimits.awk: Some awks do not like || in the pattern.
(hzoli, 3522)
* Misc/c2z: Many corrections. (schaefer, 3484)
* Doc/Zsh/expn.yo: An extra paragraph explaining RC_EXPAND_PARAM
behaviour. (pws, 3417; markup brought into line with the rest
of the documentation)
* Src/zsh.h, Src/subst.c, Src/utils.c: Make parameter expansion
with RC_EXPAND_PARAM behave the same as brace expansion,
and make it make sense. (hzoli, 3403)
* Src/parse.c: Fix error recovery on inputs such as
`( [[ $I bug 10 ]] )', which previously got mangled.
(hzoli, 3383)
* configure.in, Src/Builtins/rlimits.awk: Find and correctly
handle the GNU hurd <resourcebits.h>, which defines RLIMIT_*
in an enum. (Kunihiro Ishiguro <kunihiro@zebra.org>, 3369)
* Src/glob.c: restrict leaf optimisation of recursive globs to
the case of nlink == 2. Some systems don't keep proper link
counts for directories, but will probably distinguish themselves
by having a link count of 1 or 0 for directories. (hzoli, 3368)
Tue Jan 6 23:29:43 1998 Andrew Main <zefram@fysh.org>
* Src/version.h: Version 3.1.2-zefram1.
* Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c: Rewrite of the
removable suffix mechanism. In all cases, the longest possible
meaningful suffix is added, and on following insertions the
minimum trailing part of the suffix removed in order to put
the character in a sensible place. (zefram, 3353)
* Doc/Zsh/options.yo, Src/options.c, Src/utils.c, Src/zsh.h:
Option PRINT_EIGHT_BIT, indicates that characters >= 0x80 are
printable, even if isprint() says otherwise. (pws, 3318)
* Src/Zle/zle_utils.c: Spaces were getting added to the end of
the line when menu completing. (pws, 3308)
* Src/jobs.c: Set STAT_NOSTTY in bg. The result is that
STAT_NOSTTY is set if a job is ever run backgrounded.
(Suzuki Hisao <suzuki@otsl.oki.co.jp>, 3302)
* Src/Zle/zle_tricky.c, Src/params.c: A couple of memory leaks.
(pws, 3301)
* Src/zsh.h, Src/exec.c, Src/jobs.c: New job flag STAT_NOSTTY
means don't inherit the tty settings from this job when it
exits. Is set on jobs that are started in the background.
(hzoli, 3297)
* Src/params.c: Keep actual inherited environment strings around
while importing individual variables. This is required because
the special behaviour when setting $TERM (and potentially
other variables) depends on the value of other variables.
(hzoli, 3293)
* Src/glob.c: In `*(-M)', the (-) should affect the type of stat
used for (M). (pws, 3285)
* Src/Zle/zle_refresh.c: Buffer overrun bug fix. (gcw, 3260)
* INSTALL, Makefile.in, configure.in, Src/Makefile.in,
Src/**/*.c, Src/mkbltnmlst.sh, Src/prototypes.h,
Src/signals.h, Src/signames.awk, Src/xmods.conf, Src/zsh.h,
Src/Zle/comp.h, Src/Zle/zle.h, Src/Makemod.in.in,
Src/mkmakemod.sh, Src/mkmodindex.sh, Src/zsh.mdd,
Src/Builtins/rlimits.mdd, Src/Builtins/sched.mdd,
Src/Modules/cap.mdd, Src/Modules/clone.mdd,
Src/Modules/example.mdd, Src/Modules/files.mdd,
Src/Modules/stat.mdd, Src/Zle/comp1.mdd, Src/Zle/compctl.mdd,
Src/Zle/deltochar.mdd, Src/Zle/zle.mdd, Src/conf.sed,
Src/mkstamp.sh, Src/mods.conf, Src/Builtins/Makefile.in,
Src/Modules/Makefile.in, Src/Zle/Makefile.in: Rewrite of
the module build system. Knowledge specific to each module
is localised in a .mdd file for that module. Makefiles and
headers are automatically generated. (zefram, 3252)
* Src/jobs.c: `disown' was leaking memory. (pws, 3251)
* Src/subst.c: `set "$@"' was freeing strings while still needed,
due to paramsubst() not duplicating them. (zefram, 3250)
* Src/glob.c: globbing of `foo*r~foob*' was failing, due to
the character before the ~ not being marked as being the end
of a pattern. (pws, 3249)
* Src/Zle/zle_tricky.c: AUTO_PARAM_KEYS was adding suffix
characters in the middle of a word if completing within a word.
(hzoli, 3247)
* Src/params.c: filter out garbage when importing environment
variables. (hzoli, 3246)
* Doc/Zsh/builtins.yo, Doc/Zsh/mod_compctl.yo,
Doc/Zsh/mod_sched.yo, Doc/Zsh/mod_zle.yo: Move documentation
of the standard moduleified builtins into zshmodules(1).
(zefram, 3244)
* Src/Makefile.in, Src/builtin.c, Src/exec.c, Src/glob.c,
Src/globals.h, Src/hashtable.c, Src/hashtable.h, Src/hist.c,
Src/init.c, Src/input.c, Src/jobs.c, Src/lex.c, Src/loop.c,
Src/makepro.awk, Src/math.c, Src/mem.c, Src/module.c,
Src/options.c, Src/params.c, Src/parse.c, Src/prompt.c,
Src/prototypes.h, Src/signals.c, Src/signals.h,
Src/signames.awk, Src/subst.c, Src/utils.c, Src/zsh.h,
Src/Builtins/Makefile.in, Src/Modules/Makefile.in,
Src/Zle/Makefile.in, Src/Zle/comp.h, Src/Zle/comp1.c,
Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c,
Src/Zle/zle_main.c, Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c,
Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: Move all object
declarations into .c files, so that they are processed by
makepro.awk. (zefram, 3243)
* Src/Makefile.in, Src/builtin.c, Src/exec.c, Src/glob.c,
Src/globals.h, Src/hist.c, Src/init.c, Src/jobs.c,
Src/lex.c, Src/main.c, Src/math.c, Src/mem.c, Src/options.c,
Src/params.c, Src/parse.c, Src/signals.c, Src/watch.c,
Src/zsh.h, Src/Builtins/Makefile.in, Src/Modules/Makefile.in,
Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_bindings.c,
Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, Src/makepro.sh,
Src/makepro.awk: Generate prototypes with an awk script, which
handles data declarations as well as functions. Make data
objects static where appropriate. (zefram, 3242)
* Src/builtin.c, Src/exec.c, Src/hashtable.c, Src/hashtable.h,
Src/module.c, Src/zsh.h, Src/Builtins/rlimits.c,
Src/Builtins/sched.c, Src/Modules/cap.c, Src/Modules/clone.c,
Src/Modules/example.c, Src/Modules/files.c, Src/Modules/stat.c,
Src/Zle/compctl.c, Src/Zle/zle_main.c: Use struct builtin
instead of struct binlist, avoiding some dynamic memory
allocation. (zefram, 3241)
* configure.in, Src/builtin.c, Src/Builtins/Makefile.in,
Src/Builtins/rlimits.c, Src/Modules/cap.c: Always build the
rlimits module. (zefram, 3240)
* Src/builtin.c, Src/globals.h, Src/init.c, Src/input.c,
Src/loop.c, Src/prompt.c, Src/utils.c, Src/Zle/zle.h,
Src/Zle/zle_main.c, Src/Zle/zle_refresh.c: Format prompts once
per editing session, so that they don't get changed improperly.
(zefram, 3239)
* Doc/Zsh/compat.yo, Doc/Zsh/options.yo, Doc/Zsh/prompt.yo,
Src/options.c, Src/prompt.c, Src/zsh.h: Options PROMPT_PERCENT
and PROMPT_BANG, controlling which type of sequences get
expanded in prompts. Set appropriately for sh and ksh
emulation. (zefram, 3052)
* Doc/Zsh/options.yo, Src/exec.c, Src/options.c, Src/zsh.h:
Option HIST_NO_FUNCTIONS, to exclude function definitions
from the history list. Option alias NO_LOG (from ksh).
(zefram, 3050)
* Src/init.c: When emulating sh or ksh, make the default prompts
"$ " (or "# ") and "> ". (zefram, 3004)
* Doc/Zsh/options.yo, Src/builtin.c, Src/options.c, Src/utils.c,
Src/zsh.h: Option RM_STAR_WAIT to wait ten seconds at the `rm
*' prompt. (zefram, 2999)
Tue Jun 3 06:14:14 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/version.h: zsh-3.1.2 released
* Src/params.c: Some compilers do not like ? (void *) :
* Src/jobs.c: pg(){ less;};:|pg caused suspended (tty input)
Mon Jun 2 07:52:31 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/paths.yo.in: Updated date
* Doc/paths.yo, Doc/zsh.1, Doc/zsh.texi, Doc/zshall.1,
Doc/zshbuiltins.1, Doc/zshcompctl.1, Doc/zshexpn.1,
Doc/zshmisc.1, Doc/zshmodules.1, Doc/zshoptions.1,
Doc/zshparam.1, Doc/zshzle.1: generated zsh-3.1.2 manuals
* Doc/Zsh/builtins.yo, Doc/Zsh/params.yo: Typo fixes from Tomasz
Cholewo (3163)
* Src/Zle/zle_refresh.c: Xterm cut & paste fixes from Geoff (3135)
* Src/hist.c: Fix !# history expansion during completion. From
Peter (3132)
* Doc/Zsh/builtins.yo, Doc/Zsh/compat.yo, Doc/Zsh/expn.yo,
Doc/Zsh/func.yo: Minor documentation fixes from Zefram (3125)
* Doc/Zsh/guide.yo, Doc/Zsh/intro.yo: The zsh web site moved
* Etc/FAQ, Etc/FAQ.yo: FAQ from Peter: Id: zshfaq.yo,v 1.6
1997/05/29 09:15:00 pws Exp
* Etc/Makefile.in: Do not make FAQ.yodl by default
* INSTALL: Instructions about dynamic modules and builtin modules
* Functions/zls: Improved zll module renamed to zls supporting the
ailLFd options
* Src/glob.c: The T glob flag did not work
Sun Jun 1 08:02:19 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/system.h: Use _POSIX_VDISABLE is available. Fixes ^@ in zle
on some systems.
* Src/Zle/zle_tricky.c: expand-or-complete-prefix fixed
* Src/Builtins/rlimits.c, Src/Builtins/sched.c,
Src/Modules/clone.c, Src/Modules/example.c, Src/Zle/comp1.c,
Src/Zle/compctl.c, Src/Zle/deltochar.c, Src/Zle/zle_hist.c,
Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_move.c, Src/Zle/zle_params.c, Src/Zle/zle_refresh.c,
Src/Zle/zle_thingy.c, Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c,
Src/Zle/zle_vi.c, Src/Zle/zle_word.c, Src/builtin.c,
Src/compat.c, Src/cond.c, Src/exec.c, Src/glob.c,
Src/hashtable.c, Src/hist.c, Src/init.c, Src/input.c, Src/jobs.c,
Src/lex.c, Src/linklist.c, Src/loop.c, Src/main.c, Src/math.c,
Src/mem.c, Src/module.c, Src/options.c, Src/params.c,
Src/parse.c, Src/prompt.c, Src/prototypes.h, Src/signals.c,
Src/subst.c, Src/text.c, Src/utils.c, Src/watch.c: Declare
functions used locally in one file static.
Sat May 31 07:29:53 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/comp.h, Src/prototypes.h, Src/makepro.sh,
Src/Builtins/Makefile.in, Src/Makefile.in,
Src/Modules/Makefile.in, Src/Zle/Makefile.in, Src/Zle/zle.h,
Src/module.c: Use fixed names for module make/cleanup funxtions.
Generate prototypes for static functions. Ideas from articles
3123 and 3124 from Zefram.
Thu May 29 05:17:31 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/cond.c: directories are always executable by root
* META-FAQ: The zsh web page moved.
* aclocal.m4, configure, configure.in: --enable-ansi2knr configure
option added. From Zefram (3122)
Tue May 20 05:22:16 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/utils.c: if abort or edit used on a correct prompt, do not
attempt to correct further words on the line.
Sun May 18 18:57:08 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/builtin.c, Src/exec.c, Src/init.c, Src/signals.c, Src/jobs.c:
Do not handle SIGPIPE specially for shells with job control
* Src/init.c, Src/jobs.c, Src/utils.c: (:); while true; do; done
was uninterruptible. Sometimes LINES/COLUMNS was not set
properly for non-interractive shells.
* Src/exec.c, Src/signals.c: `:`; while true; do; done was
uninterruptible
Mon May 12 09:01:55 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* configure, configure.in: on NetBSD <sys/time.h> is needed for
rlimit type checks. From Geoff.
* Src/hist.c: !:2-1 history expansion caused memory corruption
Sun May 11 08:52:00 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/lex.c: $((foo);bar) syntax works
* Src/hist.c: A terminal hangup caused coredump while saving history
* Src/globals.h, Src/init.c, Src/params.c: if we cannot get the
correct window size with ioctl, set LINES and COLUMNS from
termcap.
* Src/builtin.c: make sure zexit is not reentered when its
execution is interrupted by a signal.
Fri May 9 07:59:00 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/utils.c: print_if_link (used by whence -s) did not work well.
* Doc/zsh.texi: @br{} removed
* Src/exec.c: Quick hack: do not open file redirections if noexec
is set
* Src/jobs.c: printjobs() set errflag when the foreground process
was interrupted.
Thu May 8 09:18:56 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/cond.c: [[ -x file ]] does stat for privileged users
* Src/Zle/zle_utils.c: do no read line[ll] (which is undefined)
* Src/signals.c: flush the input queue on interrupt
* Src/lex.c, Src/parse.c: improve parsing of for ((...))
* Src/Zle/zle_tricky.c, Src/hist.c, Src/lex.c, Src/parse.c:
((foo);bar) now works
Wed May 7 14:50:08 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Etc/Makefile.in: make clean should delete generated htmls
Tue May 6 06:33:06 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Etc/Makefile.in: rules to create FAQ and FAQ.html from the yodl
source
* Doc/Makefile.in, Doc/Zsh/guide.yo, Doc/Zsh/mod_cap.yo,
Doc/Zsh/mod_clone.yo, Doc/Zsh/modules.yo, Doc/Zsh/prompt.yo,
Src/Modules/Makefile.in, Src/Modules/cap.c, Src/mods.conf,
Src/prompt.c, Src/system.h, Src/utils.c, config.h.in, configure,
configure.in: Make the shell aware of POSIX.1e capabilities and
add a cap builtin module. From Zefram (3088)
* Src/Zle/zle_main.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: vi
line range bugfix from Zefram (3094)
* Src/signals.c: WINCH traps did not work. From Peter (3093)
* Src/hashtable.h, Src/params.c: LC_* parameters stopped working
after patch 3014. From Zefram (3089)
* Doc/Zsh/builtins.yo, Doc/Zsh/restricted.yo, Src/builtin.c,
Src/hashtable.h: hash builtin fixes from Zefram (3061)
* Src/Zle/zle_thingy.c, Src/hashtable.c, Src/params.c, Src/zsh.h:
Allow adding/deleting nodes during scanhashtable. From Zefram
(3058)
Mon May 5 09:29:22 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/hist.c: % word designator fix from Bruce Murphy
<packrat@iinet.net.au> (3065)
* Doc/Zsh/builtins.yo, Src/builtin.c, Src/hashtable.h,
Src/utils.c: whence -s prints expanded symlinks (idea from
art. 3067 by Juergen A. Erhard <jae@laden.ilk.de>). Use zputs
in whence. xsymlinks return 1 iff it found some symlinks or ../
(previously it always returned 0 although it had some
never-reached return 1 statements).
* Src/params.c: zero LINES/COLUMNS should not set narrow/short
term. From Zefram (3063)
* Src/builtin.c: typeset -R UID caused a coredump
* Src/globals.h, Src/mem.c, Src/prototypes.h: alloc/ncalloc
declarations moved to globals.h. From Zefram (3057)
* Doc/Makefile.in, Doc/zsh.yo: doc install and zshall fixes. From
Zefram (3056)
* Src/prototypes.h, Src/system.h, config.h.in, configure,
configure.in: checks for memcpy and memmove. From Zefram (3055)
* Doc/Zsh/params.yo: parameter documentation improvements. From
Zefram (3051)
* Src/utils.c: simplify adjustwinsize(). Based on art. 3053 from
Zefram.
* Src/Zle/zle_main.c, Src/Zle/zle_params.c, Src/builtin.c,
Src/exec.c, Src/globals.h, Src/init.c, Src/params.c: remove
locallist. From Zefram (3049)
* Doc/Zsh/builtins.yo, Doc/Zsh/guide.yo, Doc/Zsh/params.yo,
Src/builtin.c, Src/params.c: local parameters can hide special
parameters. From Zefram (3048)
Sun May 4 06:16:44 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Builtins/Makefile.in, Src/Makefile.in,
Src/Modules/Makefile.in, Src/Zle/Makefile.in, aczsh.m4,
configure, configure.in: Strip shared modules and executables if
possible. From Zefram (3038)
* Doc/Zsh/mod_sched.yo, Doc/Zsh/guide.yo, Doc/Zsh/mod_files.yo,
Doc/Zsh/mod_stat.yo, Doc/Zsh/modules.yo,
Src/Builtins/Makefile.in, Src/Builtins/sched.c, Src/Makefile.in,
Src/builtin.c, Src/globals.h, Src/hashtable.h, Src/init.c,
Src/linklist.c, Src/mods.conf, Src/utils.c, Src/xmods.conf,
Src/zsh.h: The sched builtin moved to a separate module. From
Zefram (3037)
* Src/Builtins/rlimits.c, Src/prototypes.h, Src/hashtable.h,
Src/mods.conf, Src/xmods.conf, Src/Builtins/Makefile.in,
Src/Makefile.in, configure, configure.in: Src/Builtins directory
created. rlimits.c moved to Src/Builtins and converted into a
loadable module.
Wed Apr 30 07:40:30 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/Zsh/grammar.yo, Src/globals.h, Src/lex.c, Src/loop.c,
Src/parse.c, Src/text.c, Src/zsh.h: ksh style ;& case
fall-through feature from Zefram (3062)
* Src/text.c: printing case commands were broken. From Zefram (3062)
* Doc/Zsh/builtins.yo, Doc/Zsh/func.yo, Doc/Zsh/options.yo,
Src/builtin.c, Src/exec.c, Src/hashtable.c, Src/options.c,
Src/utils.c, Src/zsh.h: KSH_AUTOLOAD option from Zefram (3060)
* Src/module.c: Do not remove dependencies for a module when it is
unloaded. From Zefram (3033)
* Src/Zle/zle_main.c, Src/Zle/zle_tricky.c, Src/builtin.c,
Src/exec.c, Src/utils.c: get{sh,fp}func() return &dummy_list for
non-existent functions. This allows autoloading empty
functions. From Zefram (3036)
* Src/exec.c: Assume ksh-autoloading only if the autoloaded file
is a single function definition. From Zefram (3032)
* Src/Makefile.in, Src/mkbltnmlst.sh, Src/mkstamp.sh,
Src/xmods.conf, aczsh.m4, configure, configure.in: Link comp1
into the main zsh if the system lacks RTDL_GLOBAL functionality.
From Zefram (3030)
* config.h.in, configure, aczsh.m4, configure.in, Makefile.in,
acconfig.h, aclocal.m4: The config part of the nameclash patch
from Zefram (3028). The code part does not work with ansi2knr.
Mon Apr 28 07:28:34 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/comp.h, Src/Zle/comp1.c, Src/Zle/compctl.c,
Src/Zle/deltochar.c, Src/Zle/zle.h, Src/Zle/zle_bindings.c,
Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c,
Src/Zle/zle_misc.c, Src/Zle/zle_move.c, Src/Zle/zle_params.c,
Src/Zle/zle_refresh.c, Src/Zle/zle_thingy.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c,
Src/Zle/zle_word.c, Src/builtin.c, Src/globals.h, Src/init.c,
Src/zsh.h: move compctl related read stuff global variables from
the main binary into the comp1 module. From Zefram (3029)
* Src/Zle/zle_tricky.c: Yet an other suffix removal fix from
Zefram (3024)
* Src/builtin.c, Src/system.h, acconfig.h, config.h.in, configure,
configure.in, Src/Builtins/rlimits.c: Use rlim_t if available
* Doc/Zsh/builtins.yo, Doc/Zsh/restricted.yo, Src/globals.h,
Src/init.c, Src/jobs.c, Src/main.c: jobs -Z documented, improved
and disabled in restricted mode. From Zefram (3027)
* Doc/Zsh/builtins.yo, Src/hashtable.h, Src/jobs.c: jobs -d prints
the working current directory of jobs. From Peter (2889)
* Doc/Zsh/restricted.yo, Src/module.c: disallow adding module
dependencies with absolute pathnames in restricted mode. From
Zefram (3025)
* Doc/Zsh/options.yo, Src/options.c: New option aliases to please
bash users: dotglob, hashall, histappend, histexpand, mailwarn,
onecmd and promptvars. From Zefram (3026)
* Etc/FAQ.yo: from Peter: Id: zshfaq.yo,v 1.5 1997/04/24 10:19:15
pws Exp
* Etc/FAQ: April 24 1997 FAQ from Peter
* Src/Makefile.in, Src/Zle/zle_params.c, Doc/Zsh/zle.yo,
Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_main.c,
Src/exec.c, Src/hashtable.h, Src/mods.conf, Src/params.c,
Src/zsh.h: New special parameters {,L,R}BUFFER, CURSER added
only present in zle widget functions. Virtualised unset method
in struct param. pm->data modev to pm->u.data. From Zefram
(3014)
* Src/Zle/zle_thingy.c: Fix a memory leak when unloading zle with
user-defined widgets. From Zefram (3015)
* Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_main.c,
Src/Zle/zle_thingy.c, Src/Zle/zle_tricky.c, Src/builtin.c,
Src/globals.h, Src/init.c, Src/input.c, Src/loop.c, Src/utils.c,
Src/zsh.h: Remove in_vared and use a third parameter to zleread
to allow history recall. histallowed is a new zle global
variable for that. Rename inzlefunc to incompctlfunc. Add some
checks to avoid dangerous recursive zle calls. From Zefram
(3013)
* Src/Zle/zle_main.c, Src/Zle/zle_tricky.c: menu completion did
not work well with auto_param_keys. From Zefram (3011)
Sat Apr 26 06:26:11 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Functions/zed: Reenter zed if it fails to save the file
* Functions/zed: Use bindkey -L to temporarily save bindings.
From Zefram (3012)
* Src/builtin.c, Src/init.c: Do not retry failed autoloads. From
Zefram (3010)
* Src/Makefile.in, Src/mkbltnmlst.sh: non-dynamic zsh can be built
without zle. From Zefram (3008)
* Doc/Zsh/builtins.yo, Src/module.c: Rearrange modules.c.
zmodload -qu removes dependencies. From Zefram (3009)
* Doc/Zsh/builtins.yo, Src/module.c: zmodload -i -a works as one
would expect. From Zefram (3007)
* Doc/Zsh/builtins.yo, Src/module.c: zmodload -a argument swap to
allow autoloading multiple builtins from a single file in one
command. From Zefram (2997)
Fri Apr 25 06:41:36 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/zman.yo: use UPPERCASE yodl macro
* Functions/cdmatch, Misc/compctl-examples: compctl-examples
improvements from Zefram (3006)
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in,
Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c,
Src/Zle/zle_thingy.c: ZLE unload code from Zefram (3005)
* Src/options.c: NOTIFY is off in sh/ksh mode. From Zefram (3003)
* Doc/Zsh/builtins.yo, Doc/Zsh/zle.yo, Misc/compctl-examples,
Src/Zle/Makefile.in, Src/Zle/deltochar.c, Src/Zle/iwidgets.list,
Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c,
Src/Zle/zle_main.c, Src/Zle/zle_misc.c, Src/Zle/zle_move.c,
Src/Zle/zle_things.sed, Src/Zle/zle_thingy.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c, Src/Zle/zle_widget.sed,
Src/Zle/zle_word.c, Src/xmods.conf: New ZLE widgets allow
user-defind ZLE functions. From Zefram (3002)
* Src/params.c: ${foo#bar} writes to the value of foo which can be
a const causing SEGV. From Zefram (2998)
* Src/Modules/files.c: files module fixes from Zefram (2996)
* Functions/zll, Src/Modules/Makefile.in, Src/Modules/stat.c,
Src/mods.conf: stat module fixes from Zefram (2995)
* Functions/zll, Src/Modules/stat.c: stat module from Peter (2994)
* Doc/Makefile.in, Doc/Zsh/compctl.yo, Doc/Zsh/guide.yo,
Doc/Zsh/intro.yo, Doc/Zsh/mod_clone.yo, Doc/Zsh/mod_comp1.yo,
Doc/Zsh/mod_compctl.yo, Doc/Zsh/mod_deltochar.yo,
Doc/Zsh/mod_example.yo, Doc/Zsh/mod_files.yo,
Doc/Zsh/mod_stat.yo, Doc/Zsh/mod_zle.yo, Doc/Zsh/modules.yo,
Doc/Zsh/seealso.yo, Doc/zsh.yo, Doc/zshmodules.yo: Module
documentations from zefram (2994)
Sun Apr 20 07:24:12 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/init.c, Src/params.c, Src/utils.c: Remove setintenv()
Tue Apr 15 05:51:27 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_refresh.c: SGTABTYPE can contain more than one bit
set. From Geoff (2976)
* Doc/Zsh/prompt.yo, Src/prompt.c, Src/utils.c, Src/watch.c: New
escapes %K and %f inside %D{...} promt sequences. %k and %e are
now compatible with strftime(). From Peter (2963)
* Src/Zle/zle_keymap.c: bindkey -s "^X^L" "^@" produced a pound
sterling sign. From Zefram (2951)
* Src/Zle/zle_main.c: vared 1 caused a coredump. From Peter (2909)
* Src/exec.c, Src/signals.c: execute trap on EXIT in the caller's
environment. From Peter (2896)
* Src/Zle/zle_tricky.c: Autoparamkeys broken by earlier patch
fixed. From Zefram and Peter (2894)
* Src/Zle/zle_tricky.c: Clear menucur in invalidatelist(). From
Peter (2881)
* Src/Zle/zle_main.c: vared path caused permanent
allocation in arrayfixenv
Sat Apr 12 04:27:34 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_misc.c: Overwrite mode did not work
Sat Mar 8 00:17:24 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/compctl.c: Sometimes an incorrect compctl caused a core
dump. From Peter (2942)
Fri Mar 7 23:54:18 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in: zle_binding.pro is not used
* Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_refresh.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, Src/builtin.c,
Src/globals.h, Src/init.c, Src/params.c, Src/prompt.c,
Src/zsh.h: termok changed to termflags. Modified version of
art. 2970 from Geoff
Thu Mar 6 18:06:17 1997 Zoltan T. Hidvegi <hzoli@vnet.ibm.com>
* Src/init.c, Src/params.c, Src/utils.c: handle narrow and short
terminals centralized in zlevarsetfn(). From Bart and me
(2956, 2957)
Wed Mar 5 23:37:30 1997 Zoltan T. Hidvegi <hzoli@vnet.ibm.com>
* Src/Zle/zle.h, Src/Zle/zle_refresh.c: act as if single_line_zle
were set when LINES < 3. From Geoff (2865)
* Doc/zmacros.yo: Use UPPERCASE() yodl macro instead of chartable
hacks. From Zefram (2873)
* Src/Zle/zle_tricky.c: menu completing parameters removed
non-existent / suffix. From Zefram (2872)
* Src/Zle/zle_bindings.c: Some zle functions did not use
ZLE_KEEPSUFFIX. From Zefram (2871)
* Src/Zle/Makefile.in, Src/Zle/zle.h: zle_bindings doesn't define
any functions so zle_bindings.pro is not needed
* Src/loop.c: $? was incorrectly reset before executing case,
while, for
Tue Feb 18 20:59:51 1997 Zoltan Hidvegi <hzoli@vnet.ibm.com>
* Src/Zle/zle_bindings.c: M-p and M-n defaults to
history-beginning-search-*
* Src/builtin.c: getopts handling of required argument fix from
Andrew Robinson (2846)
* Src/builtin.c, Src/globals.h, Src/hist.c, Src/lex.c, Src/zsh.h:
History fixes: fc -AI;fc -R now do not confuse hist_ignore_dups
and some other cleanups from Peter (2845). Contains changes
from articles 2748 and 2755.
* Src/signals.c: An #ifdef SIGWINCH was missing. From Hrvoje
Niksic <hniksic@srce.hr> (2844)
* Src/Modules/files.c: fix problems on machines with unsigned long
mode_t. From Zefram (2843)
* Doc/Makefile.in, Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo,
Doc/Zsh/expn.yo, Doc/Zsh/guide.yo, Doc/Zsh/prompt.yo,
Doc/Zsh/restricted.yo, Doc/zman.yo, Doc/zsh.yo, Doc/ztexi.yo,
configure.in: Various documentation fixes from Zefram (2842)
* Src/exec.c: return from a function called from a loop breaked
the loop
* Src/lex.c: eval \$\{$#\} did not work
Tue Feb 11 20:25:59 1997 Zoltan Hidvegi <hzoli@cs.elte.hu>
* config.h.in, Src/compat.c, Src/utils.c, configure, configure.in:
stupid AIX 3.2 does not have fchdir
Tue Jan 28 00:57:37 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/version.h: zsh-3.1.1 released
* Doc/paths.yo, Doc/zsh.1, Doc/zsh.texi, Doc/zshall.1,
Doc/zshbuiltins.1, Doc/zshcompctl.1, Doc/zshexpn.1,
Doc/zshmisc.1, Doc/zshoptions.1, Doc/zshparam.1, Doc/zshzle.1:
yodl generated generated documentation
Mon Jan 27 22:04:29 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/signals.c: temprarily set breaks to zero when executing a trap
* Src/exec.c: do not reset breaks in doshfunc
* Src/parse.c: words following for ((...)) are in command position.
Sun Jan 26 23:29:48 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/builtin.c, Src/hashtable.h: fix cd -, use unrecognized
option arguments literally
* Src/exec.c: localoptions should not restore RESTRICTED
* Src/signals.c: terminate a restricted shell if an untrapped INT
signal is received
* Src/init.c: set noerrexit to -1 in setupvals()
Sat Jan 25 20:07:46 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/subst.c, Src/utils.c: some assignments were missing from my
spacesplit fix
* Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.23 1997/01/24 13:21:16
pws Exp
* config.h.in, configure, configure.in: check for setsid()
* Src/Modules/Makefile.in, Src/Modules/clone.c: new builtin: start
a forked instance of the current shell on a new terminal
Thu Jan 23 15:45:27 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_refresh.c, Src/globals.h, Src/prompt.c:
redisplay fix for multiline prompts from Geoff (2817)
* Src/subst.c, Src/utils.c: a${=:- }b expanded to `ab'
* Doc/Zsh/compctl.yo, Doc/Zsh/guide.yo, Doc/Zsh/options.yo,
Doc/Zsh/restricted.yo, Doc/zsh.yo, Doc/zshmisc.yo: RESTRICTED
option documentation
* Doc/Makefile.in: generate everything with yodl
* Doc/zman.yo, Doc/ztexi.yo: itemize environment added
* Src/module.c: disable zmodload -a and loading explicitely given
modules when restricted
* Doc/Zsh/zle.yo: what-cursor-position zle function documented
Wed Jan 22 00:54:02 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/Zsh/builtins.yo: cd -sLP documentation
* Doc/Zsh/builtins.yo, Src/module.c: zmodload -au removes defined
but not yet loaded builtins
Tue Jan 21 20:38:24 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/ztexi.yo: sitem() fix for TeX
* Misc/compctl-examples: limit/unlimit compctl improvemenmt
* Doc/Zsh/builtins.yo, Doc/ztexi.yo: TeX changes
Mon Jan 20 21:11:22 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/hashtable.h, acconfig.h, config.h.in, configure,
configure.in: some old compilers cannot initialise a union
* Src/Zle/zle.h, Src/Zle/zle_keymap.c, Src/options.c: changes for
K&R compilers
* Src/Zle/deltochar.c: deltochar is IN_ZLE
* Src/Modules/files.c, Src/Zle/zle_misc.c, Src/mem.c: stupid SunOS
4 has broken headers
* Src/system.h: cast alloca in VARARR
* Src/Zle/zle_bindings.c, Src/Zle/zle_keymap.c,
Src/Zle/zle_misc.c: what-cursor-position zle function added
* Src/Zle/zle_utils.c: move the mark when characters are
inserted/deleted. From Peter (2807)
* Src/builtin.c, Src/hashtable.h: bash/ksh compatible cd -LP options
* Src/utils.c: lchdir fix
* Src/Modules/files.c: rm -r works with arbitrary deep
hierarchies. rm -r can be interrupted
Sun Jan 19 13:30:36 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/glob.c: glob arbitrary deep directory structures
* Src/mem.c, Src/Zle/zle_keymap.c, Src/subst.c, Src/utils.c,
Src/zsh.h: add real hrealloc()
Sat Jan 18 22:34:17 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_keymap.c: in bindkey -s the string was not zrdupped.
* Src/utils.c: after Zefram's changes getkeystring should return
the result on the heap
* Src/utils.c: fix file descriptor leak in lchdir
* acconfig.h, config.h.in, configure, configure.in: use the
AC_FUNC_STRCOLL builtin autoconf test
* Src/subst.c, Src/system.h, config.h.in, configure, configure.in:
alloca() and VARARR macro added which defines a variable sized
automatic array
Tue Jan 14 23:17:34 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/glob.c: debugging changes (the change is mostrly reindentation)
* Src/Zle/zle_move.c: vi-goto-column did not move to the last column
* Src/glob.c: some old C compilers cannot use typedefed type
defined function prototypes
* Src/exec.c: PATH=foo somecommand gives error in restricted mode
* Src/options.c, Src/init.c: the -r command line option turns on
restricted mode
Mon Jan 13 21:28:35 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/builtin.c, Src/exec.c, Src/hashtable.h, Src/init.c,
Src/options.c, Src/params.c, Src/text.c, Src/zsh.h: RESTRICTED
option added
Sun Jan 12 01:00:04 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_tricky.c: automenu starts iff lastambig is true.
From Zefram (2781)
* Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c,
Src/Zle/zle_main.c, Src/Zle/zle_move.c: add ZLE_LASTCOL flag to
zle-commands which set lastcol. From Zefram (2780)
* Src/Zle/deltochar.c, Src/Zle/zle.h, Src/Zle/zle_bindings.c,
Src/Zle/zle_hist.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c: zle removable suffix
cleanup. ZLE_INSERT and ZLE_DELETE is gone and ZLE_KEEPSUFFIX
added for commands which do not remove autoremovable suffixes.
From Zefram (2779)
* Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_utils.c: remove
some code duplications and undo fixes. From Zefram (2769)
Sat Jan 11 23:45:50 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/compat.c: lstat is defined to stat on systems without lstat
* Src/system.h: define lstat(X,Y) instead of lstst if HAVE_LSTAT
is not defined
* Src/Zle/zle_tricky.c: ll was not restored for xorrec
* Src/builtin.c: read -l forgot to duplicate line before assignment
* Src/jobs.c: do not execute trap when only the child receives the
signal. Based on article 2480 from Zefram.
* Src/builtin.c, Src/jobs.c: move job control builtins to jobs.c
* Src/builtin.c: fix bugs when there was no current job after disown
Thu Jan 9 16:07:31 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/rlimits.c: zstrtorlimit was defined instead of zstrtorlimt
* Src/Modules/Makefile.in, Src/Zle/Makefile.in: some buggy makes
could not find out how to make .so from .c
Wed Jan 8 22:02:51 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/Zsh/zle.yo, Doc/zsh.texi, Doc/zshzle.man, Src/Zle/zle.h,
Src/Zle/zle_bindings.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_utils.c: zle undo rewrite from Zefram (2746)
* Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_main.c,
Src/Zle/zle_misc.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c,
Src/utils.c: feep() just sets a flag and the main zle loop calls
beep() when this flag is set so multiple feeps cause only one
beep. From Zefram (2745)
* Src/hist.c, Src/main.c, Src/utils.c: use shout instead of stderr
where appropriate. From Zefram (2743)
* configure, configure.in: on NetBSD <sys/time.h> is needed for
rlimit type checks. Based on article 2742 from Geoff
* Src/builtin.c: empty cd caused a coredump
* Doc/Makefile.in: texi -> dvi suffix rule added
* Doc/Zsh/redirect.yo: fix a typo. From Zefram (2685)
* Doc/Zsh/expn.yo, Doc/Zsh/grammar.yo: brace related bugfixes
* Doc/Makefile.in, Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo,
Doc/Zsh/compat.yo, Doc/Zsh/compctl.yo, Doc/Zsh/cond.yo,
Doc/Zsh/exec.yo, Doc/Zsh/expn.yo, Doc/Zsh/filelist.yo,
Doc/Zsh/files.yo, Doc/Zsh/func.yo, Doc/Zsh/grammar.yo,
Doc/Zsh/guide.yo, Doc/Zsh/index.yo, Doc/Zsh/intro.yo,
Doc/Zsh/invoke.yo, Doc/Zsh/jobs.yo, Doc/Zsh/options.yo,
Doc/Zsh/params.yo, Doc/Zsh/prompt.yo, Doc/Zsh/redirect.yo,
Doc/Zsh/seealso.yo, Doc/Zsh/zle.yo, Doc/paths.yo.in,
Doc/zmacros.yo, Doc/zman.yo, Doc/zsh.yo, Doc/zshbuiltins.yo,
Doc/zshcompctl.yo, Doc/zshexpn.yo, Doc/zshmisc.yo,
Doc/zshoptions.yo, Doc/zshparam.yo, Doc/zshzle.yo, Doc/ztexi.yo:
documentation rewritten into yodl format by Zefram.
Tue Jan 7 23:10:24 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/params.c, Src/builtin.c, Src/exec.c: print error when
changing read-only variables, prevent core dump when assigning
an array to read-only scalar and some other fixes
* Src/Zle/zle_tricky.c: compctl -S bugfix
Mon Jan 6 20:43:36 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/exec.c, acconfig.h, config.h.in, configure, configure.in:
better /dev/fd filesystem check
* Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_tricky.c: make
dependency cleanups
* Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_keymap.c,
Src/Zle/zle_things.sed: autogenerate the enum of z_* and t_*
macros. From Zefram (2731)
* Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c,
Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_move.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: zle
prefix commands rewrite from Zefram (2722)
* Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c:
history-search-*ward serch for complete words. From Zefram
(2721, 2730)
* Doc/zsh.texi, Doc/zshbuiltins.man, Src/Zle/zle_keymap.c,
Src/Zle/zle_main.c: remove bindkey -u -U options. From Zefram
(2711)
* Src/Zle/Makefile.in, Src/Zle/deltochar.c, Src/Zle/zle.h,
Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c,
Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_thingy.c, Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c,
Src/mods.conf: first zle extendability patch from Zefram (2710)
Sun Jan 5 23:33:32 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/builtin.c, Src/exec.c: do builtin autoloading in execcmd and
do not ignore BINF_PSPECIAL and BINF_MAGICEQUALS flags for the
builtin being loaded
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in,
Src/builtin.c, Src/prototypes.h, Src/rlimits.c, Src/utils.c:
move limit/ulimit/unlimit builtins to rlimits.c
* Src/builtin.c, Src/system.h, Src/utils.c, acconfig.h,
config.h.in, configure, configure.in: checks for quad_t and
unsigned resource types
* Src/Modules/example.c, Src/Modules/files.c: the copyright notice
was different from the rest of the code
* Src/jobs.c: set_clktck() function added
* Src/compat.c, Src/Modules/files.c, Src/builtin.c, Src/utils.c,
Src/zsh.h: safe rm and cd which do not follow any symlinks
* Src/builtin.c, Src/rlimits.awk: safe fallback when RLIM_ macros
are not found
* Src/Zle/zle_main.c: EOF ignored in interactive mode when not in
the first line. From Peter (2713)
Fri Jan 3 02:26:03 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Misc/compctl-examples: setopt/unsetopt compctl fixes
* Src/Zle/comp.h, Src/Zle/comp1.c, Src/Zle/compctl.c,
Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/mods.conf, Src/xmods.conf, Src/Zle/Makefile.in: compctl base
module. compctl no longer depends on zle instead both zle and
compctl depends on this new comp1 module. From Zefram (2700)
* Src/Zle/zle.h, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c,
Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c,
Src/Zle/zle_utils.c, Src/utils.c: add showmsg() which displays
an arbitrary message below the ZLE buffer and minibuffer. From
Zefram (2699)
* Src/Zle/zle_keymap.c, Src/hashtable.c: omit resize option from
emptytable thus make is available as a generic emptytable
method. From Zefram (2698)
* Src/Zle/zle_utils.c: literal ^ characters were not escaped when
printing key sequences. From Zefram (2689)
* Src/utils.c: finddir() now can cope with arbitrary long
directories. From Zefram (2688)
* Src/prompt.c: my long directories in prompt fix broke prompt
truncation. From Zefram (2687)
Thu Jan 2 20:57:33 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* configure, configure.in: alpha-linux defines signals in
<asm/signum.h>. From David Krinsky <krinsky@hcs.harvard.edu>
(2706)
* Src/Makefile.in: . does not set positional parameters
* Src/builtin.c, Src/compat.c: zchdir returns -2 when it looses
the current directory.
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in,
Src/Zle/compctl.c, Src/Zle/zle.h, Src/params.c, Src/zsh.h:
header dependencies and inclusions fixes from Zefram (2697)
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in,
Src/conf.sed, Src/mkbltnmlst.sh, Src/mkstamp.sh, Src/mods.conf,
Src/xmods.conf: more Makefile fixes from Zefram (2703)
* Src/Modules/files.c, Src/utils.c: files module rm -r fixes
* Src/Modules/files.c: make rm -r safe so that it never follows
symlinks.
* Src/utils.c (lchdir): paranoid chdir which does not follow
symlinks. From Zefram (2690)
* Src/Modules/Makefile.in, Src/Modules/files.c: module with
builtin ln, mkdir, mv, rm, rmdir, sync utilities. From Zefram
(2621)
* Src/compat.c: do not use lstat if HAVE_LSTAT is not defined
* Src/conf.sed, Src/mkbltnmlst.sh, Src/mkstamp.sh: move big shell
scripts from the Makefile to separate files.
Wed Jan 1 20:04:06 1997 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/options.c: remove union initialisation hacks and use optno
for aliases
* Src/params.c, Src/hashtable.h: remove the struct iparam hack
which assumed that sizeof(long) == sizeof(void*)
* Src/system.h, configure, configure.in: dgux CLOBBERS_TYPEAHEAD.
From Roderick Schertler <roderick@gate.net> (2623)
Tue Dec 31 02:28:09 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in:
improve proto dependency rules
* Doc/zshbuiltins.man, Doc/zshzle.man, Src/Zle/Makefile.in,
Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c,
Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_move.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c,
Src/hashtable.c, Src/mods.conf, Src/utils.c, Util/reporter:
keymap rewrite from Zefram (2648)
* Src/Makefile.in: avoid using -nt test operator
* Src/Zle/zle_tricky.c, Src/params.c, Src/utils.c: use
dupstrpfx/ztrduppfx
Mon Dec 30 23:24:46 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in, Src/init.c, Src/mods.conf, Src/xmods.conf:
automatic generation of linked-in module boot code and automatic
autoload code. From Zefram (2647)
* Src/utils.c: dupsctruct/freestruct now work even if sizeof(int)
!= sizeof(void*)
* Src/options.c: option initialisation did not work on Alpha
* Src/Makefile.in: some sh's do not like empty for lists
* Src/options.c: use short instead of enum
* Src/globals.h, Src/input.c, Src/lex.c, Src/zsh.h: after alias
foo='echo ' ; alias bar=foo, foo bar should expand to foo echo.
From Peter (2558)
* Src/compat.c: zgetcwd's result should not be freed
* Src/prompt.c (putpromptchar): handle long pwd
* Src/builtin.c, Src/compat.c, Src/init.c: zgetcwd's result should
not be freed
* Src/glob.c: make functions only called from glob.c static.
Rearrange functions so that they are already defined when first
referenced.
Sun Dec 29 22:34:21 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/zsh.texi, Doc/zshexpn.man, Doc/zshmisc.man, Src/glob.c,
Src/lex.c: brace related bugfixes
* Src/glob.c, Src/utils.c: fix a buffer overflow bug in parsecomp()
* Src/exec.c, Src/loop.c, Src/parse.c: case argument should not be
globbed
Sat Dec 28 19:55:04 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/options.c (optlookup): no prefix was ignored
* Src/Makefile.in, Src/Modules/example.c, Src/Zle/compctl.c,
Src/Zle/zle_main.c, Src/init.c, Src/module.c, Src/zsh.h:
addbuiltins() and deletebuiltins() functions to add/delete a
group of builtins. From Zefram (2646)
Fri Dec 27 23:33:20 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Modules/example.c, Src/Zle/compctl.c, Src/Zle/zle_main.c,
Src/init.c, Src/module.c: addbuiltin can now set all members of
the builtin structure. From Zefram (2643)
* Src/options.c: set ALWAYSLASTPROMPT, APPENDHISTORY, AUTOLIST,
AUTOMENU, AUTOPARAMKEYS, AUTOPARAMSLASH, AUTOREMOVESLASH,
LISTAMBIGUOUS, LISTTYPES options by default
* Src/main.c, Src/options.c, Src/zsh.h: use the hastable functions
for optiontab instead of the optns array.
* Src/exec.c: minor noclobber changes
Thu Dec 26 22:43:13 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/exec.c, Src/hist.c, Src/lex.c, Src/mem.c, Src/params.c,
Src/subst.c, Src/text.c, Src/utils.c: all "can't happen"
messages start with a BUG: From Zefram (2633)
* Src/Makefile.in: better rules for version changes
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in:
some Makefile cleanups
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in,
configure, configure.in: use ..o suffix for module objects.
From Zefram (2632)
* Src/Makefile.in, Src/init.c, Src/zsh.h: only init.o depends on
zshxmods.h. From Zefram (2631)
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in:
some hacks to get parallel make work. From Zefram (2630)
* Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c,
Src/Zle/zle_main.c, Src/Zle/zle_misc.c, Src/Zle/zle_move.c,
Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c,
Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, Src/Zle/zle_word.c,
Src/globals.h, Src/init.c, Src/module.c, Src/zsh.h: zle module
autoloading interface cleanup from Zefram (2627)
* Src/Zle/compctl.c, Src/Zle/zle_main.c: remove unnecessary
contitional code for printcompctlp. From Zefram (2629)
* Src/module.c: print error message when module's boot/cleanup
function not found. From Zefram (2628)
* Src/module.c: zmodload -L did not handle module names starting
with `-'. From Zefram (2626)
* Doc/zshbuiltins.man, Src/hashtable.h, Src/module.c,
Util/reporter: zmodload -a lists builtins declared for
autoloading. -L prints everything in sourcable format. From
Zefram (2620)
* Src/Zle/zle_main.c, Src/hashtable.c, Src/options.c,
Src/params.c, Src/zsh.h: Make ZSH_HASH_DEBUG less visible. From
Zefram (2619)
* Src/builtin.c, Src/compat.c, Src/utils.c: handle arbitrary long
pathnames in pwd
Wed Dec 25 16:04:45 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/zsh.texi, Doc/zshoptions.man, Src/Makefile.in,
Src/Zle/zle_tricky.c, Src/builtin.c, Src/glob.c, Src/globals.h,
Src/init.c, Src/main.c, Src/params.c, Src/prototypes.h,
Src/utils.c, Src/zsh.h, Src/options.c: New hash table for
options, option aliases. From Zefram (2612)
Tue Dec 24 02:25:20 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_tricky.c, Src/glob.c, Src/hashtable.c, Src/utils.c:
move . and .. special case handling into zreaddir(). From
Zefram (2617)
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in:
parallel make support gone again as it always rebuilt everything
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in:
More Makefile cleanups. Parallel make now runs fine
* Src/Zle/zle.h, Src/Zle/zle_main.c, Src/globals.h, Src/init.c,
Src/main.c, Src/module.c, Src/zsh.h, Src/Makefile.in,
Src/Modules/Makefile.in, Src/Zle/Makefile.in: module makefile
improvements, better support for builtin modules. From Zefram
(2611)
Sat Dec 21 02:00:12 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/version.h: zsh-3.1.0 released
* Makefile.in: modifications for the beta series
* Src/Zle/zle_main.c, Src/globals.h, Src/hist.c, Src/module.c,
Src/zsh.h: changes to allow compilation on SunOS 4 with K&R
compiler
* Doc/zsh.texi, Doc/zshbuiltins.man, Src/builtin.c, Src/hashtable.h:
pwd now accepts -L and -P to be compatible with bash and ksh
* configure, configure.in: SunOS 4 shared libraries do not work
when they are stripped
Thu Dec 19 21:27:17 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/init.c: work around a bug in NeXTStep 3.2 which caused slow
refresh
* Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.22 1996/12/19 09:52:11
pws Exp
Wed Dec 18 23:51:24 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Doc/zsh.texi, Etc/FAQ, META-FAQ: ftp.prz.tu-berlin.de no longer
mirrors zsh, uiarchive.uiuc.edu name correction
Tue Dec 17 20:08:58 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/params.c: remove some compiler varnings
* Src/Makefile.in: rlimits.h depends on rlimits.awk. Cosmetic
changes. From Zefram (2589)
Mon Dec 16 03:33:12 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* README: unknown limits should no longer be a problem
* Src/glob.c: toggles were not reset after a comma in a glob
qualifier list (e.g. *(@-.,/))
* Src/builtin.c: fg %% failed and disabled job control sometimes
when there were no current job
Sun Dec 15 01:07:40 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* README: beta warning
* Misc/compctl-examples: compctl for zmodload
Sat Dec 14 22:50:00 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_main.c: Remove unnecessary prefix delay in zle.
From Zefram (2583)
* Src/exec.c (execcmd): builtin < / > / closed stdin
* configure, Src/Makefile.in, Src/builtin.c, Src/rlimits.awk,
configure.in: awk generated rlimits from Peter (2573)
* config.guess, config.sub, configure, configure.in: upgrade to
autoconf-2.12. Linux machines are still recognized without the
-gnu suffix
* configure, configure.in: working fifos should be tested in /tmp
Wed Dec 11 02:30:39 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_tricky.c, Src/builtin.c, Src/exec.c, Src/globals.h,
Src/hist.c, Src/init.c, Src/input.c, Src/lex.c, Src/zsh.h:
remove the alias stack and fix several related bugs. From Peter
(2548, 2551)
* Doc/zsh.texi, META-FAQ: ftp mirror site changes
* Src/params.c: use the heap in getstrvalue()
Tue Dec 10 02:27:35 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_refresh.c: single line zle refresh bugfix from Geoff
(2549)
* Src/subst.c: ${(l:4:)foo} stopped working between 3.0.0 and 3.0.1
* Src/math.c: $((#\c)) character code expansion did not work when
c was a metafied
* Src/params.c: $foo[i] did not work when foo[i] was a metafied
character
* Src/builtin.c: use the heap in zexit()
Sun Dec 8 21:32:06 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/utils.c, Doc/zshbuiltins.man, Src/hashtable.h, Src/module.c:
zmodload can be used to define atoloaded builtins and module
dependencies
* Doc/zsh.texi, Doc/zshoptions.man: options documentation
improvements from Zefram (2529)
* Src/globals.h, Src/hist.c, Src/zsh.h: HIST_REDUCE_BLANKS from
Wayne (2446)
* Etc/FEATURES, Etc/NEWS: news in zsh-3.1
* Src/hashtable.h: security: do not import MODULE_PATH
* Src/input.c: no further input should be attempted when lexstop
is true (e.g. after eof).
* Src/Makefile.in: make tags fix
* Misc/compctl-examples: MH compctl changes from Peter (2535)
* Src/Zle/zle_tricky.c, Src/glob.c, Src/hashtable.c, Src/utils.c:
unmetafy did not put a null terminator to the end of the string.
zreaddir discarded the metafied filename. readdir was used
instead of zreaddir in zle_tricky.c. From Zefram (2533)
* Src/Zle/zle_vi.c: vi-replace-chars now emulates better the real
vi. From Zefram (2496)
* Src/jobs.c: CLK_TCK is 60 on NeXT not 64 as defined in the
system headers. From Robert F Tobler
<rft@raven.cg.tuwien.ac.at> (2522)
* Src/input.c, Src/zsh.h: alias foo='a=b foo' ; foo caused an
infinite loop. From Peter (2515)
* Src/builtin.c, Src/zsh.h: put hash tables to a linked list when
hash-debug is enabled and move the simplified bin_hashinfo into
hashtable.c. From Zefram (2509)
* Src/builtin.c, Src/Zle/compctl.c: more bad option fixes. Make
the getopts builtin 8-bit clean. From Zefram (2508)
* Src/builtin.c: show metafied characters correctly in bad option
errors. From Zefram (2497)
Thu Dec 5 03:59:45 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in, Src/Modules/Makefile.in, Src/Modules/example.c,
Src/Zle/Makefile.in, Src/Zle/deltochar.c, Src/Zle/zle.h,
Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, Src/Zle/zle_main.c,
Src/Zle/zle_misc.c, Src/Zle/zle_move.c, Src/Zle/zle_refresh.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c,
Src/Zle/zle_word.c, Src/builtin.c, Src/globals.h,
Src/hashtable.c, Src/hashtable.h, Src/init.c, Src/input.c,
Src/loop.c, Src/main.c, Src/module.c, Src/modules-bltin,
Src/prompt.c, Src/prototypes.h, Src/utils.c, Src/zsh.h,
configure, configure.in: Move zle into a separate directory and
convert it to an optional auto-loadable module. Create Modules
subdirectory. Many Makefile changes. boot_modname and
cleanup_modname is back since on elf all module use one common
name space. Lots of other changes.
Wed Nov 27 03:20:53 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_main.c, Src/Zle/zle_vi.c: ANSI was broken and fixed
again in zle_main.c ESC in vi command mode caused SEGV. From
Zefram (2479)
* configure, configure.in: -pedantic is used with
--enable-zsh-debug. Link non-debugged zsh with -s. From Zefram
(2479)
Tue Nov 26 02:45:15 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/exec.c: the STTY parameter did not work well when pipes were
used. From Peter (2474)
* Src/Zle/zle_main.c: little fix for the bindkey patch from Peter
(2470)
* Doc/zshbuiltins.man, Src/Zle/zle.h, Src/Zle/zle_bindings.c,
Src/Zle/zle_hist.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c, Src/builtin.c,
Src/globals.h, Src/hashtable.c, Src/init.c: big multi-character
key bindings fix from Zefram (2464)
* Doc/zshbuiltins.man, Src/hashtable.h, Src/module.c, Src/zsh.h:
The -f option of zmodload is removed. Improved zmodload
documentation.
* Src/hashtable.h, Doc/zshbuiltins.man, Src/module.c: zmodload
with -i will not complain and will succeed without doing
anything if an already loaded module is loaded or a non-loaded
module is unloaded. From Zefram (2463)
* Doc/Makefile.in, Doc/zshbuiltins.man, Doc/zshparam.man: zmodload
documentation. It only appears in the final manual if dynamic
modules are enabled. Note that the texinfo documentation is
still missing. From Zefram (2460)
* Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.21 1996/11/25 09:13:28
pws Exp
Mon Nov 25 02:39:08 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/module.c: try to load the modules with .DL_EXT appended
first. Honor PATH_DIRS when loading a module.
* Src/Makefile.in: handle force ruleas as in the top-level Makefile
* Makefile.in, Src/Makefile.in, Src/init.c: module install added,
default module_path is $(libdir)/zsh/$(VERSION). From Zefram
(2458 and 2465 with modifications)
* Src/Makefile.in: optimized and made more silent
* Src/Makefile.in, Src/Modules/example.c, Src/Zle/deltochar.c,
Src/init.c, Src/main.c, Src/module.c: modules can now statically
compiled into zsh. From Zefram (2455)
Sun Nov 24 22:44:12 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Zle/zle_move.c: vi-goto-mark fix from Thorsten
* Src/utils.c: dupnode mergerd into the simplified dupstruct2,
freetreenode merged into the simplified freestruct
* Src/globals.h, Src/text.c, Doc/zsh.texi, Doc/zshmisc.man,
Src/lex.c, Src/loop.c, Src/parse.c, Src/utils.c, Src/zsh.h: for
((expr; expr; expr)) command added
Sat Nov 23 23:34:58 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/exec.c:
((...)) substituted the expression twice and coredumped on (())
* Doc/zsh.texi, Doc/zshcompctl.man: compctl -e clarification from
Peter (2453)
* Src/hist.c (hend): minor cleanup from Wayne (2447)
* Doc/zsh.texi, Doc/zshzle.man, Src/Zle/zle_hist.c:
insert-last-word with numeric arguments inserts the given word
from the previous history event. From Bart (2445),
documentation by me.
* Src/subst.c, acconfig.h, config.h.in, configure, configure.in:
added configure check for variable-length automatic arrays
Wed Nov 20 00:58:06 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/utils.c: The spell checker always tries to fix as many
leading directory compontents as possible. From Bart (2429)
* Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c,
Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c: the source was not ANSI
C compatible. From Thorsten Meinecke <kaefer@aglaia.aball.DE>
* Src/Zle/zle_tricky.c: my spell-word fix used an uninitialised
pointer. Fix from Bart (2428)
Sun Nov 17 21:21:22 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in: fix the .SUFFIXES list
* Src/module.c: do not call dlclose() if cleanup_module failed
(returned nonzero)
* Src/Makefile.in, Src/init.c, Src/main.c, Src/prototypes.h,
configure, configure.in: try to support dynamic loading on SVR4
systems
* config.h.in: Makefile and configure fixes from Zefram (2416)
* Src/params.c: remove a few memory leaks when initialising the
parameter table.
* Src/exec.c, Src/zsh.h: allow arbitrary number of multios. From
Zefram (2414)
* Src/exec.c, Src/parse.c, Src/text.c, Src/zsh.h: do not convert
((...)) to builtin let internally.
Sat Nov 16 23:57:40 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/zle_tricky.c: spell-word zle function did not work for word
beginning with a tilde
* Src/hist.c: histignoredups ignores insignificant whitespace
changes. From Peter (1949)
* Src/zle_main.c: execute-last-named-cmd may point to an already
removed zle function after a zle module is deleted. From Zefram
(2418)
* Doc/Makefile.in: give some explanation if the user compiling zsh
has no makeinfo
* configure.in: fix a problem introduced by patch 2338. From
Zefram (2416)
* Makefile.in, acconfig.h, configure.in: Makefile and configure
fixes from Zefram (2416)
* Src/zle_tricky.c: the cursor moved back on TAB when it was on
"". From Zefram (2415)
Thu Nov 14 12:59:25 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/zle_refresh.c: one more refresh fix from Geoff (2404)
* Src/Makefile.in, Src/Modules/deltochar.c, Src/Modules/example.c,
configure, configure.in: move modules into Src/Modules
Wed Nov 13 21:47:28 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Modules/deltochar.c, Src/Modules/example.c, Src/module.c:
unload the module if the boot routine failed
* config.guess, config.sub: recognize i[6-9]86
* Src/globals.h, Src/init.c, Src/utils.c: make fdtable dynamic
* Src/zle_refresh.c: zle_refresh fix from Geoff (2387)
* Src/zle_refresh.c: some checks added. From Geoff (2386)
* Src/zle_refresh.c: fix an off-by-one array bound bug. From
Geoff (2359)
* Doc/zsh.texi, Doc/zshbuiltins.man, Src/Modules/deltochar.c,
Src/hashtable.h, Src/module.c, Src/zle_main.c: handle name
clashes when adding zle modules and remove bindings when a zle
module is removed. From Peter (2370)
* Src/zle_refresh.c: zle_refresh scrolling change from Geoff (2351)
* Src/Modules/deltochar.c, Src/module.c, Src/zle.h,
Src/zle_main.c, Src/zle_misc.c, Src/zle_tricky.c, Src/zle_vi.c:
zle function modules from Peter (2339)
Tue Nov 12 21:35:18 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/init.c, Src/zle_refresh.c: zle-refresh patch from Geoff (2336)
* Src/hashtable.h, Src/module.c: rename modload to zmodload. From
Peter (2333)
* Src/Makefile.in: added automatic ansi2knr rules
Mon Nov 11 21:55:17 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in, Src/Modules/example.c, Src/module.c, configure,
configure.in: various module changes from Zefram (2338)
* configure, configure.in: a $ was missing. IRIX gcc needs
-shared for modules. From Peter
Wed Nov 6 20:54:33 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in, Src/mod_example.c: moduule modifications for
old compilers
Sun Nov 3 23:00:05 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/system.h: set OPEN_MAX to 64 if NOFILE is not defined
* Src/hashtable.c: disable -f TRAPxxx permanently removed the
function
* Functions/pushd: setopt localoptions must come after
emulate -R zsh
Sat Nov 2 22:47:53 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/compat.c, Src/hashtable.c, Src/utils.c: do not blindly
assume that . and .. are always the first two enrties in a
directory. Problem discovered by Hideki ONO and fixed by Bart
(2309)
* Src/utils.c: max_zsh_fd should not be decreased below zero
Thu Oct 31 01:38:10 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/Makefile.in, Src/globals.h, Src/hashtable.c,
Src/hashtable.h, Src/init.c, Src/mod_example.c, Src/module.c,
Src/prototypes.h, Src/zsh.h, acconfig.h, config.h.in, configure,
configure.in: support dynamically loaded binary modules
* Src/hist.c: zsh splitted lines longer than 1022 while reading
the history file
* Src/glob.c (doesmatch): <-number> range glob did not work
* Src/builtin.c: read -c ignored its first parameter
Fri Oct 25 20:50:38 1996 Zoltán Hidvégi <hzoli@cs.elte.hu>
* Src/version.h: zsh-3.0.1 released

3671
ChangeLog.3.0 Normal file

File diff suppressed because it is too large Load Diff

4
Config/.distfiles Normal file
View File

@ -0,0 +1,4 @@
DISTFILES_SRC='
.distfiles
clean.mk config.mk defs.mk version.mk
'

43
Config/clean.mk Normal file
View File

@ -0,0 +1,43 @@
#
# Makefile fragment for cleanup
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
mostlyclean: mostlyclean-recursive mostlyclean-here
clean: clean-recursive clean-here
distclean: distclean-recursive distclean-here
realclean: realclean-recursive realclean-here
mostlyclean-here:
clean-here: mostlyclean-here
distclean-here: clean-here
realclean-here: distclean-here
mostlyclean-recursive clean-recursive distclean-recursive realclean-recursive:
@subdirs='$(SUBDIRS)'; if test -n "$$subdirs"; then \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$subdirs; do \
(cd $$subdir && $(MAKE) $(MAKEDEFS) $$target) || exit 1; \
done; \
fi

38
Config/config.mk Normal file
View File

@ -0,0 +1,38 @@
#
# Makefile fragment for building Makefiles
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
config: Makefile
@subdir='$(SUBDIRS)'; for subdir in $$subdirs; do \
(cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
done
CONFIG_INCS = \
$(dir_top)/Config/clean.mk $(dir_top)/Config/config.mk \
$(dir_top)/Config/defs.mk $(dir_top)/Config/version.mk
Makefile: Makefile.in $(dir_top)/config.status $(CONFIG_INCS)
cd $(dir_top) && \
CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status

83
Config/defs.mk Normal file
View File

@ -0,0 +1,83 @@
#
# Basic Makefile definitions
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
# fundamentals
SHELL = /bin/sh
@SET_MAKE@
# source/build directories
VPATH = @srcdir@
sdir = @srcdir@
sdir_top = @top_srcdir@
# installation directories
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
MODDIR = $(libdir)/zsh/$(VERSION)
infodir = @infodir@
mandir = @mandir@
# compilation
CC = @CC@
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
DLCFLAGS = @DLCFLAGS@
DLLDFLAGS = @DLLDFLAGS@
LIBLDFLAGS = @LIBLDFLAGS@
EXELDFLAGS = @EXELDFLAGS@
LIBS = @LIBS@
DL_EXT = @DL_EXT@
DLLD = @DLLD@
# utilities
AWK = @AWK@
YODL = @YODL@
YODL2TXT = $(YODL)2txt
YODL2HTML = $(YODL)2html
# install utility
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
# flags passed to recursive makes in subdirectories
MAKEDEFS = \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
libdir='$(libdir)' MODDIR='$(MODDIR)' infodir='$(infodir)' mandir='$(mandir)' \
CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' CFLAGS='$(CFLAGS)' \
LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \
LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \
LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \
AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)'
# override built-in suffix list
.SUFFIXES:

31
Config/version.mk Normal file
View File

@ -0,0 +1,31 @@
#
# Makefile fragment for version numbers
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
VERSION=3.1.5
VERSION_DATE='October 29, 1998'

15
Doc/.cvsignore Normal file
View File

@ -0,0 +1,15 @@
Makefile
version.yo
zsh*.1
zsh.texi
zsh.info*
zsh_*.html
zsh.aux zsh.toc
zsh.cp zsh.cps
zsh.fn zsh.fns
zsh.ky zsh.kys
zsh.pg zsh.pgs
zsh.vr zsh.vrs
zsh.log zsh.dvi
zsh.tp zsh.tps
zsh_*.ps

16
Doc/.distfiles Normal file
View File

@ -0,0 +1,16 @@
DISTFILES_SRC='
.cvsignore .distfiles Makefile.in
META-FAQ.yo intro.ms
version.yo zmacros.yo zman.yo ztexi.yo
zsh.yo zshbuiltins.yo zshcompctl.yo zshexpn.yo zshmisc.yo
zshmodules.yo zshoptions.yo zshparam.yo zshzle.yo
zsh.texi
zsh.1 zshbuiltins.1 zshcompctl.1 zshexpn.1 zshmisc.1 zshmodules.1
zshoptions.1 zshparam.1 zshzle.1 zshall.1
'
DISTFILES_DOC='
zsh.info zsh.info-[0-9]*
zsh_toc.html zsh_[0-9]*.html
zsh.dvi zsh_us.ps zsh_a4.ps
'

44
Doc/META-FAQ.yo Normal file
View File

@ -0,0 +1,44 @@
STARTDEF()
INCLUDEFILE(zmacros.yo)
def(startmenu)(0)(DELLINE)
def(endmenu)(0)(DELLINE)
def(menu)(1)(DELLINE)
def(texinode)(4)(DELLINE)
def(cindex)(1)(DELLINE)
def(sect)(1)(
SECTHEAD
ARG1
)
def(em)(1)(ARG1)
def(bf)(1)(ARG1)
def(tt)(1)(ARG1)
def(var)(1)(ARG1)
def(nofill)(1)(ARG1)
def(startitem)(0)(NEXTLINE DELLINE)
def(enditem)(0)(DELLINE)
def(item)(2)(
ARG1+USECHARTABLE(indent2)ARG2 DELLINE USECHARTABLE(standard))
def(startlist)(0)(DELLINE)
def(endlist)(0)(DELLINE)
def(list)(1)( ARG1)
DEFINECHARTABLE(standard)(
'\n' = "\n"
)
DEFINECHARTABLE(indent2)(
'\n' = "\n "
)
ENDDEF()\
------------------------
META-FAQ for the Z Shell
------------------------
The latest version of this META-FAQ can be found at any of the FTP sites
listed below.
INCLUDEFILE(Zsh/metafaq.yo)\

172
Doc/Makefile.in Normal file
View File

@ -0,0 +1,172 @@
#
# Makefile for Doc subdirectory
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
subdir = Doc
dir_top = ..
@@version.mk@@
@@defs.mk@@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
DVIPS = dvips -D 300
TEXI2HTML = texi2html -expandinfo -split_chapter
.SUFFIXES: .yo .1
# man pages to install
MAN = zsh.1 zshbuiltins.1 zshcompctl.1 \
zshexpn.1 zshmisc.1 zshmodules.1 \
zshoptions.1 zshparam.1 zshzle.1 zshall.1
# yodl documentation
YODLDOC = $(MAN) zsh.texi
YODLSRC = zmacros.yo zman.yo ztexi.yo Zsh/arith.yo Zsh/builtins.yo \
Zsh/compat.yo Zsh/compctl.yo Zsh/cond.yo Zsh/exec.yo Zsh/expn.yo \
Zsh/filelist.yo Zsh/files.yo Zsh/func.yo Zsh/grammar.yo Zsh/guide.yo \
Zsh/index.yo Zsh/intro.yo Zsh/invoke.yo Zsh/jobs.yo Zsh/metafaq.yo \
Zsh/modules.yo Zsh/mod_cap.yo \
Zsh/mod_clone.yo Zsh/mod_comp1.yo Zsh/mod_compctl.yo Zsh/mod_deltochar.yo \
Zsh/mod_example.yo Zsh/mod_files.yo Zsh/mod_stat.yo \
Zsh/mod_zle.yo Zsh/options.yo \
Zsh/params.yo Zsh/prompt.yo Zsh/redirect.yo Zsh/restricted.yo \
Zsh/seealso.yo Zsh/zle.yo
# ========== DEPENDENCIES FOR BUILDING ==========
all: $(MAN) zsh.texi zsh.info ../META-FAQ
everything: all zsh.dvi zsh_us.ps zsh_a4.ps zsh_toc.html
zsh.dvi: zsh.texi
$(TEXI2DVI) $(sdir)/zsh.texi
zsh.info: zsh.texi
$(MAKEINFO) $(sdir)/zsh.texi; exit 0
zsh.texi: zsh.yo
$(YODL) -o $(sdir)/zsh.texi -I$(sdir) -w ztexi.yo version.yo zsh.yo
test -f $(sdir)/zsh.texi
.yo.1:
case $@ in \
*/*) target=$@ ;; \
*) target=$(sdir)/$@ ;; \
esac; \
$(YODL) -o $$target -I$(sdir) -w zman.yo version.yo $< || exit 1; \
test -f $$target
zsh_us.ps: zsh.dvi
$(DVIPS) -t letter -o $@ zsh.dvi
zsh_a4.ps: zsh.dvi
$(DVIPS) -t a4 -o $@ zsh.dvi
zsh_toc.html: zsh.texi
$(TEXI2HTML) $(sdir)/zsh.texi
zshall.1: zsh.yo
case $@ in \
*/*) target=$@ ;; \
*) target=$(sdir)/$@ ;; \
esac; \
$(YODL) -o $$target -I$(sdir) -DZSHALL -w zman.yo version.yo zsh.yo || exit 1; \
test -f $$target
../META-FAQ: META-FAQ.yo Zsh/metafaq.yo
$(YODL) -I$(sdir) META-FAQ.yo | sed -e '/NEXTLINE/N' -e '/DELLINE/d' -e '/^SECTHEAD$$/{N;s/^SECTHEAD.//;h;s/./-/g;H;g;}' -e 's/ *$$//' > $(sdir_top)/META-FAQ
test -f $(sdir_top)/META-FAQ
$(YODLDOC): $(YODLSRC) version.yo
version.yo: $(sdir_top)/Config/version.mk
( \
echo 'STARTDEF()'; \
echo 'def(version)(0)('$(VERSION)')'; \
echo 'def(date)(0)('$(VERSION_DATE)')'; \
echo 'ENDDEF()#' | tr '#' '\\'; \
) > $(sdir)/version.yo
# ========== DEPENDENCIES FOR INSTALLING ==========
# install all the documentation
install: install.man install.info
# uninstall all the documentation
uninstall: uninstall.man uninstall.info
# install man pages, creating install directory if necessary
install.man: $(MAN)
$(sdir_top)/mkinstalldirs $(mandir)/man1
for file in $(MAN); do \
if test -f $$file; then \
$(INSTALL_DATA) $$file $(mandir)/man1; \
elif test -f $(sdir)/$$file; then \
$(INSTALL_DATA) $(sdir)/$$file $(mandir)/man1; \
else :; \
fi || exit 1; \
done
# install info pages, creating install directory if necessary
install.info: zsh.info
$(sdir_top)/mkinstalldirs $(infodir)
for file in zsh.info zsh.info-[1-9]; do \
if test -f $$file; then \
$(INSTALL_DATA) $$file $(infodir); \
elif test -f $(sdir)/$$file; then \
$(INSTALL_DATA) $(sdir)/$$file $(infodir); \
else :; \
fi || exit 1; \
done
# uninstall man pages
uninstall.man:
for file in $(MAN); do \
rm -f $(mandir)/man1/$$file; \
done
# uninstall info pages
uninstall.info:
rm -f $(infodir)/zsh.info $(infodir)/zsh.info-[1-9]
# ========== DEPENDENCIES FOR CLEANUP ==========
@@clean.mk@@
clean-here:
rm -f *.html *.info* *.dvi *.ps
rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.log
rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs
distclean-here:
rm -f Makefile
realclean-here:
cd $(sdir) && rm -f version.yo *.1 *.texi ../META-FAQ
# ========== DEPENDENCIES FOR MAINTENANCE ==========
@@config.mk@@

9
Doc/Zsh/.distfiles Normal file
View File

@ -0,0 +1,9 @@
DISTFILES_SRC='
.distfiles
arith.yo builtins.yo compat.yo compctl.yo cond.yo exec.yo expn.yo
filelist.yo files.yo func.yo grammar.yo guide.yo index.yo intro.yo
invoke.yo jobs.yo metafaq.yo mod_cap.yo mod_clone.yo mod_comp1.yo
mod_compctl.yo mod_deltochar.yo mod_example.yo mod_files.yo mod_sched.yo
mod_stat.yo mod_zle.yo modules.yo options.yo params.yo prompt.yo
redirect.yo restricted.yo seealso.yo zle.yo
'

1
Doc/Zsh/.lastloc Normal file
View File

@ -0,0 +1 @@
(("/home/user2/pws/src/zsh-3.1.5/Doc/Zsh/expn.yo" . 33735))

73
Doc/Zsh/arith.yo Normal file
View File

@ -0,0 +1,73 @@
texinode(Arithmetic Evaluation)(Conditional Expressions)(Jobs & Signals)(Top)
chapter(Arithmetic Evaluation)
ifzman(\
sect(Arithmetic Evaluation)
)\
cindex(arithmetic evaluation)
cindex(evaluation, arithmetic)
An ability to perform integer arithmetic is provided with the builtin tt(let).
findex(let, use of)
Evaluations are performed using em(long) arithmetic.
A leading `tt(0x)' or `tt(0X)' denotes hexadecimal.
Otherwise, numbers are of the form `[var(base)tt(#)]var(n)',
where var(base) is a decimal number between two and thirty-six
representing the arithmetic base and var(n)
is a number in that base (for example, `tt(16#ff)' is 255 in hexadecimal).
If var(base) is omitted
then base 10 is used. For backwards compatibility the form
`tt([)var(base)tt(])var(n)' is also accepted.
cindex(arithmetic operators)
cindex(operators, arithmetic)
An arithmetic expression uses nearly the same syntax, precedence, and
associativity of expressions in C.
The following operators are supported (listed in decreasing order
of precedence):
startsitem()
sitem(tt(PLUS() - ! ~ PLUS()PLUS() --))(unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement)
sitem(tt(<< >>))(bitwise shift left, right)
sitem(tt(&))(bitwise AND)
sitem(tt(^))(bitwise XOR)
sitem(tt(|))(bitwise OR)
sitem(tt(**))(exponentiation)
sitem(tt(* / %))(multiplication, division, modulus (remainder))
sitem(tt(PLUS() -))(addition, subtraction)
sitem(tt(< > <= >=))(comparison)
sitem(tt(== !=))(equality and inequality)
sitem(tt(&&))(logical AND)
sitem(tt(|| ^^))(logical OR, XOR)
sitem(tt(? :))(ternary operator)
sitem(tt(= PLUS()= -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= **=))(assignment)
sitem(tt(,))(comma operator)
endsitem()
The operators `tt(&&)', `tt(||)', `tt(&&=)', and `tt(||=)' are short-circuiting,
and only one of the latter two expressions in a ternary operator
is evaluated. Note the precedence of the bitwise AND, OR,
and XOR operators.
An expression of the form `tt(#\)var(x)' where var(x) is any character
gives the ascii value of this character and an expression of the form
`tt(#)var(foo)' gives the ascii value of the first character of the value
of the parameter var(foo).
Named parameters and subscripted arrays can be referenced by name within an
arithmetic expression without using the parameter substitution syntax.
An internal integer representation of a named parameter
can be specified with the tt(integer) builtin.
cindex(parameters, integer)
cindex(integer parameters)
findex(integer, use of)
Arithmetic evaluation is performed on the value of each
assignment to a named parameter declared integer
in this manner.
Since many of the arithmetic operators require
quoting, an alternative form of the tt(let) command is provided.
For any command which begins with a tt(LPAR()LPAR()),
all the characters until a matching tt(RPAR()RPAR())
are treated as a quoted expression.
More precisely, `tt(LPAR()LPAR()) ... tt(RPAR()RPAR())'
is equivalent to `tt(let ")...tt(")'.

1184
Doc/Zsh/builtins.yo Normal file
View File

@ -0,0 +1,1184 @@
texinode(Shell Builtin Commands)(Zsh Line Editor)(Options)(Top)
chapter(Shell Builtin Commands)
ifzman(\
sect(Shell Builtin Commands)
)\
cindex(builtin commands)
cindex(commands, builtin)
def(prefix)(1)(\
findex(ARG1)
item(tt(ARG1) var(simple command))(
See noderef(Precommand Modifiers).
)\
)\
def(alias)(2)(\
findex(ARG1)
item(tt(ARG1))(
Same as tt(ARG2).
)\
)\
startitem()
prefix(-)
findex(.)
item(tt(.) var(file) [ var(arg) ... ])(
Read commands from var(file) and execute them in the current shell
environment.
If var(file) does not contain a slash, or if tt(PATH_DIRS)
is set, the shell looks in the components of tt($path) to find the
directory containing var(file).
Files in the current directory are not read unless `tt(.)' appears
somewhere in tt($path).
If any arguments var(arg) are given,
they become the positional parameters; the old positional
parameters are restored when the var(file) is done executing.
The exit status is the exit status of the last command executed.
)
findex(NOTRANS(:))
cindex(expanding parameters)
cindex(parameters, expanding)
cindex(doing nothing)
item(tt(:) [ var(arg) ... ])(
This command only expands parameters. A zero exit code is returned.
)
findex(alias)
cindex(aliases, defining)
cindex(aliases, listing)
item(tt(alias) [ tt(-gmrL) ] [ var(name)[tt(=)var(value)] ... ])(
For each var(name) with a corresponding var(value), define an alias
with that value. A trailing space in var(value) causes the next word
to be checked for alias substitution. If the tt(-g) flag is present,
define a global alias; global aliases are expanded even if they do not
occur in command position.
For each var(name) with no var(value),
print the value of var(name), if any. With no arguments, print all
currently defined aliases. If the tt(-m) flag is given the arguments
are taken as patterns (they should be quoted to preserve them from being
interpreted as glob patterns), and the aliases matching these patterns
are printed. When printing aliases and the tt(-g) or tt(-r) flags
are present, then restrict the printing to global or regular
aliases, respectively.
If the tt(-L) flag is present, then print each
alias in a manner suitable for putting in a startup script. The exit
status is nonzero if a var(name) (with no var(value)) is given for
which no alias has been defined.
)
findex(autoload)
cindex(functions, autoloading)
cindex(autoloading functions)
alias(autoload)(functions -u)
findex(bg)
cindex(jobs, backgrounding)
xitem(tt(bg) [ var(job) ... ])
item(var(job) ... tt(&))(
Put each specified var(job) in the background,
or the current job if none is specified.
)
findex(break)
cindex(exiting loops)
cindex(loops, exiting)
item(tt(break) [ var(n) ])(
Exit from an enclosing tt(for), tt(while),
tt(until), tt(select) or tt(repeat) loop. If var(n)
is specified, then break var(n) levels instead of just one.
)
findex(builtin)
item(tt(builtin) var(name) [ var(args) ... ])(
Executes the builtin var(name), with the given var(args).
)
alias(bye)(exit)
findex(cd)
cindex(directories, changing)
xitem(tt(cd) [ tt(-sLP) ] [ var(arg) ])
xitem(tt(cd) [ tt(-sLP) ] var(old) var(new))
item(tt(cd) [ tt(-sLP) ] {tt(PLUS())|tt(-)}var(n))(
Change the current directory. In the first form, change the
current directory to var(arg), or to the value of tt($HOME) if
var(arg) is not specified. If var(arg) is `tt(-)', change to the
value of tt($OLDPWD), the previous directory.
If a directory named var(arg) is not found in the current directory
and var(arg) does not begin with a slash,
search each component of the shell parameter tt(cdpath).
If the option tt(CDABLE_VARS) is set, and a parameter named var(arg)
exists whose value begins with a slash, treat its value as
the directory.
The second form of tt(cd) substitutes the string var(new)
for the string var(old) in the name of the current directory,
and tries to change to this new directory.
The third form of tt(cd) extracts an entry from the directory
stack, and changes to that directory. An argument of the form
`tt(PLUS())var(n)' identifies a stack entry by counting from the left
of the list shown by the tt(dirs) command, starting with zero.
An argument of the form `tt(-)var(n)' counts from the right.
If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())'
and `tt(-)' in this context are swapped.
If the tt(-s) option is specified, tt(cd) refuses to change the current
directory if the given pathname contains symlinks. If the tt(-P) option
is given or the tt(CHASE_LINKS) option is set, symbolic links are resolved
to their true values. If the tt(-L) option is given symbolic links are
followed regardless of the state of the tt(CHASE_LINKS) option.
)
alias(chdir)(cd)
prefix(command)
findex(continue)
cindex(loops, continuing)
cindex(continuing loops)
item(tt(continue) [ var(n) ])(
Resume the next iteration of the enclosing
tt(for), tt(while), tt(until), tt(select) or
tt(repeat) loop. If var(n) is specified, break out of
var(n)-1 loops and resume at the var(n)th enclosing loop.
)
alias(declare)(typeset)
findex(dirs)
cindex(directory stack, printing)
item(tt(dirs) [ tt(-v) ] [ var(arg) ... ])(
With no arguments, print the contents of the directory stack.
If the tt(-v) option is given, number the directories
in the stack when printing.
Directories are added to this stack with the tt(pushd) command,
and removed with the tt(cd) or tt(popd) commands.
If arguments are specified, load them onto the directory stack,
replacing anything that was there, and push the current directory
onto the stack.
)
findex(disable)
cindex(disabling commands)
cindex(commands, disabling)
item(tt(disable) [ tt(-afmr) ] var(name) ...)(
Temporarily disable the var(name)d hash table elements. The default
is to disable builtin commands. This allows you to use an external
command with the same name as a builtin command. The tt(-a) option
causes tt(disable) to act on aliases. The tt(-f) option causes
tt(disable) to act on shell functions. The tt(-r) options causes
tt(disable) to act on reserved words. Without arguments all disabled
hash table elements from the corresponding hash table are printed.
With the tt(-m) flag the arguments are taken as patterns (should be
quoted to preserve them from being taken as glob patterns), and all hash
table elements from the corresponding hash table matching these patterns
are disabled. Disabled objects can be enabled with the tt(enable)
command.
)
findex(disown)
cindex(jobs, disowning)
xitem(tt(disown) [ var(job) ... ])
xitem(var(job) ... tt(&|))
item(var(job) ... tt(&!))(
Remove the specified var(job)s from the job table; the shell will
no longer report their status, and will not complain if you
try to exit an interactive shell with them running or stopped.
If no var(job) is specified, disown the current job.
)
findex(echo)
item(tt(echo) [ tt(-neE) ] [ var(arg) ... ])(
Write each var(arg) on the standard output, with a space separating
each one.
If the tt(-n) flag is not present, print a newline at the end.
tt(echo) recognizes the following escape sequences:
startsitem()
sitem(tt(\a))(bell character)
sitem(tt(\b))(backspace)
sitem(tt(\c))(suppress final newline)
sitem(tt(\e))(escape)
sitem(tt(\f))(form feed)
sitem(tt(\n))(linefeed (newline))
sitem(tt(\r))(carriage return)
sitem(tt(\t))(horizontal tab)
sitem(tt(\v))(vertical tab)
sitem(tt(\\))(backslash)
sitem(tt(\0)var(NNN))(character code in octal)
sitem(tt(\x)var(NN))(character code in hexadecimal)
endsitem()
pindex(BSD_ECHO, use of)
The tt(-E) flag, or the tt(BSD_ECHO) option, can be used to disable
these escape sequences. In the latter case, tt(-e) flag can be used to
enable them.
)
findex(echotc)
cindex(termcap string, printing)
item(tt(echotc) var(cap) [ var(arg) ... ])(
Output the termcap string corresponding to the capability
var(cap), with optional arguments.
)
findex(emulate)
cindex(compatibility, sh)
cindex(compatibility, ksh)
cindex(compatibility, csh)
cindex(sh, compatibility)
cindex(ksh, compatibility)
cindex(csh, compatibility)
item(tt(emulate) [ tt(-R) ] {tt(zsh)|tt(sh)|tt(ksh)|tt(csh)})(
Set up zsh options to emulate the specified shell as much as possible.
bf(csh) will never be fully emulated.
If the argument is not one of the shells listed above, tt(zsh)
will be used as a default. If the tt(-R) option is given, all options
are reset to their default value corresponding to the specified emulation
mode.
)
findex(enable)
cindex(enabling commands)
cindex(commands, enabling)
item(tt(enable) [ tt(-afmr) ] var(name) ...)(
Enable the var(name)d hash table elements, presumably disabled
earlier with tt(disable). The default is to enable builtin commands.
The tt(-a) option causes tt(enable) to act on aliases. The tt(-f)
option causes tt(enable) to act on shell functions. The tt(-r)
option causes tt(enable) to act on reserved words. Without arguments
all enabled hash table elements from the corresponding hash table are
printed. With the tt(-m) flag the arguments are taken as patterns
(should be quoted) and all hash table elements from the corresponding
hash table matching these patterns are enabled. Enabled objects can be
disabled with the tt(disable) builtin command.
)
findex(eval)
cindex(evaluating arguments as commands)
item(tt(eval) [ var(arg) ... ])(
Read the arguments as input to the shell and execute the resulting
command in the current shell process.
)
prefix(exec)
findex(exit)
item(tt(exit) [ var(n) ])(
Exit the shell with the exit code specified by var(n); if none
is specified, use the exit code from the last command executed.
pindex(IGNORE_EOF, use of)
An EOF condition will also cause the shell to exit, unless
the tt(IGNORE_EOF) option is set.
)
findex(export)
item(tt(export) [ var(name)[tt(=)var(value)] ... ])(
The specified var(name)s are marked for automatic export
to the environment of subsequently executed commands.
Equivalent to tt(typeset -x), except that no parameter will be created
to hide an existing one in an outer scope.
If a parameter specified does not
already exist, it is created in the global scope.
)
findex(false)
cindex(doing nothing, unsuccessfully)
item(tt(false) [ var(arg) ... ])(
Do nothing and return an exit code of 1.
)
findex(fc)
cindex(history, editing)
cindex(editing history)
xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-nlrdDfEim) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
item(tt(fc) tt(-ARWI) [ var(filename) ])(
Select a range of commands from var(first) to var(last) from the
history list.
The arguments var(first) and var(last) may be specified as a
number or as a string. A negative number is used as an offset
to the current history event number.
A string specifies the most recent event beginning with the given string.
All substitutions var(old)tt(=)var(new), if any, are then performed
on the commands.
If the tt(-l) flag is given, the resulting commands are listed on
standard output.
If the tt(-m) flag is also given the first argument is taken as a
pattern (should be quoted) and only the history events matching this
pattern will be shown.
Otherwise the editor program var(ename) is invoked on a file containing
these history events. If var(ename) is not given, the value
of the parameter tt(FCEDIT) is used. If var(ename) is `tt(-)',
no editor is invoked. When editing is complete, the edited
command is executed.
If var(first) is not specified, it will be set to -1 (the most recent
event), or to -16 if the tt(-l) flag is given.
If var(last) is not specified, it will be set to var(first),
or to -1 if the tt(-l) flag is given.
The flag tt(-r) reverses the order of the commands and the
flag tt(-n) suppresses command numbers when listing.
Also when listing, tt(-d) prints timestamps for each command, and
tt(-f) prints full time-date stamps. Adding the tt(-E) flag
causes the dates to be printed as `var(dd)tt(.)var(mm)tt(.)var(yyyy)',
instead of the default `var(mm)tt(/)var(dd)tt(/)var(yyyy)'.
Adding the tt(-i) flag causes the dates to be printed in ISO8601
`var(yyyy)tt(-)var(mm)tt(-)var(dd)' format.
With the tt(-D) flag, tt(fc) prints elapsed times.
cindex(history, file)
cindex(file, history)
tt(fc -R) reads the history from the given file,
tt(fc -W) writes the history out to the given file,
and tt(fc -A) appends the history out to the given file.
If the tt(-I) option is added, only those
events that are new since last incremental append (write) to
the history file are appended (written).
In any case the file will have no more than tt($SAVEHIST)
entries.
)
findex(fg)
cindex(jobs, foregrounding)
cindex(jobs, resuming)
xitem(tt(fg) [ var(job) ... ])
item(var(job) ...)(
Bring each specified var(job) in turn to the foreground.
If no var(job) is specified, resume the current job.
)
findex(functions)
item(tt(functions) [ {tt(PLUS())|tt(-)}tt(tum) ] [ var(name) ... ])(
Equivalent to tt(typeset -f).
)
findex(getln)
cindex(line, reading)
cindex(reading a line)
item(tt(getln) [ tt(-AclneE) ] var(name) ...)(
Read the top value from the buffer stack and put it in
the shell parameter tt(name). Equivalent to
tt(read -zr).
)
findex(getopts)
cindex(options, processing)
item(tt(getopts) var(optstring) var(name) [ var(arg) ... ])(
Checks the var(arg)s for legal options. If the var(arg)s are omitted,
use the positional parameters. A valid option argument
begins with a `tt(PLUS())' or a `tt(-)'. An argument not beginning with
a `tt(PLUS())' or a `tt(-)', or the argument `tt(--)', ends the options.
var(optstring) contains the letters that tt(getopts)
recognizes. If a letter is followed by a `tt(:)', that option
is expected to have an argument. The options can be
separated from the argument by blanks.
Each time it is invoked, tt(getopts) places the option letter it finds
in the shell parameter var(name), prepended with a `tt(PLUS())' when
var(arg) begins with a `tt(PLUS())'. The index of the next var(arg)
is stored in tt(OPTIND). The option argument, if any,
is stored in tt(OPTARG).
vindex(OPTIND, use of)
vindex(OPTARG, use of)
A leading `tt(:)' in var(optstring) causes tt(getopts) to store the
letter of the invalid option in tt(OPTARG), and to set var(name)
to `tt(?)' for an unknown option and to `tt(:)' when a required option
is missing. Otherwise, tt(getopts) prints an error
message. The exit status is nonzero when there are no more options.
)
findex(hash)
item(tt(hash) [ tt(-dfmrv) ] [ var(name)[tt(=)var(value)] ] ...)(
tt(hash) can be used to directly modify the contents of the command
hash table, and the named directory hash table. Normally one would
modify these tables by modifying one's tt(PATH)
(for the command hash table) or by creating appropriate shell parameters
(for the named directory hash table).
The choice of hash table to work on is determined by the tt(-d) option;
without the option the command hash table is used, and with the option the
named directory hash table is used.
Given no arguments, and neither the tt(-r) or tt(-f) options,
the selected hash table will be listed in full.
The tt(-r) option causes the selected hash table to be emptied.
It will be subsequently rebuilt in the normal fashion.
The tt(-f) option causes the selected hash table to be fully
rebuilt immediately. For the command hash table this hashes
all the absolute directories in the tt(PATH),
and for the named directory hash table this adds all users' home directories.
These two options cannot be used with any arguments.
The tt(-m) option causes the arguments to be taken as patterns
(they should be quoted) and the elements of the hash table
matching those patterns are printed. This is the only way to display
a limited selection of hash table elements.
For each var(name) with a corresponding var(value), put `var(name)' in
the selected hash table, associating it with the pathname `var(value)'.
In the command hash table, this means that
whenever `var(name)' is used as a command argument, the shell will try
to execute the file given by `var(value)'.
In the named directory hash table, this means
that `var(value)' may be referred to as `tt(~)var(name)'.
For each var(name) with no
corresponding var(value), attempt to add var(name) to the hash table,
checking what the appropriate tt(value) is in the normal manner for
that hash table. If an appropriate tt(value) can't be found, then
the hash table will be unchanged.
The tt(-v) option causes hash table entries to be listed as they are
added by explicit specification. If has no effect if used with tt(-f).
)
alias(history)(fc -l)
findex(integer)
item(tt(integer) [ {tt(PLUS())|tt(-)}tt(lrtux) ] [ var(name)[tt(=)var(value)] ... ])(
Equivalent to tt(typeset -i), except that options irrelevant to
integers are not permitted.
)
findex(jobs)
xitem(tt(jobs) [ tt(-dlprs) ] [ var(job) ... ])
item(tt(jobs -Z) var(string))(
Lists information about each given job, or all jobs
if var(job) is omitted. The tt(-l) flag lists process
IDs, and the tt(-p) flag lists process groups.
If the tt(-r) flag is specified only running jobs will be listed
and if the tt(-s) flag is given only stopped jobs are shown.
If the tt(-d) flag is given, the directory from which the job was
started (which may not be the current directory of the job) will also
be shown.
The tt(-Z) option replaces the shell's argument and environment space with
the given string, truncated if necessary to fit. This will normally be
visible in tt(ps) (manref(ps)(1)) listings. This feature is typically
used by daemons, to indicate their state.
)
findex(kill)
cindex(killing jobs)
cindex(jobs, killing)
xitem(tt(kill) [ tt(-s) var(signal_name) ] var(job) ...)
xitem(tt(kill) [ tt(-)var(sig) ] var(job) ...)
item(tt(kill) tt(-l) [ var(sig) ... ])(
Sends either tt(SIGTERM) or the specified signal to the given
jobs or processes.
Signals are given by number or by names, without the `tt(SIG)' prefix.
If the signal being sent is not `tt(KILL)' or `tt(CONT)', then the job
will be sent a `tt(CONT)' signal if it is stopped.
The argument var(job) can be the process ID of a job
not in the job list.
In the third form, tt(kill -l), if var(sig) is not
specified the signal names are listed. Otherwise, for each
var(sig) that is a name, the corresponding signal number is
listed. For each var(sig) that is a signal number or a number
representing the exit status of a process which was terminated or
stopped by a signal the name of the signal is printed.
)
findex(let)
item(tt(let) var(arg) ...)(
Evaluate each var(arg) as an arithmetic expression.
See noderef(Arithmetic Evaluation) for a description
of arithmetic expressions. The exit status is 0 if the
value of the last expression is nonzero, and 1 otherwise.
)
findex(limit)
cindex(resource limits)
cindex(limits, resource)
item(tt(limit) [ tt(-hs) ] [ var(resource) [ var(limit) ] ] ...)(
Set or display resource limits. Unless the tt(-s) flag is given,
the limit applies only the children of the shell. If tt(-s) is
given without other arguments, the resource limits of the current
shell is set to the previously set resource limits of the children.
If var(limit) is not specified, print the current limit placed
on var(resource), otherwise
set the limit to the specified value. If the tt(-h) flag
is given, use hard limits instead of soft limits.
If no var(resource) is given, print all limits.
var(resource) can be one of:
startsitem()
sitem(tt(memorylocked))(Maximum amount of memory locked in RAM.)
sitem(tt(resident))(Maximum resident set size.)
sitem(tt(vmemorysize))(Maximum amount of virtual memory.)
sitem(tt(descriptors))(Maximum value for a file descriptor.)
sitem(tt(coredumpsize))(Maximum size of a core dump.)
sitem(tt(stacksize))(Maximum stack size for each process.)
sitem(tt(datasize))(Maximum data size (including stack) for each process.)
sitem(tt(filesize))(Largest single file allowed.)
sitem(tt(cputime))(Maximum CPU seconds per process.)
sitem(tt(maxproc))(Maximum number of processes.)
sitem(tt(addressspace))(Maximum amount of address space used.)
sitem(tt(cachedthreads))(Maximum number of cached threads.)
endsitem()
Which of these resource limits are available depends on the system.
var(resource) can be abbreviated to any unambiguous prefix.
var(limit) is a number, with an optional scaling factor, as follows:
startsitem()
sitem(var(n)tt(h))(hours)
sitem(var(n)tt(k))(kilobytes (default))
sitem(var(n)tt(m))(megabytes or minutes)
sitem([var(mm)tt(:)]var(ss))(minutes and seconds)
endsitem()
)
findex(local)
item(tt(local) [ {tt(PLUS())|tt(-)}tt(LRZilrtu) [var(n)]] [ var(name)[tt(=)var(value)] ] ...)(
Same as tt(typeset), except that the options tt(-x) and
tt(-f) are not permitted.
)
findex(log)
vindex(watch, use of)
cindex(watching users)
cindex(users, watching)
item(tt(log))(
List all users currently logged in who are affected by
the current setting of the tt(watch) parameter.
)
findex(logout)
item(tt(logout) [ var(n) ])(
Same as tt(exit), except that it only works in a login shell.
)
prefix(noglob)
findex(popd)
item(tt(popd) [ {tt(PLUS())|tt(-)}var(n) ])(
Removes a entry from the directory stack, and perform a tt(cd) to
the new top directory. With no argument, the current top entry is
removed. An argument of the form `tt(PLUS())var(n)' identifies a stack
entry by counting from the left of the list shown by the tt(dirs) command,
starting with zero. An argument of the form tt(-n) counts from the right.
pindex(PUSHD_MINUS, use of)
If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())' and
`tt(-)' in this context are swapped.
)
findex(print)
item(tt(print) [ tt(-nrslzpNDPoOicm) ] [ tt(-u)var(n) ] [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])(
With no flags or with flag `tt(-)', the arguments are printed on
the standard output as described by tt(echo), with the following differences:
the escape sequence `tt(\M-)var(x)' metafies the character
var(x) (sets the highest bit),
`tt(\C-)var(x)' produces a control character (`tt(\C-@)' and `tt(\C-?)' give the
characters NUL and delete), and `tt(\E)' is a synonym for `tt(\e)'.
Finally, if not in an escape
sequence, `tt(\)' escapes the following character and is not printed.
startitem()
item(tt(-r))(
Ignore the escape conventions of tt(echo).
)
item(tt(-R))(
Emulate the BSD tt(echo) command, which does not process escape sequences
unless the tt(-e) flag is given. The tt(-n) flag suppresses the trailing
newline. Only the tt(-e) and tt(-n) flags are recognized after
tt(-R); all other arguments and options are printed.
)
item(tt(-m))(
Take the first argument as a pattern (should be quoted), and remove
it from the argument list together with subsequent arguments that
do not match this pattern.
)
item(tt(-s))(
Place the results in the history list instead of on the standard output.
)
item(tt(-n))(
Do not add a newline to the output.
)
item(tt(-l))(
Print the arguments separated by newlines instead of spaces.
)
item(tt(-N))(
Print the arguments separated and terminated by nulls.
)
item(tt(-o))(
Print the arguments sorted in ascending order.
)
item(tt(-O))(
Print the arguments sorted in descending order.
)
item(tt(-i))(
If given together with tt(-o) or tt(-O), makes them work case
independently.
)
item(tt(-c))(
Print the arguments in columns.
)
item(tt(-u)var(n))(
Print the arguments to file descriptor var(n).
)
item(tt(-p))(
Print the arguments to the input of the coprocess.
)
item(tt(-z))(
Push the arguments onto the editing buffer stack, separated by spaces;
no escape sequences are recognized.
)
item(tt(-D))(
Treat the arguments as directory names, replacing prefixes with tt(~)
expressions, as appropriate.
)
item(tt(-P))(
Perform prompt expansion (see noderef(Prompt Expansion)).
)
enditem()
)
findex(pushd)
pindex(PUSHD_TO_HOME, use of)
pindex(PUSHD_MINUS, use of)
pindex(CDABLE_VARS, use of)
pindex(PUSHD_SILENT, use of)
xitem(tt(pushd) [ var(arg) ])
xitem(tt(pushd) var(old) var(new))
item(tt(pushd) {tt(PLUS())|tt(-)}var(n))(
Change the current directory, and push the old current directory
onto the directory stack. In the first form, change the
current directory to var(arg).
If var(arg) is not specified, change to the second directory
on the stack (that is, exchange the top two entries), or
change to tt($HOME) if the tt(PUSHD_TO_HOME)
option is set or if there is only one entry on the stack.
If var(arg) is `tt(-)', change to tt($OLDPWD), the previous directory.
If a directory named var(arg) is not found in the current directory
and var(arg) does not contain a slash,
search each component of the shell parameter tt(cdpath).
If the option tt(CDABLE_VARS) is set, and a parameter named var(arg)
exists whose value begins with a slash, treat its value as
the directory.
If the option tt(PUSHD_SILENT) is not set, the directory
stack will be printed after a tt(pushd) is performed.
The second form of tt(pushd) substitutes the string var(new)
for the string var(old) in the name of the current directory,
and tries to change to this new directory.
The third form of tt(pushd) changes directory by rotating the
directory list. An argument of the form `tt(PLUS())var(n)' identifies a stack
entry by counting from the left of the list shown by the tt(dirs)
command, starting with zero. An argument of the form `tt(-)var(n)' counts
from the right. If the tt(PUSHD_MINUS) option is set, the meanings
of `tt(PLUS())' and `tt(-)' in this context are swapped.
)
findex(pushln)
item(tt(pushln) [ var(arg) ... ])(
Equivalent to tt(print -nz).
)
findex(pwd)
pindex(CHASE_LINKS, use of)
item(tt(pwd) [ tt(-rLP) ])(
Print the absolute pathname of the current working directory.
If the tt(-r) or the tt(-P) flag is specified, or the tt(CHASE_LINKS)
option is set and the tt(-L) flag is not given, the printed path will not
contain symbolic links.
)
alias(r)(fc -e -)
findex(read)
vindex(IFS, use of)
item(tt(read) [ tt(-rzpqAclneE) ] [ tt(-k) [ var(num) ] ] \
[ tt(-u)var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])(
Read one line and break it into fields using the characters
in tt($IFS) as separators, except as noted below.
The first field is assigned to the first var(name), the second field
to the second var(name), etc., with leftover
fields assigned to the last var(name).
startitem()
item(tt(-r))(
Raw mode: a `tt(\)' at the end of a line does not signify line
continuation.
)
item(tt(-q))(
Read only one character from the terminal and set var(name) to
`tt(y)' if this character was `tt(y)' or `tt(Y)' and to `tt(n)' otherwise.
With this flag set the return value is zero only if the character was
`tt(y)' or `tt(Y)'. Note that this always reads from the terminal, even
if used with the tt(-p) or tt(-u) or tt(-z) flags or with redirected input.
)
item(tt(-k) [ var(num) ])(
Read only one (or var(num)) characters. All are assigned to the first
var(name), without word splitting. This flag is ignored when tt(-q) is
present. Input is read from the terminal unless one of tt(-u) or tt(-p)
is present.
)
item(tt(-z))(
Read one entry from the editor buffer stack and assign it to the first
var(name), without word splitting. Text is pushed onto the stack with
`tt(print -z)' or with tt(push-line) from the line editor (see
ifzman(zmanref(zshzle))\
ifnzman(noderef(Zsh Line Editor))\
). This flag is ignored when the tt(-k) or tt(-q) flags are present.
)
xitem(tt(-e))
item(tt(-E))(
The input read is printed (echoed) to the standard output. If the tt(-e)
flag is used, no input is assigned to the parameters.
)
item(tt(-A))(
The first var(name) is taken as the name of an array and all words are
assigned to it.
)
xitem(tt(-c))
item(tt(-l))(
These flags are allowed only if called inside a
function used for completion (specified with the tt(-K) flag to
tt(compctl)). If the tt(-c) flag is given, the words of the
current command are read. If the tt(-l) flag is given, the whole
line is assigned as a scalar. If both flags are present, tt(-l)
is used and tt(-c) is ignored. If var(name) is omitted then
tt(REPLY) is used for scalars and tt(reply) for arrays.
)
item(tt(-n))(
Together with tt(-c), the number of the word the cursor is on is
read. With tt(-l), the index of the character the cursor is on is
read. Note that the command name is word number 1, not word 0,
and that when the cursor is at the end of the line, its character
index is the length of the line plus one.
)
item(tt(-u)var(n))(
Input is read from file descriptor var(n).
)
item(tt(-p))(
Input is read from the coprocess.
)
enditem()
If the first argument contains a `tt(?)', the remainder of this
word is used as a var(prompt) on standard error when the shell
is interactive.
The value (exit status) of tt(read) is 1 when an end-of-file is
encountered, or when tt(-c) or tt(-l) is present and the command is
not called from a tt(compctl) function. Otherwise the value is 0.
The behavior of some combinations of the tt(-k), tt(-p), tt(-q), tt(-u)
and tt(-z) flags is undefined. Presently tt(-q) cancels all the others,
tt(-p) cancels tt(-u), tt(-k) cancels tt(-z), and otherwise tt(-z)
cancels both tt(-p) and tt(-u).
The tt(-c) or tt(-l) flags cancel any and all of tt(-kpquz).
)
cindex(parameters, marking readonly)
alias(readonly)(typeset -r)
alias(rehash)(hash -r)
findex(return)
cindex(functions, returning from)
item(tt(return) [ var(n) ])(
Causes a shell function or tt(.) script to return to
the invoking script with the return status specified by var(n). If var(n)
is omitted, the return status is that of the last command
executed.
If tt(return) was executed from a trap in a tt(TRAP)var(NAL) function,
the effect is different for zero and non-zero return status. With zero
status (or after an implicit return at the end of the trap), the shell
will return to whatever it was previously processing; with a non-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained. Note that the signal which caused the
trap is passed as the first argument, so the statement `tt(return
$((128PLUS()$1)))' will return the same status as if the signal had not
been trapped.
)
findex(set)
cindex(parameters, listing)
cindex(parameters, positional)
cindex(parameters, setting array)
cindex(array parameters, setting)
item(tt(set) [ {tt(PLUS())|tt(-)}var(options) | {tt(PLUS())|tt(-)}tt(o) var(option_name) ] ... [ {tt(PLUS())|tt(-)}tt(A) [ var(name) ] ] [ var(arg) ... ])(
Set the options for the shell and/or set the positional parameters, or
declare and set an array. If the tt(-s) option is given, it causes the
specified arguments to be sorted before assigning them to the positional
parameters (or to the array var(name) if tt(-A) is used). With tt(PLUS()s)
sort arguments in descending order. For the meaning of the other flags, see
ifzman(zmanref(zshoptions))\
ifnzman(noderef(Options))\
. Flags may be specified by name using the tt(-o) option.
If the tt(-A) flag is specified, var(name) is
set to an array containing the given var(arg)s. if tt(PLUS()A) is used and
var(name) is an array, the given arguments will replace the initial
elements of that array; if no var(name) is specified, all arrays are
printed. Otherwise the positional parameters are set. If no arguments are
given, then the names and values of all parameters are printed on the
standard output. If the only argument is `tt(PLUS())',
the names of all parameters are printed.
)
findex(setopt)
cindex(options, setting)
item(tt(setopt) [ {tt(PLUS())|tt(-)}var(options) | \
{tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ var(name) ... ])(
Set the options for the shell. All options specified either
with flags or by name are set. If no arguments are supplied,
the names of all options currently set are printed.
If the tt(-m) flag is given the arguments are taken as patterns
(which should be quoted to preserve them from being interpreted as glob
patterns), and all options with names matching these patterns are set.
)
findex(shift)
cindex(parameters, positional)
item(tt(shift) [ var(n) ] [ var(name) ... ])(
The positional parameters tt(${)var(n)PLUS()1tt(}) ... are renamed
to tt($1) ..., where var(n) is an arithmetic expression that
defaults to 1.
If any var(name)s are given then the arrays with these names are
shifted instead of the positional parameters.
)
findex(source)
item(tt(source) var(file) [ var(arg) ... ])(
Same as tt(.), except that the current directory is always searched and
is always searched first, before directories in tt($path).
)
findex(suspend)
cindex(shell, suspending)
cindex(suspending the shell)
item(tt(suspend) [ tt(-f) ])(
Suspend the execution of the shell (send it a tt(SIGTSTP))
until it receives a tt(SIGCONT).
Unless the tt(-f) option is given, this will refuse to suspend a login shell.
)
findex(test)
xitem(tt(test) [ var(arg) ... ])
item(tt([) [ var(arg) ... ] tt(]))(
Like the system version of tt(test). Added for compatibility;
use conditional expressions instead (see noderef(Conditional Expressions)).
)
findex(times)
cindex(shell, timing)
cindex(timing the shell)
item(tt(times))(
Print the accumulated user and system times for the shell
and for processes run from the shell.
)
findex(trap)
cindex(signals, trapping)
cindex(trapping signals)
item(tt(trap) [ var(arg) [ var(sig) ... ] ])(
var(arg) is a command to be read and executed when the shell
receives var(sig). Each var(sig) can be given as a number
or as the name of a signal.
If var(arg) is `tt(-)', then all traps var(sig) are reset to their
default values. If var(arg) is the null string, then this signal
is ignored by the shell and by the commands it invokes.
If var(sig) is tt(ZERR) then var(arg) will be executed
after each command with a nonzero exit status.
If var(sig) is tt(DEBUG) then var(arg) will be executed
after each command.
If var(sig) is tt(0) or tt(EXIT)
and the tt(trap) statement is executed inside the body of a function,
then the command var(arg) is executed after the function completes.
If var(sig) is tt(0) or tt(EXIT)
and the tt(trap) statement is not executed inside the body of a function,
then the command var(arg) is executed when the shell terminates.
The tt(trap) command with no arguments prints a list of commands
associated with each signal.
)
findex(true)
cindex(doing nothing, successfully)
item(tt(true) [ var(arg) ... ])(
Do nothing and return an exit code of 0.
)
findex(ttyctl)
cindex(tty, freezing)
item(tt(ttyctl) tt(-fu))(
The tt(-f) option freezes the tty, and tt(-u) unfreezes it.
When the tty is frozen, no changes made to the tty settings by
external programs will be honored by the shell, except for changes in the
size of the screen; the shell will
simply reset the settings to their previous values as soon as each
command exits or is suspended. Thus, tt(stty) and similar programs have
no effect when the tty is frozen. Without options it reports whether the
terminal is frozen or not.
)
findex(type)
item(tt(type) [ tt(-wfpams) ] var(name) ...)(
Equivalent to tt(whence -v).
)
findex(typeset)
cindex(parameters, setting)
cindex(parameters, declaring)
item(tt(typeset) [ {tt(PLUS())|tt(-)}tt(LRUZfilrtuxm) [var(n)]] [ var(name)[tt(=)var(value)] ... ])(
Set attributes and values for shell parameters.
When invoked inside a function a new parameter is created which will be
unset when the function completes. The new parameter will not be
exported unless tt(ALL_EXPORT) is set, in which case the parameter will be
exported provided no parameter of that name already exists.
The following attributes are valid:
startitem()
item(tt(-L))(
Left justify and remove leading blanks from var(value).
If var(n) is nonzero, it defines the width of the field;
otherwise it is determined by the width of the value of the first
assignment.
When the parameter is printed, it is filled on the right with
blanks or truncated if necessary to fit the field.
Leading zeros are removed if the tt(-Z) flag is also set.
)
item(tt(-R))(
Right justify and fill with leading blanks. If var(n) is nonzero
if defines the width of the field;
otherwise it is determined by the width of the value of the first
assignment.
When the parameter is printed, the field is left filled with
blanks or truncated from the end.
)
item(tt(-U))(
For arrays keep only the first element of each duplications. It can also be
set for colon separated special parameters like tt(PATH) or tt(FIGNORE),
etc.
)
item(tt(-Z))(
Right justify and fill with leading zeros if the first non-blank
character is a digit and the tt(-L) flag has not been set.
If var(n) is nonzero it defines the width of the field;
otherwise it is determined by the width of the value of the
first assignment.
)
item(tt(-f))(
The names refer to functions rather than parameters. No assignments
can be made, and the only other valid flags are tt(-t)
and tt(-u). The flag tt(-t) turns on execution tracing for this
function. The flag tt(-u) causes this function to be marked
for autoloading. The tt(fpath) parameter will be searched to find the
function definition when the function is first referenced; see
noderef(Functions).
)
item(tt(-i))(
Use an internal integer representation. If var(n) is nonzero
it defines the output arithmetic base, otherwise it is determined by the first
assignment.
)
item(tt(-l))(
Convert to lower case.
)
item(tt(-r))(
The given var(name)s are marked readonly.
)
item(tt(-t))(
Tags the named parameters. Tags have no special meaning to the shell.
)
item(tt(-u))(
Convert to upper case.
)
item(tt(-x))(
Mark for automatic export to the environment of subsequently
executed commands.
)
enditem()
Using `tt(PLUS())' rather than `tt(-)' causes these flags to be turned off.
If no arguments are given but flags are specified,
a list of named parameters which have these flags set is printed.
Using `tt(PLUS())' instead of `tt(-)' keeps their values from being printed.
If no arguments or options are given, the names and attributes
of all parameters are printed. If only the tt(-m) flag is given the
arguments are taken as patterns (should be quoted) and all parameters
or functions (with the tt(-f) flag) with matching names are printed.
)
findex(ulimit)
cindex(resource limits)
cindex(limits, resource)
item(tt(ulimit) [ tt(-SHacdflmnpstv) [ tt(limit) ] ... ])(
Set or display resource limits of the shell and the processes started by
the shell. The value of var(limit) can be a number in the unit specified
below or the value `tt(unlimited)'. If the tt(-H) flag is given use
hard limits instead of soft limits. If the tt(-S) flag is given
together with the tt(-H) flag set both hard and soft limits. If no
options are used, the file size limit (tt(-f)) is assumed. If
var(limit) is omitted the current value of the specified resources are
printed. When more than one resource values are printed the limit name and
unit is printed before each value.
startsitem()
sitem(tt(-a))(Lists all of the current resource limits.)
sitem(tt(-c))(512-byte blocks on the size of core dumps.)
sitem(tt(-d))(K-bytes on the size of the data segment.)
sitem(tt(-f))(512-byte blocks on the size of files written.)
sitem(tt(-l))(K-bytes on the size of locked-in memory.)
sitem(tt(-m))(K-bytes on the size of physical memory.)
sitem(tt(-n))(open file descriptors.)
sitem(tt(-s))(K-bytes on the size of the stack.)
sitem(tt(-t))(CPU seconds to be used.)
sitem(tt(-u))(processes available to the user.)
sitem(tt(-v))(K-bytes on the size of virtual memory.)
endsitem()
)
findex(umask)
cindex(umask)
item(tt(umask) [ tt(-S) ] [ var(mask) ])(
The umask is set to var(mask). var(mask) can be either
an octal number or a symbolic value as described in manref(chmod)(1).
If var(mask) is omitted, the current value is printed. The tt(-S)
option causes the mask to be printed as a symbolic value. Otherwise,
the mask is printed as an octal number. Note that in
the symbolic form the permissions you specify are those which are to be
allowed (not denied) to the users specified.
)
cindex(aliases, removing)
alias(unalias)(unhash -a)
cindex(functions, removing)
alias(unfunction)(unhash -f)
findex(unhash)
item(tt(unhash) [ tt(-adfm) ] var(name) ...)(
Remove the element named var(name) from an internal hash table. The
default is remove elements from the command hash table. The tt(-a)
option causes tt(unhash) to remove aliases. The tt(-f) option causes
tt(unhash) to remove shell functions. The tt(-d) options causes
tt(unhash) to remove named directories. If the tt(-m) flag is given
the arguments are taken as patterns (should be quoted) and all elements
of the corresponding hash table with matching names will be removed.
)
findex(unlimit)
cindex(resource limits)
cindex(limits, resource)
item(tt(unlimit) [ tt(-hs) ] var(resource) ...)(
The resource limit for each var(resource) is set to the hard limit.
If the tt(-h) flag is given and the shell has appropriate privileges,
the hard resource limit for each var(resource) is removed.
The resources of the shell process are only changed if the tt(-s)
flag is given.
)
findex(unset)
cindex(parameters, unsetting)
item(tt(unset) [ tt(-fm) ] var(name) ...)(
Each named parameter is unset.
Local parameters remain local even if unset; they appear unset within scope,
but the previous value will still reappear when the scope ends.
If the tt(-m) flag is specified the
arguments are taken as patterns (should be quoted) and all parameters
with matching names are unset. tt(unset -f) is equivalent to
tt(unfunction).
)
findex(unsetopt)
cindex(options, unsetting)
item(tt(unsetopt) [ {tt(PLUS())|tt(-)}var(options) | \
{tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ var(name) ... ])(
Unset the options for the shell. All options specified either
with flags or by name are unset. If no arguments are supplied,
the names of all options currently unset are printed.
If the tt(-m) flag is given the arguments are taken as patterns
(which should be quoted to preserve them from being interpreted as glob
patterns), and all options with names matching these patterns are unset.
)
findex(wait)
cindex(waiting for jobs)
cindex(jobs, waiting for)
item(tt(wait) [ var(job) ... ])(
Wait for the specified jobs or processes. If var(job) is not given
then all currently active child processes are waited for.
Each var(job) can be either a job specification or the process ID
of a job in the job table.
The exit status from this command is that of the job waited for.
)
findex(whence)
item(tt(whence) [ tt(-vcwfpams) ] var(name) ...)(
For each name, indicate how it would be interpreted if used as a
command name.
startitem()
item(tt(-v))(
Produce a more verbose report.
)
item(tt(-c))(
Print the results in a bf(csh)-like format.
This takes precedence over tt(-v).
)
item(tt(-w))(
For each var(name), print `var(name)tt(:) var(word)' where var(word)
is one of tt(alias), tt(builtin), tt(command), tt(function),
tt(hashed), tt(reserved) or tt(none), according as var(name)
corresponds to an alias, a built-in command, an external command, a
shell function, a command defined with the tt(hash) builtin, a
reserved word, or is not recognised. This takes precedence over
tt(-v) and tt(-c).
)
item(tt(-f))(
Causes the contents of a shell function to be
displayed, which would otherwise not happen unless the tt(-c)
flag were used.
)
item(tt(-p))(
Do a path search for var(name)
even if it is an alias, reserved word, shell function or builtin.
)
item(tt(-a))(
Do a search for all occurrences of var(name)
throughout the command path.
Normally only the first occurrence is printed.
)
item(tt(-m))(
The arguments are taken as patterns (should be
quoted), and the information is displayed for each command matching one
of these patterns.
)
item(tt(-s))(
If a pathname contains symlinks, print the symlink-free pathname as well.
)
enditem()
)
findex(where)
item(tt(where) [ tt(-wpms) ] var(name) ...)(
Equivalent to tt(whence -ca).
)
findex(which)
item(tt(which) [ tt(-wpams) ] var(name) ...)(
Equivalent to tt(whence -c).
)
findex(zmodload)
cindex(modules, loading)
cindex(loading modules)
xitem(tt(zmodload) [ tt(-iL) ] [ var(name) ... ])
xitem(tt(zmodload) tt(-u) [ tt(-i) ] var(name) ...)
xitem(tt(zmodload) tt(-d) [ tt(-L) ] [ var(name) [ var(dep) ... ] ])
xitem(tt(zmodload) tt(-du) var(name) [ var(dep) ... ])
xitem(tt(zmodload) tt(-a) [ tt(-iL) ] [ var(name) [ var(builtin) ... ] ])
item(tt(zmodload) tt(-au) [ tt(-i) ] var(builtin) ...)(
tt(zmodload) performs operations relating to zsh's loadable modules.
This feature is not available on all operating systems,
or on all installations on a particular operating system.
In the simplest case,
tt(zmodload) loads a binary module. The module must be in a file with a
name consisting of the specified var(name) followed by a standard suffix,
usually `tt(.so)'. If this can't be found, the var(name) is tried without
the suffix.
If the module to be loaded is already loaded and the tt(-i)
option is given, the duplicate module is ignored. Otherwise
tt(zmodload) prints an error message.
The var(name)d module is searched for in the same way a command is, using
tt($module_path) instead of tt($path). If var(name) contains a `tt(/)',
it will be used as-is, and a path search will be performed otherwise.
This behaviour can be modified by the tt(PATH_DIRS) option.
cindex(PATH_DIRS, use of)
With tt(-u), tt(zmodload) unloads modules. The same var(name)
must be given that was given when the module was loaded, but it is not
necessary for the module to exist in the filesystem.
The tt(-i) option suppresses the error if the module is already
unloaded (or was never loaded).
Each module has a boot and a cleanup function. The module
will not be loaded if its boot function fails. Similarly a module
can only be unloaded if its cleanup function runs successfully.
Without arguments all currently loaded binary modules are printed.
The tt(-L) option causes this list to be in the form of a series of
tt(zmodload) commands.
The tt(-d) option can be used to specify module dependencies.
This operation is idempotent regardless of the tt(-i) option.
The modules named in the second and subsequent arguments will be
loaded before the module named in the first argument.
With tt(-d) and one
argument, all dependencies for that module are listed. With tt(-d) and no
arguments, all module dependencies are listed.
This listing is by default in a Makefile-like format.
The tt(-L) option changes this format to a list of
tt(zmodload -d) commands.
If tt(-d) and tt(-u) are both used, dependencies are removed.
This operation is idempotent regardless of the tt(-i) option.
If only one argument is given, all dependencies for that module are removed.
The tt(-a) option defines autoloaded builtins. It defines the
specified var(builtin)s. When any of those builtins is called, the module
specified in the first argument is loaded. If only one argument is given,
one builtin is defined, with the same name as the module.
tt(-i) suppresses the error if the builtin is already defined or
autoloaded, regardless of which module it came from.
With tt(-a) and no arguments, all
autoloaded builtins are listed, with the module name (if different)
shown in parentheses after the builtin name. The tt(-L) option changes
this format to a list of tt(zmodload -a) commands.
If tt(-a) is used
together with the tt(-u) option it removes builtins defined with
tt(zmodload -a). This is only possible if the builtin is not yet
loaded. tt(-i) suppresses the error if the builtin is already
removed (or never existed).
)
enditem()

69
Doc/Zsh/compat.yo Normal file
View File

@ -0,0 +1,69 @@
texinode(Compatibility)(Prompt Expansion)(Conditional Expressions)(Top)
chapter(Compatibility)
ifzman(\
sect(Compatibility)
)\
cindex(compatibility)
cindex(sh, compatibility)
cindex(ksh, compatibility)
Zsh tries to emulate bf(sh) or bf(ksh) when it is invoked as
tt(sh) or tt(ksh) respectively. In this mode the following
parameters are not special and not initialized by the shell:
tt(ARGC),
tt(argv),
tt(cdpath),
tt(fignore),
tt(fpath),
tt(HISTCHARS),
tt(mailpath),
tt(MANPATH),
tt(manpath),
tt(path),
tt(prompt),
tt(PROMPT),
tt(PROMPT2),
tt(PROMPT3),
tt(PROMPT4),
tt(psvar),
tt(status),
tt(watch).
The usual zsh startup/shutdown scripts are not executed. Login shells
source tt(/etc/profile) followed by tt($HOME/.profile). If the
tt(ENV) environment variable is set on invocation, tt($ENV) is sourced
after the profile scripts. The value of tt(ENV) is subjected to
parameter expansion, command substitution, and arithmetic expansion before
being interpreted as a pathname. Note that the tt(PRIVILEGED) option
also affects the execution of startup files.
The following options are set if the shell is invoked as tt(sh) or
tt(ksh):
tt(NO_BAD_PATTERN),
tt(NO_BANG_HIST),
tt(NO_BG_NICE),
tt(NO_EQUALS),
tt(NO_FUNCTION_ARGZERO),
tt(GLOB_SUBST),
tt(NO_HUP),
tt(INTERACTIVE_COMMENTS),
tt(KSH_ARRAYS),
tt(NO_MULTIOS),
tt(NO_NOMATCH),
tt(NO_NOTIFY),
tt(POSIX_BUILTINS),
tt(NO_PROMPT_PERCENT),
tt(RM_STAR_SILENT),
tt(SH_FILE_EXPANSION),
tt(SH_GLOB),
tt(SH_OPTION_LETTERS),
tt(SH_WORD_SPLIT).
Additionally the tt(BSD_ECHO) and tt(IGNORE_BRACES)
options are set if zsh is invoked as tt(sh).
Also, the
tt(KSH_OPTION_PRINT),
tt(LOCAL_OPTIONS),
tt(PROMPT_BANG),
tt(PROMPT_SUBST)
and
tt(SINGLE_LINE_ZLE)
options are set if zsh is invoked as tt(ksh).

526
Doc/Zsh/compctl.yo Normal file
View File

@ -0,0 +1,526 @@
texinode(Programmable Completion)(Zsh Modules)(Zsh Line Editor)(Top)
chapter(Programmable Completion)
cindex(completion, programmable)
cindex(completion, controlling)
findex(compctl)
sect(Description)
startlist()
list(tt(compctl) [ tt(-CDT) ] var(options) [ var(command) ... ])
list(tt(compctl) [ tt(-CDT) ] var(options) \
[ tt(-x) var(pattern) var(options) tt(-) ... tt(--) ] \
[ tt(PLUS()) var(options) [ tt(-x) ... tt(--) ] ... [tt(PLUS())] ] \
[ var(command) ... ])
list(tt(compctl) tt(-L) [ tt(-CDT) ] [ var(command) ... ])
list(tt(compctl) tt(PLUS()) var(command) ...)
endlist()
Control the editor's completion behavior according to the supplied set
of var(options). Various editing commands, notably
tt(expand-or-complete-word), usually bound to tab, will
attempt to complete a word typed by the user, while others, notably
tt(delete-char-or-list), usually bound to ^D in EMACS editing
mode, list the possibilities; tt(compctl) controls what those
possibilities are. They may for example be filenames (the most common
case, and hence the default), shell variables, or words from a
user-specified list.
startmenu()
menu(Command Flags)
menu(Option Flags)
menu(Alternative Completion)
menu(Extended Completion)
menu(Example)
endmenu()
texinode(Command Flags)(Option Flags)()(Programmable Completion)
sect(Command Flags)
Completion of the arguments of a command may be different for each
command or may use the default. The behavior when completing the
command word itself may also be separately specified. These
correspond to the following flags and arguments, all of which (except
for tt(-L)) may be combined with any combination of the
var(options) described subsequently in noderef(Option Flags):
startitem()
item(var(command) ...)(
controls completion for the named commands, which must be listed last
on the command line. If completion is attempted for a command with a
pathname containing slashes and no completion definition is found, the
search is retried with the last pathname component. Note that aliases
are expanded before the command name is determined unless the
tt(COMPLETE_ALIASES) option is set. Commands should not be combined
with the tt(-C), tt(-D) or tt(-T) flags.
)
item(tt(-C))(
controls completion when the command word itself is being completed.
If no tt(compctl -C) command has been issued, the names of any
executable command (whether in the path or specific to the shell, such
as aliases or functions) are completed.
)
item(tt(-D))(
controls default completion behavior for the arguments of commands not
assigned any special behavior. If no tt(compctl -D) command has
been issued, filenames are completed.
)
item(tt(-T))(
supplies completion flags to be used before any other processing is
done, even those given to specific commands with other compctl
definitions. This is only useful when combined with extended
completion (the tt(-x) flag, see noderef(Extended Completion) below).
Using this flag you can define default behavior
which will apply to all commands without exception, or you can alter
the standard behavior for all commands. For example, if your access
to the user database is too slow and/or it contains too many users (so
that completion after `tt(~)' is too slow to be usable), you can use
nofill(tt(compctl -Tx 'C[0,*/*]' -f - 's[~]' -k friends -S/))
to complete the strings in the array tt(friends) after a `tt(~)'.
The first argument is necessary so that this form of ~-completion is
not tried after the directory name is finished.
)
item(tt(-L))(
lists the existing completion behavior in a manner suitable for
putting into a start-up script; the existing behavior is not changed.
Any combination of the above forms may be specified, otherwise all
defined completions are listed. Any other flags supplied
are ignored.
)
item(em(no argument))(
If no argument is given, tt(compctl) lists all defined completions
in an abbreviated form; with a list of var(options), all completions
with those flags set (not counting extended completion) are listed.
)
endlist()
If the tt(PLUS()) flag is alone and followed immediately by the var(command)
list, the completion behavior for all the commands in the list is reset to
the default. In other words, completion will subsequently use the
options specified by the tt(-D) flag.
texinode(Option Flags)(Alternative Completion)(Command Flags)(Programmable Completion)
sect(Option Flags)
startlist()
list([ tt(-fcFBdeaRGovNAIOPZEnbjrzu/) ])
list([ tt(-k) var(array) ] [ tt(-g) var(globstring) ] \
[ tt(-s) var(subststring) ])
list([ tt(-K) var(function) ] [ tt(-H) var(num pattern) ])
list([ tt(-Q) ] [ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ])
list([ tt(-W) var(file-prefix) ])
list([ tt(-q) ] [ tt(-X) var(explanation) ] [ tt(-Y) var(explanation) ])
list([ tt(-y) var(func-or-var) ] [ tt(-l) var(cmd) ] [ tt(-U) ])
endlist()
The remaining var(options) specify the type of command arguments
to look for during completion. Any combination of these flags may be
specified; the result is a sorted list of all the possibilities. The
options are as follows.
startmenu()
menu(Simple Flags)
menu(Flags with Arguments)
menu(Control Flags)
endmenu()
texinode(Simple Flags)(Flags with Arguments)()(Option Flags)
subsect(Simple Flags)
These produce completion lists made up by the shell itself:
startitem()
item(tt(-f))(
Filenames and filesystem paths.
)
item(tt(-/))(
Just filesystem paths.
)
item(tt(-c))(
Command names, including aliases, shell functions, builtins
and reserved words.
)
item(tt(-F))(
Function names.
)
item(tt(-B))(
Names of builtin commands.
)
item(tt(-m))(
Names of external commands.
)
item(tt(-w))(
Reserved words.
)
item(tt(-a))(
Alias names.
)
item(tt(-R))(
Names of regular (non-global) aliases.
)
item(tt(-G))(
Names of global aliases.
)
item(tt(-d))(
This can be combined with tt(-F), tt(-B), tt(-w),
tt(-a), tt(-R) and tt(-G) to get names of disabled
functions, builtins, reserved words or aliases.
)
item(tt(-e))(
This option (to show enabled commands) is in effect by default, but
may be combined with tt(-d); tt(-de) in combination with
tt(-F), tt(-B), tt(-w), tt(-a), tt(-R) and tt(-G)
will complete names of functions, builtins, reserved words or aliases
whether or not they are disabled.
)
item(tt(-o))(
Names of shell options (see
ifzman(zmanref(zshoptions))\
ifnzman(noderef(Options))\
).
)
item(tt(-v))(
Names of any variable defined in the shell.
)
item(tt(-N))(
Names of scalar (non-array) parameters.
)
item(tt(-A))(
Array names.
)
item(tt(-I))(
Names of integer variables.
)
item(tt(-O))(
Names of read-only variables.
)
item(tt(-p))(
Names of parameters used by the shell (including special parameters).
)
item(tt(-Z))(
Names of shell special parameters.
)
item(tt(-E))(
Names of environment variables.
)
item(tt(-n))(
Named directories.
)
item(tt(-b))(
Key binding names.
)
item(tt(-j))(
Job names: the first word of the job leader's command line. This is useful
with the tt(kill) builtin.
)
item(tt(-r))(
Names of running jobs.
)
item(tt(-z))(
Names of suspended jobs.
)
item(tt(-u))(
User names.
)
enditem()
texinode(Flags with Arguments)(Control Flags)(Simple Flags)(Option Flags)
subsect(Flags with Arguments)
These have user supplied arguments to determine how the list of
completions is to be made up:
startitem()
item(tt(-k) var(array))(
Names taken from the elements of tt($)var(array) (note that the `tt($)'
does not appear on the command line).
Alternatively, the argument var(array) itself may be a set
of space- or comma-separated values in parentheses, in which any
delimiter may be escaped with a backslash; in this case the argument
should be quoted. For example,
nofill(tt(compctl -k "(cputime filesize datasize stacksize
coredumpsize resident descriptors)" limit))
)
item(tt(-g) var(globstring))(
The var(globstring) is expanded using filename globbing; it should be
quoted to protect it from immediate expansion. The resulting
filenames are taken as the possible completions. Use `tt(*(/))' instead of
`tt(*/)' for directories. The tt(fignore) special parameter is not
applied to the resulting files. More than one pattern may be given
separated by blanks. (Note that brace expansion is em(not) part of
globbing. Use the syntax `tt((either|or))' to match alternatives.)
)
item(tt(-s) var(subststring))(
The var(subststring) is split into words and these words are than
expanded using all shell expansion mechanisms (see
ifzman(zmanref(zshexpn))\
ifnzman(noderef(Expansion))\
). The resulting words are taken as possible
completions. The tt(fignore) special parameter is not applied to the
resulting files. Note that tt(-g) is faster for filenames.
)
item(tt(-K) var(function))(
Call the given function to get the completions. The function is
passed two arguments: the prefix and the suffix of the word on which
completion is to be attempted, in other words those characters before
the cursor position, and those from the cursor position onwards. The
whole command line can be accessed with the tt(-c) and tt(-l) flags
of the tt(read) builtin. The
function should set the variable tt(reply) to an array containing
the completions (one completion per element); note that tt(reply)
should not be made local to the function. From such a function the
command line can be accessed with the tt(-c) and tt(-l) flags to
the tt(read) builtin. For example,
nofill(tt(function whoson { reply=(`users`); }
compctl -K whoson talk))
completes only logged-on users after `tt(talk)'. Note that `tt(whoson)' must
return an array, so `tt(reply=`users`)' would be incorrect.
)
item(tt(-H) var(num pattern))(
The possible completions are taken from the last var(num) history
lines. Only words matching var(pattern) are taken. If var(num) is
zero or negative the whole history is searched and if var(pattern) is
the empty string all words are taken (as with `tt(*)'). A typical
use is
nofill(tt(compctl -D -f PLUS() -H 0 ''))
which forces completion to look back in the history list for a word if
no filename matches.
)
enditem()
texinode(Control Flags)()(Flags with Arguments)(Option Flags)
subsect(Control Flags)
These do not directly specify types of name to be completed, but
manipulate the options that do:
startitem()
item(tt(-Q))(
This instructs the shell not to quote any metacharacters in the possible
completions. Normally the results of a completion are inserted into
the command line with any metacharacters quoted so that they are
interpreted as normal characters. This is appropriate for filenames
and ordinary strings. However, for special effects, such as inserting
a backquoted expression from a completion array (tt(-k)) so that
the expression will not be evaluated until the complete line is
executed, this option must be used.
)
item(tt(-P) var(prefix))(
The var(prefix) is inserted just before the completed string; any
initial part already typed will be completed and the whole var(prefix)
ignored for completion purposes. For example,
nofill(tt(compctl -j -P "%" kill))
inserts a `%' after the kill command and then completes job names.
)
item(tt(-S) var(suffix))(
When a completion is found the var(suffix) is inserted after
the completed string. In the case of menu completion the suffix is
inserted immediately, but it is still possible to cycle through the
list of completions by repeatedly hitting the same key.
)
item(tt(-W) var(file-prefix))(
With directory var(file-prefix): for command, file, directory and
globbing completion (options tt(-c), tt(-f), tt(-/), tt(-g)), the file
prefix is implicitly added in front of the completion. For example,
nofill(tt(compctl -/ -W ~/Mail maildirs))
completes any subdirectories to any depth beneath the directory
tt(~/Mail), although that prefix does not appear on the command line.
)
item(tt(-q))(
If used with a suffix as specified by the tt(-S) option, this
causes the suffix to be removed if the next character typed is a blank
or does not insert anything (the same rule as used for the
tt(AUTO_REMOVE_SLASH) option). The option is most useful for list
separators (comma, colon, etc.).
)
item(tt(-l) var(cmd))(
This option cannot be combined with any other. It restricts the range
of command line words that are considered to be arguments. If
combined with one of the extended completion patterns `tt(p[)...tt(])',
`tt(r[)...tt(])', or `tt(R[)...tt(])' (see noderef(Extended Completion)
below) the range is restricted to the range of arguments
specified in the brackets. Completion is then performed as if these
had been given as arguments to the var(cmd) supplied with the
option. If the var(cmd) string is empty the first word in the range
is instead taken as the command name, and command name completion
performed on the first word in the range. For example,
nofill(tt(compctl -x 'r[-exec,;]' -l '' -- find))
completes arguments between `tt(-exec)' and the following `tt(;)' (or the end
of the command line if there is no such string) as if they were
a separate command line.
)
item(tt(-U))(
Use the whole list of possible completions, whether or not they
actually match the word on the command line. The word typed so far
will be deleted. This is most useful with a function (given by the
tt(-K) option) which can examine the word components passed to it
(or via the tt(read) builtin's tt(-c) and tt(-l) flags) and
use its own criteria to decide what matches. If there is no
completion, the original word is retained.
)
item(tt(-y) var(func-or-var))(
The list provided by var(func-or-var) is displayed instead of the list
of completions whenever a listing is required; the actual completions
to be inserted are not affected. It can be provided in two
ways. Firstly, if var(func-or-var) begins with a tt($) it defines a
variable, or if it begins with a left parenthesis a literal
array, which contains the list. A variable may have been set by a
call to a function using the tt(-K) option. Otherwise it contains the
name of a function which will be executed to create the list. The
function will be passed as an argument list all matching completions,
including prefixes and suffixes expanded in full, and should set the
array var(reply) to the result. In both cases, the display list will
only be retrieved after a complete list of matches has been created.
Note that the returned list does not have to correspond, even in
length, to the original set of matches, and may be passed as a scalar
instead of an array. No special formatting of characters is
performed on the output in this case; in particular, newlines are
printed literally and if they appear output in columns is suppressed.
)
item(tt(-X) var(explanation))(
Print var(explanation) when trying completion on the current set of
options. A `tt(%n)' in this string is replaced by the number of matches.
The explanation only appears if completion was tried and there was
no unique match, or when listing completions.
)
item(tt(-Y) var(explanation))(
Identical to tt(-X), except that the var(explanation) first undergoes
expansion following the usual rules for strings in double quotes.
The expansion will be carried out after any functions are called for
the tt(-K) or tt(-y) options, allowing them to set variables.
)
enditem()
texinode(Alternative Completion)(Extended Completion)(Option Flags)(Programmable Completion)
sect(Alternative Completion)
startlist()
list(tt(compctl) [ tt(-CDT) ] var(options) tt(PLUS()) var(options) [ tt(PLUS()) ... ] \
[ tt(PLUS()) ] var(command) ...)
endlist()
The form with `tt(PLUS())' specifies alternative options. Completion is
tried with the options before the first `tt(PLUS())'. If this produces no
matches completion is tried with the flags after the `tt(PLUS())' and so on. If
there are no flags after the last `tt(PLUS())' and a match has not been found
up to that point, default completion is tried.
texinode(Extended Completion)(Example)(Alternative Completion)(Programmable Completion)
sect(Extended Completion)
startlist()
list(tt(compctl) [ tt(-CDT) ] var(options) \
tt(-x) var(pattern) var(options) tt(-) ... tt(--) \
[ var(command) ... ])
list(tt(compctl) [ tt(-CDT) ] var(options) \
[ tt(-x) var(pattern) var(options) tt(-) ... tt(--) ] \
[ tt(PLUS()) var(options) [ tt(-x) ... tt(--) ] ... [tt(PLUS())] ] \
[ var(command) ... ])
endlist()
The form with `tt(-x)' specifies extended completion for the
commands given; as shown, it may be combined with alternative
completion using `tt(PLUS())'. Each var(pattern) is examined in turn; when a
match is found, the corresponding var(options), as described in
noderef(Option Flags) above, are used to generate possible
completions. If no var(pattern) matches, the var(options) given
before the tt(-x) are used.
Note that each pattern should be supplied as a single argument and
should be quoted to prevent expansion of metacharacters by the
shell.
A var(pattern) is built of sub-patterns separated by commas; it
matches if at least one of these sub-patterns matches (they are
`or'ed). These sub-patterns are in turn composed of other
sub-patterns separated by white spaces which match if all of the
sub-patterns match (they are `and'ed). An element of the
sub-patterns is of the form `var(c)tt([)...tt(][)...tt(])', where the pairs of
brackets may be repeated as often as necessary, and matches if any of
the sets of brackets match (an `or'). The example below makes this
clearer.
The elements may be any of the following:
startitem()
item(tt(s[)var(string)tt(])...)(
Matches if the current word on the command line starts with
one of the strings given in brackets. The var(string) is not removed
and is not part of the completion.
)
item(tt(S[)var(string)tt(])...)(
Like tt(s[)var(string)tt(]) except that the var(string) is part of the
completion.
)
item(tt(p[)var(from)tt(,)var(to)tt(])...)(
Matches if the number of the current word is between one of
the var(from) and var(to) pairs inclusive. The comma and var(to)
are optional; var(to) defaults to the same value as var(from). The
numbers may be negative: tt(-)var(n) refers to the var(n)'th last word
on the line.
)
item(tt(c[)var(offset)tt(,)var(string)tt(])...)(
Matches if the var(string) matches the word offset by
var(offset) from the current word position. Usually var(offset)
will be negative.
)
item(tt(C[)var(offset)tt(,)var(pattern)tt(])...)(
Like tt(c) but using pattern matching instead.
)
item(tt(w[)var(index)tt(,)var(string)tt(])...)(
Matches if the word in position var(index) is equal
to the corresponding var(string). Note that the word count is made
after any alias expansion.
)
item(tt(W[)var(index)tt(,)var(pattern)tt(])...)(
Like tt(w) but using pattern matching instead.
)
item(tt(n[)var(index)tt(,)var(string)tt(])...)(
Matches if the current word contains var(string). Anything up to and
including the var(index)th occurrence of this string will not be
considered part of the completion, but the rest will. var(index) may
be negative to count from the end: in most cases, var(index) will be
1 or -1. For example,
nofill(tt(compctl -s '`users`' -x 'n[1,@]' -k hosts -- talk))
will usually complete usernames, but if you insert an tt(@) after the
name, names from the array var(hosts) (assumed to contain hostnames,
though you must make the array yourself) will be completed. Other
commands such as tt(rcp) can be handled similarly.
)
item(tt(N[)var(index)tt(,)var(string)tt(])...)(
Like tt(n) except that the string will be
taken as a character class. Anything up to and including the
var(index)th occurrence of any of the characters in var(string)
will not be considered part of the completion.
)
item(tt(m[)var(min)tt(,)var(max)tt(])...)(
Matches if the total number of words lies between var(min) and
var(max) inclusive.
)
item(tt(r[)var(str1)tt(,)var(str2)tt(])...)(
Matches if the cursor is after a word with prefix var(str1). If there
is also a word with prefix var(str2) on the command line it matches
only if the cursor is before this word.
)
item(tt(R[)var(str1)tt(,)var(str2)tt(])...)(
Like tt(r) but using pattern matching instead.
)
enditem()
texinode(Example)()(Extended Completion)(Programmable Completion)
sect(Example)
nofill(tt(compctl -u -x 's[tt(PLUS())] c[-1,-f],s[-f+PLUS()]' -g '~/Mail/*(:t)' \
- 's[-f],c[-1,-f]' -f -- mail))
This is to be interpreted as follows:
If the current command is tt(mail), then
indent(
if ((the current word begins with tt(PLUS()) and the previous word is tt(-f))
or (the current word begins with tt(-f+PLUS()))), then complete the
non-directory part (the `tt(:t)' glob modifier) of files in the directory
tt(~/Mail); else
if the current word begins with tt(-f) or the previous word was tt(-f), then
complete any file; else
complete user names.
)

158
Doc/Zsh/cond.yo Normal file
View File

@ -0,0 +1,158 @@
texinode(Conditional Expressions)(Compatibility)(Arithmetic Evaluation)(Top)
chapter(Conditional Expressions)
ifzman(\
sect(Conditional Expressions)
)\
cindex(conditional expressions)
cindex(expressions, conditional)
A em(conditional expression) is used with the tt([[)
compound command to test attributes of files and to compare strings.
Each expression can be constructed from one or more
of the following unary or binary expressions:
startitem()
item(tt(-a) var(file))(
true if var(file) exists.
)
item(tt(-b) var(file))(
true if var(file) exists and is a block special file.
)
item(tt(-c) var(file))(
true if var(file) exists and is a character special file.
)
item(tt(-d) var(file))(
true if var(file) exists and is a directory.
)
item(tt(-e) var(file))(
true if var(file) exists.
)
item(tt(-f) var(file))(
true if var(file) exists and is a regular file.
)
item(tt(-g) var(file))(
true if var(file) exists and has its setgid bit set.
)
item(tt(-h) var(file))(
true if var(file) exists and is a symbolic link.
)
item(tt(-k) var(file))(
true if var(file) exists and has its sticky bit set.
)
item(tt(-n) var(string))(
true if length of var(string) is non-zero.
)
item(tt(-o) var(option))(
true if option named var(option) is on. var(option)
may be a single character, in which case it is a single letter option name.
(See noderef(Specifying Options).)
)
item(tt(-p) var(file))(
true if var(file) exists and is a FIFO special file (named pipe).
)
item(tt(-r) var(file))(
true if var(file) exists and is readable by current process.
)
item(tt(-s) var(file))(
true if var(file) exists and has size greater than zero.
)
item(tt(-t) var(fd))(
true if file descriptor number var(fd)
is open and associated with a terminal device.
(note: var(fd) is not optional)
)
item(tt(-u) var(file))(
true if var(file) exists and has its setuid bit set.
)
item(tt(-w) var(file))(
true if var(file) exists and is writable by current process.
)
item(tt(-x) var(file))(
true if var(file) exists and is executable by current process.
If var(file) exists and is a directory, then the current process
has permission to search in the directory.
)
item(tt(-z) var(string))(
true if length of var(string) is zero.
)
item(tt(-L) var(file))(
true if var(file) exists and is a symbolic link.
)
item(tt(-O) var(file))(
true if var(file) exists and is owned by the effective user ID of this process.
)
item(tt(-G) var(file))(
true if var(file) exists and its group matches
the effective group ID of this process.
)
item(tt(-S) var(file))(
true if var(file) exists and is a socket.
)
item(tt(-N) var(file))(
true if var(file) exists and its access time is
not newer than its modification time.
)
item(var(file1) tt(-nt) var(file2))(
true if var(file1) exists and is newer than var(file2).
)
item(var(file1) tt(-ot) var(file2))(
true if var(file1) exists and is older than var(file2).
)
item(var(file1) tt(-ef) var(file2))(
true if var(file1) and var(file2) exist and refer to the same file.
)
xitem(var(string) tt(=) var(pattern))
item(var(string) tt(==) var(pattern))(
true if var(string) matches var(pattern).
The `tt(==)' form is the preferred one. The `tt(=)' form is for
backward compatibility and should be considered obsolete.
)
item(var(string) tt(!=) var(pattern))(
true if var(string) does not match var(pattern).
)
item(var(string1) tt(<) var(string2))(
true if var(string1) comes before var(string2)
based on ASCII value of their characters.
)
item(var(string1) tt(>) var(string2))(
true if var(string1) comes after var(string2)
based on ASCII value of their characters.
)
item(var(exp1) tt(-eq) var(exp2))(
true if var(exp1) is numerically equal to var(exp2).
)
item(var(exp1) tt(-ne) var(exp2))(
true if var(exp1) is numerically not equal to var(exp2).
)
item(var(exp1) tt(-lt) var(exp2))(
true if var(exp1) is numerically less than var(exp2).
)
item(var(exp1) tt(-gt) var(exp2))(
true if var(exp1) is numerically greater than var(exp2).
)
item(var(exp1) tt(-le) var(exp2))(
true if var(exp1) is numerically less than or equal to var(exp2).
)
item(var(exp1) tt(-ge) var(exp2))(
true if var(exp1) is numerically greater than or equal to var(exp2).
)
item(tt(LPAR()) var(exp) tt(RPAR()))(
true if var(exp) is true.
)
item(tt(!) var(exp))(
true if var(exp) is false.
)
item(var(exp1) tt(&&) var(exp2))(
true if var(exp1) and var(exp2) are both true.
)
item(var(exp1) tt(||) var(exp2))(
true if either var(exp1) or var(exp2) is true.
)
enditem()
In each of the above expressions, if
var(file) is of the form `tt(/dev/fd/)var(n)',
where var(n) is an integer,
then the test applied to the open file whose
descriptor number is var(n),
even if the underlying system does not support
the tt(/dev/fd) directory.

25
Doc/Zsh/exec.yo Normal file
View File

@ -0,0 +1,25 @@
texinode(Command Execution)(Functions)(Redirection)(Top)
chapter(Command Execution)
ifzman(\
sect(Command Execution)
)\
cindex(command execution)
cindex(execution, of commands)
If a command name contains no slashes, the shell attempts to locate
it. If there exists a shell function by that name, the function
is invoked as described in noderef(Functions). If there exists
a shell builtin by that name, the builtin is invoked.
vindex(path, use of)
Otherwise, the shell searches each element of tt($path) for a
directory containing an executable file by that name. If the
search is unsuccessful, the shell prints an error message and returns
a nonzero exit status.
If execution fails because the file is not in executable format,
and the file is not a directory, it is assumed to be a shell
script. tt(/bin/sh) is spawned to execute it. If the program
is a file beginning with `tt(#!)', the remainder of the first line
specifies an interpreter for the program. The shell will
execute the specified interpreter on operating systems that do
not handle this executable format in the kernel.

1052
Doc/Zsh/expn.yo Normal file
View File

@ -0,0 +1,1052 @@
texinode(Expansion)(Parameters)(Restricted Shell)(Top)
chapter(Expansion)
cindex(expansion)
sect(Description)
The types of expansions performed are
startlist()
list(em(history expansion))
list(em(alias expansion))
list(em(process substitution))
list(em(parameter expansion))
list(em(command substitution))
list(em(arithmetic expansion))
list(em(brace expansion))
list(em(filename expansion))
list(em(filename generation))
endlist()
Expansion is done in the above specified order in five steps. The
first is em(history expansion), which is only performed in
interactive shells. The next step is em(alias expansion), which is
done right before the command line is parsed. They are followed by
em(process substitution), em(parameter expansion), em(command
substitution), em(arithmetic expansion) and em(brace expansion)
which are performed in one step in left-to-right fashion. After
these expansions, all unquoted occurrences of the characters `tt(\)',
`tt(')' and `tt(")' are removed, and the result is subjected to
em(filename expansion) followed by em(filename generation).
If the tt(SH_FILE_EXPANSION) option is set, the order of expansion is modified
for compatibility with bf(sh) and bf(ksh). em(Filename expansion)
is performed immediately after em(alias substitution),
preceding the set of five substitutions mentioned above.
startmenu()
menu(History Expansion)
menu(Process Substitution)
menu(Parameter Expansion)
menu(Command Substitution)
menu(Arithmetic Expansion)
menu(Brace Expansion)
menu(Filename Expansion)
menu(Filename Generation)
endmenu()
texinode(History Expansion)(Process Substitution)()(Expansion)
sect(History Expansion)
cindex(history)
cindex(history expansion)
cindex(expansion, history)
History expansion allows you to use words from previous command
lines in the command line you are typing. This simplifies spelling
corrections and the repetition of complicated commands or arguments.
Command lines are saved in the history list, the size of which
is controlled by the tt(HISTSIZE)
vindex(HISTSIZE, use of)
variable. The most recent command is retained in any case.
A history expansion begins with the first character of the
tt(histchars) parameter which is `tt(!)'
by default and may occur anywhere on the command line; history
expansions do not nest. The `tt(!)' can be escaped with `tt(\)'
or can be enclosed between a pair of single quotes (tt('')) to suppress
its special meaning. Double quotes will em(not) work for this.
Input lines containing history expansions are echoed on the
terminal after being expanded, but before any other
expansions take place or the command gets executed.
startmenu()
menu(Event Designators)
menu(Word Designators)
menu(Modifiers)
endmenu()
texinode(Event Designators)(Word Designators)()(History Expansion)
subsect(Event Designators)
cindex(history event designators)
cindex(event designators, history)
An event designator is a reference to a command-line entry in
the history list.
startitem()
item(tt(!))(
Start a history expansion, except when followed by a blank, newline,
`tt(=)' or `tt(LPAR())'.
)
item(tt(!!))(
Refer to the previous command.
By itself, this expansion
repeats the previous command.
)
item(tt(!)var(n))(
Refer to command-line var(n).
)
item(tt(!-)var(n))(
Refer to the current command-line minus var(n).
)
item(tt(!)var(str))(
Refer to the most recent command starting with var(str).
)
item(tt(!?)var(str)[tt(?)])(
Refer to the most recent command containing var(str).
)
item(tt(!#))(
Refer to the current command line typed in so far. The line is
treated as if it were complete up to and including the word before the
one with the `tt(!#)' reference.
)
item(tt(!{)...tt(}))(
Insulate a history reference from adjacent characters (if necessary).
)
enditem()
texinode(Word Designators)(Modifiers)(Event Designators)(History Expansion)
subsect(Word Designators)
cindex(history word designators)
cindex(word designators, history)
A word designator indicates which word or words of a given command line will
be included in a history reference. A `tt(:)'
separates the event specification from the word designator.
It can be omitted if the word designator begins with a
`tt(^)', `tt($)', `tt(*)', `tt(-)' or `tt(%)'.
Word designators include:
startsitem()
sitem(tt(0))(The first input word (command).)
sitem(var(n))(The var(n)th argument.)
sitem(tt(^))(The first argument. That is, tt(1).)
sitem(tt($))(The last argument.)
sitem(tt(%))(The word matched by (the most recent) tt(?)var(str) search.)
sitem(var(x)tt(-)var(y))(A range of words; var(x) defaults to tt(0).)
sitem(tt(*))(All the arguments, or a null value if there are none.)
sitem(var(x)tt(*))(Abbreviates `var(x)tt(-$)'.)
sitem(var(x)tt(-))(Like `var(x)tt(*)' but omitting word tt($).)
endsitem()
Note that a `tt(%)' word designator will only work when used as
`tt(!%)', `tt(!:%)' or `tt(!?)var(str)tt(?:%)',
and only when used after a tt(!?) expansion. Anything else will result
in an error, although the error may not be the most obvious one.
texinode(Modifiers)()(Word Designators)(History Expansion)
subsect(Modifiers)
cindex(modifiers, history)
cindex(history modifiers)
After the optional word designator, you can add
a sequence of one or more of the following modifiers,
each preceded by a `tt(:)'. These modifiers also work on the result
of em(filename generation) and em(parameter expansion), except where
noted.
startitem()
item(tt(h))(
Remove a trailing pathname component, leaving the head.
)
item(tt(r))(
Remove a trailing suffix of the form `tt(.)var(xxx)', leaving the basename.
)
item(tt(e))(
Remove all but the suffix.
)
item(tt(t))(
Remove all leading pathname components, leaving the tail.
)
item(tt(p))(
Print the new command but do not execute it. Only works with history
expansion.
)
item(tt(q))(
Quote the substituted words, escaping further substitutions. Only
works with history expansion.
)
item(tt(x))(
Like tt(q), but break into words at each blank.
)
item(tt(l))(
Convert the words to all lowercase.
)
item(tt(u))(
Convert the words to all uppercase.
)
item(tt(f))(
(This and the following
tt(F), tt(w) and tt(W) modifier only work with parameter and
filename expansion.)
Repeats the immediately (without a colon) following modifier until the
resulting word doesn't change any more.
)
item(tt(F:)var(expr)tt(:))(
Like tt(f), but repeats only var(n) times if the expression
var(expr) evaluates to var(n). Any character can be used instead of
the `tt(:)', if any of `tt(LPAR())', `tt([)', or `tt({)'
is used as the opening delimiter
the second one has to be 'tt(RPAR())', `tt(])', or `tt(})' respectively.
)
item(tt(w))(
Makes the immediately following modifier work on each word in the
string.
)
item(tt(W:)var(sep)tt(:))(
Like tt(w) but words are considered to be the parts of the string
that are separated by var(sep). Any character can be used instead of
the `tt(:)'; opening parentheses are handled specially, see above.
)
item(tt(s/)var(l)tt(/)var(r)[tt(/)])(
Substitute var(r) for var(l) as described below.
Unless preceded immediately by a tt(g), with no colon between,
the substitution is done only for the
first string that matches var(l). For arrays and filename
expansion, this applies to each word of the expanded text.
)
item(tt(&))(
Repeat the previous tt(s) substitution. Like tt(s), may be preceded
immediately by a tt(g). In variable expansion the tt(&) must appear
inside braces, and in filename expansion it must be quoted with a
backslash.
)
enditem()
The tt(s/l/r/) substitution works as follows. The left-hand side of
substitutions are not regular expressions, but character strings. Any
character can be used as the delimiter in place of `tt(/)'. A
backslash quotes the delimiter character. The character `tt(&)', in
the right-hand-side var(r), is replaced by the text from the
left-hand-side var(l). The `tt(&)' can be quoted with a backslash. A
null var(l) uses the previous string either from the previous var(l)
or from the contextual scan string var(s) from `tt(!?)var(s)'. You can
omit the rightmost delimiter if a newline immediately follows var(r);
the rightmost `tt(?)' in a context scan can similarly be omitted.
Note the same record of the last var(l) and var(r) is maintained
across all forms of expansion.
By default, a history reference with no event specification refers to the same
line as the last history reference on that command line, unless it is the
first history reference in a command. In that case, a history reference
with no event specification always refers to the previous command. However,
if the option tt(CSH_JUNKIE_HISTORY) is set,
pindex(CSH_JUNKIE_HISTORY, use of)
then history reference with no
event specification will em(always) refer to the previous command.
For example, `tt(!!:1)'
will always refer to the first word of the previous command, and `tt(!!$)'
will always refer to the last word of the previous command. And with
tt(CSH_JUNKIE_HISTORY) set, then `tt(!:1)' and `tt(!$)'
will function in the same manner as `tt(!!:1)' and `tt(!!$)',
respectively. However, if tt(CSH_JUNKIE_HISTORY) is unset, then
`tt(!:1)' and `tt(!$)'
will refer to the first and last words respectively, of the last command
referenced on the current command line. However, if they are the first history
reference on the command line, then they refer to the previous command.
The character sequence `tt(^)var(foo)tt(^)var(bar)'
repeats the last command, replacing the string var(foo) with var(bar).
If the shell encounters the character sequence `tt(!")'
in the input, the history mechanism is temporarily disabled until
the current list is fully parsed. The `tt(!")'
is removed from the input, and any subsequent `tt(!)'
characters have no special significance.
A less convenient but more comprehensible
form of command history support
is provided by the tt(fc) builtin.
findex(fc, use of)
texinode(Process Substitution)(Parameter Expansion)(History Expansion)(Expansion)
sect(Process Substitution)
cindex(process substitution)
cindex(substitution, process)
Each command argument of the form
`tt(<LPAR())var(list)tt(RPAR())',
`tt(>LPAR())var(list)tt(RPAR())' or
`tt(=LPAR())var(list)tt(RPAR())'
is subject to process substitution.
In the case of the tt(<) or tt(>) forms, the shell will run process
var(list) asynchronously, connected to a named pipe (FIFO).
The name of this pipe will become the argument to the command.
If the form with tt(>)
is selected then writing on this file will provide input for var(list).
If tt(<) is used, then the file passed as an argument will
be a named pipe connected to the output of the var(list) process.
For example,
nofill(tt(paste <LPAR()cut -f1) var(file1)tt(RPAR() <LPAR()cut -f3) var(file2)tt(RPAR() | tee >LPAR())var(process1)tt(RPAR() >LPAR())var(process2)tt(RPAR() >/dev/null))
cuts fields 1 and 3 from the files var(file1) and var(file2) respectively,
pastes the results together, and sends it to the processes
var(process1) and var(process2).
Note that the file, which is passed as an argument to the command,
is a system pipe, so programs that expect to lseek (see manref(lseek)(2))
on the file will not work.
Also note that the previous example can be more compactly and
efficiently written as:
nofill(tt(paste <LPAR()cut -f1) var(file1)tt(RPAR() <LPAR()cut -f3) var(file2)tt(RPAR() > >LPAR())var(process1)tt(RPAR() > >LPAR())var(process2)tt(RPAR()))
The shell uses pipes instead of FIFOs to implement the latter
two process substitutions in the above example.
If tt(=) is used,
then the file passed as an argument will be the name
of a temporary file containing the output of the var(list)
process. This may be used instead of the tt(<)
form for a program that expects to lseek (see manref(lseek)(2))
on the input file.
texinode(Parameter Expansion)(Command Substitution)(Process Substitution)(Expansion)
sect(Parameter Expansion)
cindex(parameter expansion)
cindex(expansion, parameter)
The character `tt($)' is used to introduce parameter expansions.
See
ifzman(\
zmanref(zshparam)
)\
ifnzman(\
noderef(Parameters)
)\
for a description of parameters.
In the expansions discussed below that require a pattern, the form of
the pattern is the same as that used for filename generation;
see noderef(Filename Generation). In addition to the following
operations, the file modifiers described in
noderef(Modifiers) in noderef(History Expansion) can be
applied: for example, tt(${i:s/foo/bar/}) performs string
substitution on the value of parameter tt($i).
startitem()
item(tt(${)var(name)tt(}))(
The value, if any, of the parameter var(name) is substituted.
The braces are required if var(name) is followed by
a letter, digit, or underscore that is not to be interpreted
as part of its name.
If var(name) is an array parameter, then the values of each
element of var(name) is substituted, one element per word.
Otherwise, the expansion results in one word only; no field
splitting is done on the result unless the tt(SH_WORD_SPLIT)
option is set.
)
item(tt(${PLUS())var(name)tt(}))(
If var(name) is the name of a set parameter `tt(1)' is substituted,
otherwise `tt(0)' is substituted.
)
item(tt(${)var(name)tt(:-)var(word)tt(}))(
If var(name) is set and is non-null then substitute its
value; otherwise substitute var(word). If var(name) is
missing, substitute var(word).
)
item(tt(${)var(name)tt(:=)var(word)tt(}))(
If var(name) is unset or is null then
set it to var(word); the value of the parameter is then
substituted.
)
item(tt(${)var(name)tt(:?)var(word)tt(}))(
If var(name) is set and is non-null, then substitute
its value; otherwise, print var(word) and exit from the shell.
If var(word) is omitted, then a standard message is printed.
)
item(tt(${)var(name)tt(:PLUS())var(word)tt(}))(
If var(name) is set and is non-null then substitute
var(word); otherwise substitute nothing.
)
enditem()
If the colon is omitted from one of the above expressions
containing a colon, then the shell only checks whether
var(name) is set or not, not whether it is null.
startitem()
item(tt(${)var(name)tt(::=)var(word)tt(}))(
Set var(name) to var(word); the value of the parameter is then
substituted.
)
xitem(tt(${)var(name)tt(#)var(pattern)tt(}))
item(tt(${)var(name)tt(##)var(pattern)tt(}))(
If the var(pattern) matches the beginning of the value of
var(name), then substitute the value of var(name) with
the matched portion deleted; otherwise, just
substitute the value of var(name). In the first
form, the smallest matching pattern is preferred;
in the second form, the largest matching pattern is
preferred. If var(name) is an array and the substitution
is not quoted or the tt((@)) flag or the `var(name)tt([@])' syntax
is used, matching is performed on each array elements separately.
)
xitem(tt(${)var(name)tt(%)var(pattern)tt(}))
item(tt(${)var(name)tt(%%)var(pattern)tt(}))(
If the var(pattern) matches the end of the value of
var(name), then substitute the value of var(name) with
the matched portion deleted; otherwise, just
substitute the value of var(name). In the first
form, the smallest matching pattern is preferred;
in the second form, the largest matching pattern is
preferred. If var(name) is an array and the substitution
is not quoted or the tt((@)) flag or the `var(name)tt([@])' syntax
is used, matching is performed on each array elements separately.
)
item(tt(${)var(name)tt(:#)var(pattern)tt(}))(
If the var(pattern) matches the value of var(name), then substitute
the empty string; otherwise, just substitute the value of var(name).
If var(name) is an array and the substitution
is not quoted or the tt((@)) flag or the `var(name)tt([@])' syntax
is used, matching is performed on each array elements separately, and
the matched array elements are removed (use the tt((M)) flag to
remove the non-matched elements).
)
item(tt(${#)var(spec)tt(}))(
If var(spec) is one of the above substitutions, substitute
the length in characters of the result instead of
the result itself. If var(spec) is an array expression,
substitute the number of elements of the result.
)
item(tt(${^)var(spec)tt(}))(
pindex(RC_EXPAND_PARAM, use of)
cindex(array expansion style, rc)
cindex(rc, array expansion style)
Turn on the tt(RC_EXPAND_PARAM) option for the
evaluation of var(spec); if the `tt(^)' is doubled, turn it off.
When this option is set, array expansions of the form
`var(foo)tt(${)var(xx)tt(})var(bar)',
where the parameter var(xx)
is set to tt(LPAR())var(a b c)tt(RPAR()), are substituted with
`var(fooabar foobbar foocbar)' instead of the default
`var(fooa b cbar)'.
Internally, each such expansion is converted into the
equivalent list for brace expansion. E.g., tt(${^var}) becomes
tt({$var[1],$var[2],)...tt(}), and is processed as described in
noderef(Brace Expansion) above.
If word splitting is also in effect the
tt($var[)var(N)tt(]) may themselves be split into different list
elements.
)
item(tt(${=)var(spec)tt(}))(
pindex(SH_WORD_SPLIT, use of)
cindex(field splitting, sh style)
cindex(sh, field splitting style)
Turn on the tt(SH_WORD_SPLIT) option for the
evaluation of var(spec); if the `tt(=)' is doubled, turn it off.
vindex(IFS, use of)
When this option is set, parameter values are split into
separate words using tt(IFS) as a delimiter
before substitution.
This is done by default in most other shells.
)
item(tt(${~)var(spec)tt(}))(
pindex(GLOB_SUBST)
Turn on the tt(GLOB_SUBST) option for the evaluation of
var(spec); if the `tt(~)' is doubled, turn it off. When this option is
set, any pattern characters resulting
from the substitution become eligible for file expansion and filename
generation.
)
enditem()
If a tt(${)...tt(}) type parameter expression or a
tt($LPAR())...tt(RPAR()) type command substitution is used in place of
var(name) above, it is substituted first and the result is used as if
it were the value of var(name). Thus it is
possible to perform nested operations: tt(${${foo#head}%tail})
substitues the value of tt($foo) with both tt(head) and tt(tail)
deleted. The form with tt($LPAR())...tt(RPAR()) is often useful in
combination with the flags described next; see the example below.
subsect(Parameter Expansion Flags)
cindex(parameter expansion flags)
cindex(flags, parameter expansion)
cindex(expansion, parameter, flags)
If the opening brace is directly followed by an opening parenthesis,
the string up to the matching closing parenthesis will be taken as a
list of flags. Where arguments are valid, any character, or the
matching pairs `tt(LPAR())...tt(RPAR())', `tt({)...tt(})',
`tt([)...tt(])', or `tt(<)...tt(>)', may be used
in place of the colon as delimiters. The following flags are supported:
startitem()
item(tt(A))(
Create an array parameter with
tt(${)...tt(:=)...tt(}) or tt(${)...tt(::=)...tt(}).
Assignment is made before sorting or padding.
)
item(tt(@))(
In double quotes, array elements are put into separate words.
E.g., `tt("${(@)foo}")' is equivalent to `tt("${foo[@]}")' and
`tt("${(@)foo[1,2]}")' is the same as `tt("$foo[1]" "$foo[2]")'.
)
item(tt(e))(
Perform em(parameter expansion), em(command substitution) and
em(arithmetic expansion) on the result. Such expansions can be
nested but too deep recursion may have unpredictable effects.
)
item(tt(o))(
Sort the resulting words in ascending order.
)
item(tt(O))(
Sort the resulting words in descending order.
)
item(tt(i))(
With tt(o) or tt(O), sort case-independently.
)
item(tt(L))(
Convert all letters in the result to lower case.
)
item(tt(U))(
Convert all letters in the result to upper case.
)
item(tt(C))(
Capitalize the resulting words.
)
item(tt(c))(
With tt(${#)var(name)tt(}), count the total number of characters in an array,
as if the elements were concatenated with spaces between them.
)
item(tt(w))(
With tt(${#)var(name)tt(}), count words in arrays or strings; the tt(s)
flag may be used to set a word delimiter.
)
item(tt(W))(
Similar to tt(w) with the difference that empty words between
repeated delimiters are also counted.
)
item(tt(p))(
Recognize the same escape sequences as the tt(print) builtin
in string arguments to subsequent flags.
)
item(tt(l:)var(expr)tt(::)var(string1)tt(::)var(string2)tt(:))(
Pad the resulting words on the left. Each word will be truncated if
required and placed in a field var(expr) characters wide. The space
to the left will be filled with var(string1) (concatenated as often
as needed) or spaces if var(string1) is not given. If both
var(string1) and var(string2) are given, this string will be placed
exactly once directly to the left of the resulting word.
)
item(tt(r:)var(expr)tt(::)var(string1)tt(::)var(string2)tt(:))(
As tt(l), but pad the words on the right.
)
item(tt(j:)var(string)tt(:))(
Join the words of arrays together using var(string) as a separator.
pindex(SH_WORD_SPLIT, use of)
Note that this occurs before field splitting by the tt(SH_WORD_SPLIT)
option.
)
item(tt(F))(
Join the words of arrays together using newline as a separator.
This is a shorthand for `tt(pj:\n:)'.
)
item(tt(s:)var(string)tt(:))(
Force field splitting (see the option tt(SH_WORD_SPLIT)) at the
separator var(string). Splitting only occurs in places where an
array value is valid.
)
item(tt(f))(
Split the result of the expansion to lines. This is a shorthand
for `tt(ps:\n:)'.
)
item(tt(S))(
(This and all remaining flags are used with the tt(${)...tt(#)...tt(}) or
tt(${)...tt(%)...tt(}) forms.)
Search substrings as well as beginnings or ends.
)
item(tt(I:)var(expr)tt(:))(
Search the var(expr)th match (where var(expr) evaluates to a number).
)
item(tt(M))(
Include the matched portion in the result.
)
item(tt(R))(
Include the unmatched portion in the result (the em(R)est).
)
item(tt(B))(
Include the index of the beginning of the match in the result.
)
item(tt(E))(
Include the index of the end of the match in the result.
)
item(tt(N))(
Include the length of the match in the result.
)
enditem()
subsect(Example)
The flag tt(f) is useful to split a double-quoted substitution line by
line. For example, `tt("${(f)$LPAR()<)var(file)tt(RPAR()}")'
will substitue the contents of var(file) divided so that one line is
supplied per argument to var(cmd). Compare this with the effect of
`tt($)tt(LPAR()<)var(file)tt(RPAR())' alone, which divides the file
up by words, or the same inside double quotes, where the entire
contents of the file are passed as a single argument.
texinode(Command Substitution)(Arithmetic Expansion)(Parameter Expansion)(Expansion)
sect(Command Substitution)
cindex(command substitution)
cindex(substitution, command)
A command enclosed in parentheses
preceded by a dollar sign, like `tt($LPAR())...tt(RPAR())', or quoted with grave
accents, like `tt(`)...tt(`)', is replaced with its standard output, with any
trailing newlines deleted.
If the substitution is not enclosed in double quotes, the
output is broken into words using the tt(IFS) parameter.
vindex(IFS, use of)
The substitution `tt($LPAR()cat) var(foo)tt(RPAR())' may be replaced
by the equivalent but faster `tt($LPAR()<)var(foo)tt(RPAR())'.
In either case, if the option tt(GLOB_SUBST) is set,
the output is eligible for filename generation.
texinode(Arithmetic Expansion)(Brace Expansion)(Command Substitution)(Expansion)
sect(Arithmetic Expansion)
cindex(arithmetic expansion)
cindex(expansion, arithmetic)
A string of the form `tt($[)var(exp)tt(])' or
`tt($LPAR()LPAR())var(exp)tt(RPAR()RPAR())' is substituted
with the value of the arithmetic expression var(exp). var(exp) is
subjected to em(parameter expansion), em(command substitution)
and em(arithmetic expansion) before it is evaluated.
See noderef(Arithmetic Evaluation).
texinode(Brace Expansion)(Filename Expansion)(Arithmetic Expansion)(Expansion)
sect(Brace Expansion)
cindex(brace expansion)
cindex(expansion, brace)
A string of the form
`var(foo)tt({)var(xx)tt(,)var(yy)tt(,)var(zz)tt(})var(bar)'
is expanded to the individual words
`var(fooxxbar)', `var(fooyybar)' and `var(foozzbar)'.
Left-to-right order is preserved. This construct
may be nested. Commas may be quoted in order to
include them literally in a word.
An expression of the form `tt({)var(n1)tt(..)var(n2)tt(})',
where var(n1) and var(n2) are integers,
is expanded to every number between
var(n1) and var(n2) inclusive. If either number begins with a
zero, all the resulting numbers will be padded with leading zeroes to
that minimum width. If the numbers are in decreasing order the
resulting sequence will also be in decreasing order.
If a brace expression matches none of the above forms, it is left
unchanged, unless the tt(BRACE_CCL) option is set.
pindex(BRACE_CCL, use of)
In that case, it is expanded to a sorted list of the individual
characters between the braces, in the manner of a search set.
`tt(-)' is treated specially as in a search set, but `tt(^)' or `tt(!)' as
the first character is treated normally.
texinode(Filename Expansion)(Filename Generation)(Brace Expansion)(Expansion)
sect(Filename Expansion)
cindex(filename expansion)
cindex(expansion, filename)
Each word is checked to see if it begins with an unquoted `tt(~)'.
If it does, then the word up to a `tt(/)',
or the end of the word if there is no `tt(/)',
is checked to see if it can be substituted in one of the ways
described here. If so, then the `tt(~)' and the checked portion are
replaced with the appropriate substitute value.
A `tt(~)' by itself is replaced by the value of tt($HOME).
A `tt(~)' followed by a `tt(PLUS())' or a `tt(-)' is replaced by the value of
tt($PWD) or tt($OLDPWD), respectively.
A `tt(~)' followed by a number is replaced by the directory at that
position in the directory stack.
`tt(~0)' is equivalent to `tt(~PLUS())',
and `tt(~1)' is the top of the stack.
`tt(~PLUS())' followed by a number is replaced by the directory at that
position in the directory stack.
`tt(~PLUS()0)' is equivalent to `tt(~PLUS())',
and `tt(~PLUS()1)' is the top of the stack.
`tt(~-)' followed by a number is replaced by the directory that
many positions from the bottom of the stack.
`tt(~-0)' is the bottom of the stack.
pindex(PUSHD_MINUS, use of)
The tt(PUSHD_MINUS)
option exchanges the effects of `tt(~PLUS())' and `tt(~-)' where they are
followed by a number.
cindex(directories, named)
cindex(named directories)
A `tt(~)' followed by anything not already covered is looked up as a
named directory, and replaced by the value of that named directory if found.
Named directories are typically home directories for users on the system.
They may also be defined if the text after the `tt(~)' is the name
of a string shell parameter whose value begins with a `tt(/)'.
It is also possible to define directory names using the tt(-d) option to the
tt(hash) builtin.
In certain circumstances (in prompts, for instance), when the shell
prints a path, the path is checked to see if it has a named
directory as its prefix. If so, then the prefix portion
is replaced with a `tt(~)' followed by the name of the directory.
The shortest way of referring to the directory is used,
with ties broken in favour of using a named directory,
except when the directory is tt(/) itself.
If a word begins with an unquoted `tt(=)'
and the tt(EQUALS) option is set,
the remainder of the word is taken as the
name of a command or alias. If a command
exists by that name, the word is replaced
by the full pathname of the command.
If an alias exists by that name, the word
is replaced with the text of the alias.
Filename expansion is performed on the right hand side of a parameter
assignment, including those appearing after commands of the
tt(typeset) family. In this case, the right hand side will be treated
as a colon-separated list in the manner of the tt(PATH) parameter,
so that a `tt(~)' or an `tt(=)' following a `tt(:)' is eligible for expansion.
All such behaviour can be
disabled by quoting the `tt(~)', the `tt(=)', or the whole expression (but not
simply the colon); the tt(EQUALS) option is also respected.
If the option tt(MAGIC_EQUAL_SUBST) is set, any unquoted shell
argument in the form `var(identifier)tt(=)var(expression)' becomes eligible
for file expansion as described in the previous paragraph. Quoting the
first `tt(=)' also inhibits this.
texinode(Filename Generation)()(Filename Expansion)(Expansion)
sect(Filename Generation)
cindex(filename generation)
cindex(globbing)
If a word contains an unquoted instance of one of the characters
`tt(*)', `tt(LPAR())', `tt(|)', `tt(<)', `tt([)', or `tt(?)', it is regarded
as a pattern for filename generation, unless the tt(GLOB) option is unset.
pindex(GLOB, use of)
If the tt(EXTENDED_GLOB) option is set,
pindex(EXTENDED_GLOB, use of)
the `tt(^)' and `tt(#)' characters also denote a pattern; otherwise
they are not treated specially by the shell.
The word is replaced with a list of sorted filenames that match
the pattern. If no matching pattern is found, the shell gives
an error message, unless the tt(NULL_GLOB) option is set,
pindex(NULL_GLOB, use of)
in which case the word is deleted; or unless the tt(NOMATCH)
option is unset, in which case the word is left unchanged.
pindex(NOMATCH, use of)
In filename generation,
the character `tt(/)' must be matched explicitly;
also, a `tt(.)' must be matched
explicitly at the beginning of a pattern or after a `tt(/)', unless the
tt(GLOB_DOTS) option is set.
pindex(GLOB_DOTS, use of)
No filename generation pattern
matches the files `tt(.)' or `tt(..)'. In other instances of pattern
matching, the `tt(/)' and `tt(.)' are not treated specially.
subsect(Glob Operators)
startitem()
item(tt(*))(
Matches any string, including the null string.
)
item(tt(?))(
Matches any character.
)
item(tt([)...tt(]))(
Matches any of the enclosed characters. Ranges of characters
can be specified by separating two characters by a `tt(-)'.
A `tt(-)' or `tt(])' may be matched by including it as the
first character in the list.
There are also several named classes of characters, in the form
`tt([:)var(name)(tt:])' with the following meanings: `tt([:alnum:])'
alphanumeric, `tt([:alpha:])' alphabetic,
`tt([:blank:])' space or tab,
`tt([:cntrl:])' control character, `tt([:digit:])' decimal
digit, `tt([:graph:])' printable character except whitespace,
`tt([:lower:])' lowercase letter, `tt([:print:])' printable character,
`tt([:punct:])' printable character neither alphanumeric nor whitespace,
`tt([:space:])' whitespace character, `tt([:upper:])' uppercase letter,
`tt([:xdigit:])' hexadecimal digit. These use the macros provided by
the operating system to test for the given character combinations,
including any modifications due to local language settings: see
manref(ctype)(3). Note that the square brackets are additional
to those enclosing the whole set of characters, so to test for a
single alphanumeric character you need `tt([[:alnum:]])'. Named
character sets can be used alongside other types,
e.g. `tt([[:alpha:]0-9])'.
)
xitem(tt([^)...tt(]))
item(tt([!)...tt(]))(
Like tt([)...tt(]), except that it matches any character which is
not in the given set.
)
item(tt(<)[var(x)]tt(-)[var(y)]tt(>))(
Matches any number in the range var(x) to var(y), inclusive.
Either of the numbers may be omitted to make the range open-ended;
hence `tt(<->)' matches any number.
)
item(tt(LPAR())...tt(RPAR()))(
Matches the enclosed pattern. This is used for grouping.
If the tt(KSH_GLOB) option is set, then a
`tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)' immediately preceding
the `tt(LPAR())' is treated specially, as detailed below.
)
item(var(x)tt(|)var(y))(
Matches either var(x) or var(y).
This operator has lower precedence than any other.
The `tt(|)' character
must be within parentheses, to avoid interpretation as a pipeline.
)
item(tt(^)var(x))(
(Requires tt(EXTENDED_GLOB) to be set.)
Matches anything except the pattern var(x).
This has a higher precedence than `tt(/)', so `tt(^foo/bar)'
will search directories in `tt(.)' except `tt(./foo)'
for a file named `tt(bar)'.
)
item(var(x)tt(~)var(y))(
(Requires tt(EXTENDED_GLOB) to be set.)
Match anything that matches the pattern var(x) but does not match var(y).
This has lower precedence than any operator except `tt(|)', so
`tt(*/*~foo/bar)' will search for all files in all directories in `tt(.)'
and then exclude `tt(foo/bar)' if there was such a match.
It groups left-to-right, so multiple patterns can be excluded by
`var(foo)tt(~)var(bar)tt(~)var(baz)'.
In the exclusion pattern (var(y)), `tt(/)' and `tt(.)' are not treated
specially the way they usually are in globbing.
)
item(var(x)tt(#))(
(Requires tt(EXTENDED_GLOB) to be set.)
Matches zero or more occurrences of the pattern var(x).
This operator has high precedence; `tt(12#)' is equivalent to `tt(1(2#))',
rather than `tt((12)#)'.
)
item(var(x)tt(##))(
(Requires tt(EXTENDED_GLOB) to be set.)
Matches one or more occurrences of the pattern var(x).
This operator has high precedence; `tt(12##)' is equivalent to `tt(1(2##))',
rather than `tt((12)##)'.
)
enditem()
subsect(ksh-like Glob Operators)
pindex(KSH_GLOB, use of)
If the tt(KSH_GLOB) option is set, the effects of parentheses can be
modified by a preceding `tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)'.
This character need not be unquoted to have special effects,
but the `tt(LPAR())' must be.
startitem()
item(tt(@LPAR())...tt(RPAR()))(
Match the pattern in the parentheses. (Like `tt(LPAR())...tt(RPAR())'.)
)
item(tt(*LPAR())...tt(RPAR()))(
Match any number of occurrences. (Like `tt(LPAR())...tt(RPAR()#)'.)
)
item(tt(PLUS()LPAR())...tt(RPAR()))(
Match at least one occurrence. (Like `tt(LPAR())...tt(RPAR()##)'.)
)
item(tt(?LPAR())...tt(RPAR()))(
Match zero or one occurrence. (Like `tt(LPAR()|)...tt(RPAR())'.)
)
item(tt(!LPAR())...tt(RPAR()))(
Match anything but the expression in parentheses.
(Like `tt(LPAR()^LPAR())...tt(RPAR()RPAR())'.)
)
enditem()
subsect(Recursive Globbing)
A pathname component of the form `tt(LPAR())var(foo)tt(/RPAR()#)'
matches a path consisting of zero or more directories
matching the pattern var(foo).
As a shorthand, `tt(**/)' is equivalent to `tt((*/)#)'.
Thus:
nofill(tt(ls (*/)#bar))
or
nofill(tt(ls **/bar))
does a recursive directory search for files named `tt(bar)', not following
symbolic links. To follow links, use `tt(***/)'.
subsect(Glob Qualifiers)
cindex(globbing, qualifiers)
cindex(qualifiers, globbing)
Patterns used for filename generation may end in a
list of qualifiers enclosed in parentheses.
The qualifiers specify which filenames that otherwise match the given pattern
will be inserted in the argument list.
pindex(BARE_GLOB_QUAL, use of)
If the option tt(BARE_GLOB_QUAL) is set, then a trailing set of parentheses
containing no `tt(|)' or `tt(LPAR())' characters (or `tt(~)' if it is special)
is taken as a set of
glob qualifiers. A glob subexpression that would normally be taken as glob
qualifiers, for example `tt((^x))', can be forced to be treated as part of
the glob pattern by doubling the parentheses, for example `tt(((^x)))'.
A qualifier may be any one of the following:
startitem()
item(tt(/))(
directories
)
item(tt(.))(
plain files
)
item(tt(@))(
symbolic links
)
item(tt(=))(
sockets
)
item(tt(p))(
named pipes (FIFOs)
)
item(tt(*))(
executable plain files (0100)
)
item(tt(%))(
device files (character or block special)
)
item(tt(%b))(
block special files
)
item(tt(%c))(
character special files
)
item(tt(r))(
owner-readable files (0400)
)
item(tt(w))(
owner-writable files (0200)
)
item(tt(x))(
owner-executable files (0100)
)
item(tt(A))(
group-readable files (0040)
)
item(tt(I))(
group-writable files (0020)
)
item(tt(E))(
group-executable files (0010)
)
item(tt(R))(
world-readable files (0004)
)
item(tt(W))(
world-writable files (0002)
)
item(tt(X))(
world-executable files (0001)
)
item(tt(s))(
setuid files (04000)
)
item(tt(S))(
setgid files (02000)
)
item(tt(t))(
files with the sticky bit (01000)
)
item(tt(d)var(dev))(
files on the device var(dev)
)
item(tt(l)[tt(-)|tt(PLUS())]var(ct))(
files having a link count less than var(ct) (tt(-)), greater than
var(ct) (tt(PLUS())), or is equal to var(ct)
)
item(tt(U))(
files owned by the effective user ID
)
item(tt(G))(
files owned by the effective group ID
)
item(tt(u)var(id))(
files owned by user ID var(id) if it is a number, if not, than the
character after the `tt(u)' will be used as a separator and the string
between it and the next matching separator
(`tt(LPAR())', `tt([)', `tt({)', and `tt(<)'
match `tt(RPAR())', `tt(])', `tt(})', and `tt(>)' respectively,
any other character matches
itself) will be taken as a user name, and the user ID of this user will
be taken (e.g. `tt(u:foo:)' or `tt(u[foo])' for user `tt(foo)')
)
item(tt(g)var(id))(
like tt(u)var(id) but with group IDs or names
)
item(tt(a)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))(
files accessed exactly var(n) days ago. Files accessed within the
last var(n) days are selected using a negative value for var(n)
(tt(-)var(n)). Files accessed more than var(n) days ago are selected by a
positive var(n) value (tt(PLUS())var(n)). Optional unit specifiers `tt(M)',
`tt(w)', `tt(h)' or `tt(m)' (e.g. `tt(ah5)') cause the check to be
performed with months (of 30 days), weeks, hours, or minutes instead of
days, respectively. For instance, `tt(echo *(ah-5))' would echo files
accessed within the last five hours.
)
item(tt(m)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))(
like the file access qualifier, except that it uses the file modification
time.
)
item(tt(c)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))(
like the file access qualifier, except that it uses the file inode change
time.
)
item(tt(L)[tt(PLUS())|tt(-)]var(n))(
files less than var(n) bytes (tt(-)), more than var(n) bytes (tt(PLUS())), or
exactly var(n) bytes in length. If this flag is directly followed by a `tt(k)'
(`tt(K)'), `tt(m)' (`tt(M)'), or `tt(p)' (`tt(P)') (e.g. `tt(Lk-50)')
the check is performed with kilobytes, megabytes, or blocks (of 512 bytes)
instead.
)
item(tt(^))(
negates all qualifiers following it
)
item(tt(-))(
toggles between making the qualifiers work on symbolic links (the
default) and the files they point to
)
item(tt(M))(
sets the tt(MARK_DIRS) option for the current pattern
pindex(MARK_DIRS, setting in pattern)
)
item(tt(T))(
appends a trailing qualifier mark to the file names, analogous to the
tt(LIST_TYPES) option, for the current pattern (overrides tt(M))
)
item(tt(N))(
sets the tt(NULL_GLOB) option for the current pattern
pindex(NULL_GLOB, setting in pattern)
)
item(tt(D))(
sets the tt(GLOB_DOTS) option for the current pattern
pindex(GLOB_DOTS, setting in pattern)
)
enditem()
More than one of these lists can be combined, separated by commas. The
whole list matches if at least one of the sublists matches (they are
`or'ed, the qualifiers in the sublists are `and'ed).
If a `tt(:)' appears in a qualifier list, the remainder of the expression in
parenthesis is interpreted as a modifier (see noderef(Modifiers)
in noderef(History Expansion)). Note that
each modifier must be introduced by a separate `tt(:)'. Note also that the
result after modification does not have to be an existing file. The
name of any existing file can be followed by a modifier of the form
`tt((:..))' even if no actual filename generation is performed.
Thus:
nofill(tt(ls *(-/)))
lists all directories and symbolic links that point to directories,
and
nofill(tt(ls *(%W)))
lists all world-writable device files in the current directory, and
nofill(tt(ls *(W,X)))
lists all files in the current directory that are
world-writable or world-executable, and
nofill(tt(echo /tmp/foo*(u0^@:t)))
outputs the basename of all root-owned files beginning with the string
`tt(foo)' in tt(/tmp), ignoring symlinks, and
nofill(tt(ls *.*~(lex|parse).[ch](^D^l1)))
lists all files having a link count of one whose names contain a dot
(but not those starting with a dot, since tt(GLOB_DOTS) is explicitly
switched off) except for tt(lex.c), tt(lex.h), tt(parse.c) and tt(parse.h).

15
Doc/Zsh/filelist.yo Normal file
View File

@ -0,0 +1,15 @@
sect(Files)
cindex(files used)
startlist()
list(tt($ZDOTDIR/.zshenv))
list(tt($ZDOTDIR/.zprofile))
list(tt($ZDOTDIR/.zshrc))
list(tt($ZDOTDIR/.zlogin))
list(tt($ZDOTDIR/.zlogout))
list(tt(${TMPPREFIX}*) (default is /tmp/zsh*))
list(tt(/etc/zshenv))
list(tt(/etc/zprofile))
list(tt(/etc/zshrc))
list(tt(/etc/zlogin))
list(tt(/etc/zlogout) (installation-specific - tt(/etc) is the default))
endlist()

26
Doc/Zsh/files.yo Normal file
View File

@ -0,0 +1,26 @@
texinode(Files)(Shell Grammar)(Invocation)(Top)
chapter(Files)
sect(Startup/Shutdown Files)
cindex(files, startup)
cindex(startup files)
cindex(files, shutdown)
cindex(shutdown files)
pindex(NO_RCS, use of)
Commands are first read from tt(/etc/zshenv).
If the tt(RCS) option is unset
within tt(/etc/zshenv), all other
initialization files are skipped.
Otherwise, commands are read
from tt($ZDOTDIR/.zshenv).
pindex(LOGIN, use of)
If the shell is a login shell, commands
are read from tt(/etc/zprofile) and then tt($ZDOTDIR/.zprofile).
Then, if the shell is interactive,
commands are read from tt(/etc/zshrc) and then tt($ZDOTDIR/.zshrc).
Finally, if the shell is a login shell, tt(/etc/zlogin) and
tt($ZDOTDIR/.zlogin) are read.
If tt(ZDOTDIR) is unset, tt(HOME) is used instead.
Those files listed above as being in tt(/etc) may be in another
directory, depending on the installation.
ifnzman(includefile(Zsh/filelist.yo))

107
Doc/Zsh/func.yo Normal file
View File

@ -0,0 +1,107 @@
texinode(Functions)(Jobs & Signals)(Command Execution)(Top)
chapter(Functions)
ifzman(\
sect(Functions)
)\
cindex(functions)
findex(function)
The tt(function) reserved word is used to define shell functions.
Shell functions are read in and stored internally.
Alias names are resolved when the function is read.
Functions are executed like commands with the arguments
passed as positional parameters.
(See noderef(Command Execution).)
Functions execute in the same process as the caller and
share all files
and present working directory with the
caller. A trap on tt(EXIT) set inside a function
is executed after the function completes in the environment
of the caller.
findex(return, use of)
The tt(return) builtin is used to return from function calls.
findex(functions, use of)
Function identifiers can be listed with the tt(functions) builtin.
findex(unfunction, use of)
Functions can be undefined with the tt(unfunction) builtin.
sect(Autoloading Functions)
findex(autoload, use of)
cindex(autoloading functions)
cindex(functions, autoloading)
A function can be marked as em(undefined) using the tt(autoload) builtin
(or `tt(functions -u)' or `tt(typeset -fu)'). Such a function has no
body. When the function is first executed, the tt(fpath)
variable will be searched for a file with the same name as the
function.
pindex(KSH_AUTOLOAD, use of)
If the tt(KSH_AUTOLOAD) option is set, or the file contains only a simple
definition of the function, the file's contents will be
executed. It would normally define the function in question, but may
also perform initialisation.
It is executed in the context of the function
execution, and may therefore define local parameters.
Otherwise, the function is defined such that its body is the
complete contents of the file. This form allows the file to be
used directly as an executable shell script.
Initialisation code can be executed, but only as part of the first
function execution, so the function would have to redefine itself to
avoid reinitialising on the next execution.
If this processing of the file results in the function being
fully defined, the function itself is then executed.
sect(Special Functions)
The following functions, if defined, have special meaning to
the shell:
startitem()
findex(chpwd)
item(tt(chpwd))(
Executed whenever the current working directory is changed.
)
findex(periodic)
item(tt(periodic))(
vindex(PERIOD)
If the parameter tt(PERIOD)
is set, this function is executed every tt($PERIOD)
seconds, just before a prompt.
)
findex(precmd)
item(tt(precmd))(
Executed before each prompt.
)
findex(preexec)
item(tt(preexec))(
Executed just after a command has been read and is about to be
executed. If the history mechanism is active, the string to be
executed is passed as an argument.
)
item(tt(TRAP)var(NAL))(
cindex(signals, trapping)
cindex(trapping signals)
If defined and non-null,
this function will be executed whenever the shell
catches a signal tt(SIG)var(NAL), where var(NAL) is a signal
name as specified for the tt(kill) builtin.
The signal number will be passed as the first parameter to the function.
If a function of this form is defined and null,
the shell and processes spawned by it will ignore tt(SIG)var(NAL).
)
findex(TRAPDEBUG)
item(tt(TRAPDEBUG))(
Executed after each command.
)
findex(TRAPEXIT)
item(tt(TRAPEXIT))(
Executed when the shell exits,
or when the current function exits if defined inside a function.
)
findex(TRAPZERR)
item(tt(TRAPZERR))(
Executed whenever a command has a non-zero exit status.
)
enditem()

335
Doc/Zsh/grammar.yo Normal file
View File

@ -0,0 +1,335 @@
texinode(Shell Grammar)(Redirection)(Files)(Top)
chapter(Shell Grammar)
cindex(shell grammar)
cindex(grammar, shell)
startmenu()
menu(Simple Commands & Pipelines)
menu(Precommand Modifiers)
menu(Complex Commands)
menu(Alternate Forms For Complex Commands)
menu(Reserved Words)
menu(Comments)
menu(Aliasing)
menu(Quoting)
endmenu()
texinode(Simple Commands & Pipelines)(Precommand Modifiers)()(Shell Grammar)
sect(Simple Commands & Pipelines)
cindex(simple commands)
cindex(commands, simple)
A em(simple command) is a sequence of optional parameter
assignments followed by blank-separated words,
with optional redirections interspersed.
The first word is the command to be executed, and the remaining
words, if any, are arguments to the command.
If a command name is given, the parameter assignments modify
the environment of the command when it is executed.
The value of a simple command is its exit status,
or 128 plus the signal number if terminated by a signal.
cindex(pipeline)
A em(pipeline) is either a simple command, or a sequence of two or more
simple commands where each command is separated from the next by `tt(|)'
or `tt(|&)'. Where commands are separated by `tt(|)', the standard
output of the first command is connected to the
standard input of the next. `tt(|&)' is shorthand for `tt(2>&1 |)', which
connects both the standard output and the standard error of the
command to the standard input of the next. The value of a pipeline
is the value of the last command, unless the pipeline is preceded by
`tt(!)' in which case the value is the logical inverse of the value of the
last command.
findex(coproc)
cindex(coprocess)
If a pipeline is preceded by `tt(coproc)', it is executed as a coprocess;
a two-way pipe is established between it and the parent shell. The
shell can read from or write to the coprocess by means of the `tt(>&p)'
and `tt(<&p)' redirection operators or with `tt(print -p)' and `tt(read -p)'.
A pipeline cannot be preceded by both `tt(coproc)' and `tt(!)'.
cindex(sublist)
A em(sublist) is either a single pipeline, or a sequence of two or more
pipelines separated by `tt(&&)' or `tt(||)'. If two pipelines are separated
by `tt(&&)', the second pipeline is executed only if the first succeeds
(returns a zero value). If two pipelines are separated by `tt(||)', the
second is executed only if the first fails (returns a nonzero value).
Both operators have equal precedence and are left associative.
The value of the sublist is the value of the last pipeline executed.
cindex(list)
A em(list) is a sequence of zero or more sublists, in which each sublist
is terminated by `tt(;)', `tt(&)', `tt(&|)', `tt(&!)', or a newline.
This terminator
may optionally be omitted from the last sublist in the list when the
list appears as a complex command inside `tt(LPAR())...tt(RPAR())'
or `tt({)...tt(})'. When a
sublist is terminated by `tt(;)' or newline, the shell waits for it to
finish before executing the next sublist. If a sublist is terminated
by a `tt(&)', `tt(&|)', or `tt(&!)',
the shell executes it in the background, and
does not wait for it to finish.
A backgrounded sublist returns a status of zero.
texinode(Precommand Modifiers)(Complex Commands)(Simple Commands & Pipelines)(Shell Grammar)
sect(Precommand Modifiers)
cindex(precommand modifiers)
cindex(modifiers, precommand)
A simple command may be preceded by a em(precommand modifier),
which will alter how the command is interpreted. These modifiers are
shell builtin commands with the exception of tt(nocorrect) which is
a reserved word.
startitem()
item(tt(-))(
The command is executed with a `tt(-)' prepended to its
tt(argv[0]) string.
)
item(tt(noglob))(
Filename generation (globbing) is not performed on any of
the words.
)
item(tt(nocorrect))(
Spelling correction is not done on any of the words.
)
item(tt(exec))(
The command is executed in the parent shell without forking.
)
item(tt(command))(
The command word is taken to be the name of an external command,
rather than a shell function or builtin.
)
item(tt(builtin))(
The command word is taken to be the name of a builtin command,
rather than a shell function or external command.
)
enditem()
texinode(Complex Commands)(Alternate Forms For Complex Commands)(Precommand Modifiers)(Shell Grammar)
sect(Complex Commands)
cindex(complex commands)
cindex(commands, complex)
A em(complex command) in zsh is one of the following:
startitem()
findex(if)
cindex(if construct)
item(tt(if) var(list) tt(then) var(list) [ tt(elif) var(list) tt(then) var(list) ] ... [ tt(else) var(list) ] tt(fi))(
The tt(if) var(list) is executed, and if it returns a zero exit status,
the tt(then) var(list) is executed.
Otherwise, the tt(elif) var(list) is executed and if its value is zero,
the tt(then) var(list) is executed.
If each tt(elif) var(list) returns nonzero, the tt(else) var(list) is executed.
)
findex(for)
cindex(for loops)
cindex(loops, for)
item(tt(for) var(name) [ tt(in) var(word) ... var(term) ] tt(do) var(list) tt(done))(
where var(term) is at least one newline or tt(;).
Expand the list of var(word)s, and set the parameter
var(name) to each of them in turn, executing
var(list) each time. If the tt(in) var(word) is omitted,
use the positional parameters instead of the var(word)s.
)
item(tt(for LPAR()LPAR()) [var(expr1)] tt(;) [var(expr2)] tt(;) [var(expr3)] tt(RPAR()RPAR() do) var(list) tt(done))(
The arithmetic expression var(expr1) is evaluated first (see
noderef(Arithmetic Evaluation)). The arithmetic expression
var(expr2) is repeatedly evaluated until it evaluates to zero and
when non-zero, var(list) is executed and the arithmetic expression
var(expr3) evaluated. If any expression is omitted, then it behaves
as if it evaluated to 1.
)
findex(while)
cindex(while loops)
cindex(loops, while)
item(tt(while) var(list) tt(do) var(list) tt(done))(
Execute the tt(do) var(list) as long as the tt(while) var(list)
returns a zero exit status.
)
findex(until)
cindex(until loops)
cindex(loops, until)
item(tt(until) var(list) tt(do) var(list) tt(done))(
Execute the tt(do) var(list) as long as tt(until) var(list)
returns a nonzero exit status.
)
findex(repeat)
cindex(repeat loops)
cindex(loops, repeat)
item(tt(repeat) var(word) tt(do) var(list) tt(done))(
var(word) is expanded and treated as an arithmetic expression,
which must evaluate to a number var(n).
var(list) is then executed var(n) times.
)
findex(case)
cindex(case selection)
cindex(selection, case)
item(tt(case) var(word) tt(in) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)) ] ... tt(esac))(
Execute the var(list) associated with the first var(pattern)
that matches var(word), if any. The form of the patterns
is the same as that used for filename generation. See
noderef(Filename Generation).
If the var(list) that is executed is terminated with tt(;&) rather than
tt(;;), the following list is also executed. This continues until either
a list is terminated with tt(;;) or the tt(esac) is reached.
)
findex(select)
cindex(user selection)
cindex(selection, user)
item(tt(select) var(name) [ tt(in) var(word) ... var(term) ] tt(do) var(list) tt(done))(
where var(term) is one ore more newline or tt(;).
Print the set of var(word)s, each preceded by a number.
If the tt(in) var(word) is omitted, use the positional parameters.
The tt(PROMPT3) prompt is printed and a line is read from standard
input. If this line consists of the number of one of the listed
var(word)s, then the parameter var(name)
is set to the var(word) corresponding to this number.
If this line is empty, the selection list is printed again.
Otherwise, the value of the parameter var(name) is set to null.
The contents of the line read from standard input is saved
in the parameter tt(REPLY). var(list) is executed
for each selection until a break or end-of-file is encountered.
)
cindex(subshells)
item(tt(LPAR()) var(list) tt(RPAR()))(
Execute var(list) in a subshell. Traps set by the tt(trap) builtin
are reset to their default values while executing var(list).
)
item(tt({) var(list) tt(}))(
Execute var(list).
)
xitem(tt(function) var(word) ... [ tt(()) ] [ var(term) ] tt({) var(list) tt(}))
xitem(var(word) ... tt(()) [ var(term) ] tt({) var(list) tt(}))
item(var(word) ... tt(()) [ var(term) ] var(command))(
where var(term) is one or more newline or tt(;).
Define a function which is referenced by any one of var(word).
Normally, only one var(word) is provided; multiple var(word)s
are usually only useful for setting traps.
The body of the function is the var(list) between
the tt({) and tt(}). See noderef(Functions).
)
cindex(timing)
item(tt(time) [ var(pipeline) ])(
The var(pipeline) is executed, and timing statistics are
reported on the standard error in the form specified
by the tt(TIMEFMT) parameter.
If var(pipeline) is omitted, print statistics about the
shell process and its children.
)
cindex(testing conditional expression)
item(tt([[) var(exp) tt(]]))(
Evaluates the conditional expression var(exp)
and return a zero exit status if it is true.
See noderef(Conditional Expressions)
for a description of var(exp).
)
enditem()
texinode(Alternate Forms For Complex Commands)(Reserved Words)(Complex Commands)(Shell Grammar)
sect(Alternate Forms For Complex Commands)
cindex(alternate forms for complex commands)
cindex(commands, alternate forms for complex)
Many of zsh's complex commands have alternate forms. These particular
versions of complex commands should be considered deprecated and may be
removed in the future. The versions in the previous section should be
preferred instead. The short versions below only work if var(sublist)
is of the form `tt({) var(list) tt(})' or if the tt(SHORT_LOOPS)
option is set.
startitem()
item(tt(if) var(list) tt({) var(list) tt(}) [ tt(elif) var(list) tt({) var(list) tt(}) ] ... [ tt(else {) var(list) tt(}) ])(
An alternate form of tt(if).
)
item(tt(if) var(list) var(sublist))(
A short form of the alternate `if'.
)
item(tt(for) var(name) tt(LPAR()) var(word) ... tt(RPAR()) var(sublist))(
A short form of tt(for).
)
item(tt(for) var(name) [ tt(in) var(word) ... var(term) ] var(sublist))(
where var(term) is at least one newline or tt(;).
Another short form of tt(for).
)
item(tt(for LPAR()LPAR()) [var(expr1)] tt(;) [var(expr2)] tt(;) [var(expr3)] tt(RPAR()RPAR()) var(sublist))(
A short form of the arithmetic tt(for) command.
)
item(tt(foreach) var(name) tt(LPAR()) var(word) ... tt(RPAR()) var(list) tt(end))(
Another form of tt(for).
)
item(tt(while) var(list) tt({) var(list) tt(}))(
An alternative form of tt(while).
)
item(tt(until) var(list) tt({) var(list) tt(}))(
An alternative form of tt(until).
)
item(tt(repeat) var(word) var(sublist))(
This is a short form of tt(repeat).
)
item(tt(case) var(word) tt({) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)) ] ... tt(}))(
An alternative form of tt(case).
)
item(tt(select) var(name) [ tt(in) var(word) var(term) ] var(sublist))(
where var(term) is at least one newline or tt(;).
A short form of tt(select).
)
enditem()
texinode(Reserved Words)(Comments)(Alternate Forms For Complex Commands)(Shell Grammar)
sect(Reserved Words)
cindex(reserved words)
findex(disable, use of)
The following words are recognized as reserved words when used as the first
word of a command unless quoted or disabled using tt(disable -r):
tt(do done esac then elif else fi for case
if while function repeat time until
select coproc nocorrect foreach end ! [[ { })
Additionally, `tt(})' is recognized in any position if the tt(IGNORE_BRACES) option
is not set.
texinode(Comments)(Aliasing)(Reserved Words)(Shell Grammar)
sect(Comments)
cindex(comments)
pindex(INTERACTIVE_COMMENTS, use of)
vindex(histchars, use of)
In noninteractive shells, or in interactive shells with the
tt(INTERACTIVE_COMMENTS) option set, a word beginning
with the third character of the tt(histchars) parameter
(`tt(#)' by default) causes that word and all the following
characters up to a newline to be ignored.
texinode(Aliasing)(Quoting)(Comments)(Shell Grammar)
sect(Aliasing)
cindex(aliasing)
Every token in the shell input is checked to see if there
is an alias defined for it.
If so, it is replaced by the text of the alias if it is in command
position (if it could be the first word of a simple command),
or if the alias is global.
If the text ends with a space, the next word in the shell input
is treated as though it were in command position for purposes of alias
expansion.
findex(alias, use of)
cindex(aliases, global)
An alias is defined using the tt(alias) builtin; global aliases
may be defined using the tt(-g) option to that builtin.
Alias substitution is done on the shell input before any
other substitution except history substitution. Therefore,
if an alias is defined for the word tt(foo), alias substitution
may be avoided by quoting part of the word, e.g. tt(\foo).
But there is nothing to prevent an alias being defined
for tt(\foo) as well.
texinode(Quoting)()(Aliasing)(Shell Grammar)
sect(Quoting)
cindex(quoting)
A character may be var(quoted) (that is, made
to stand for itself) by preceding it with a `tt(\)'.
`tt(\)' followed by a newline is ignored.
A string enclosed between `tt($')' and `tt(')' is
processed the same way as the string arguments of the
tt(print) builtin, and the resulting string is considered to be
entirely quoted. A literal `tt(')' character can be included in the
string by using the `tt(\')' escape.
All characters enclosed between a pair of single quotes (tt('')) that
is not preceded by a `tt($)' are quoted. A single quote cannot appear
within single quotes.
Inside double quotes (tt("")), parameter and
command substitution occurs, and `tt(\)' quotes the characters
`tt(\)', `tt(`)', `tt(")', and `tt($)'.

149
Doc/Zsh/guide.yo Normal file
View File

@ -0,0 +1,149 @@
texiifinfo(\
texinode(Top)(The Z Shell Guide)((dir))((dir))
texitop(The Z Shell Guide)
This Info file documents Zsh, a freely available UNIX command interpreter
(shell), which of the standard shells most closely resembles the Korn shell
(ksh), although it is not completely compatible.
Version version(), last updated date().
)\
startmenu()
menu(The Z Shell Guide)
menu(Introduction)
menu(Invocation)
menu(Files)
menu(Shell Grammar)
menu(Redirection)
menu(Command Execution)
menu(Functions)
menu(Jobs & Signals)
menu(Arithmetic Evaluation)
menu(Conditional Expressions)
menu(Compatibility)
menu(Prompt Expansion)
menu(Restricted Shell)
menu(Expansion)
menu(Parameters)
menu(Options)
menu(Shell Builtin Commands)
menu(Zsh Line Editor)
menu(Programmable Completion)
menu(Zsh Modules)
--- Indices ---
menu(Concept Index)
menu(Variables Index)
menu(Options Index)
menu(Functions Index)
menu(Editor Functions Index)
menu(Keystroke Index)
--- The Detailed Node Listing ---
Introduction
menu(Author)
menu(Availability)
menu(Mailing Lists)
menu(The Zsh FAQ)
menu(The Zsh Web Page)
menu(See Also)
Shell Grammar
menu(Simple Commands & Pipelines)
menu(Precommand Modifiers)
menu(Complex Commands)
menu(Alternate Forms For Complex Commands)
menu(Reserved Words)
menu(Comments)
menu(Aliasing)
menu(Quoting)
Expansion
menu(History Expansion)
menu(Process Substitution)
menu(Parameter Expansion)
menu(Command Substitution)
menu(Arithmetic Expansion)
menu(Brace Expansion)
menu(Filename Expansion)
menu(Filename Generation)
Parameters
menu(Local Parameters)
menu(Array Parameters)
menu(Positional Parameters)
menu(Parameters Set By The Shell)
menu(Parameters Used By The Shell)
Options
menu(Description of Options)
menu(Single Letter Options)
Zsh Line Editor
menu(Movement)
menu(History Control)
menu(Modifying Text)
menu(Arguments)
menu(Completion)
menu(Miscellaneous)
Programmable Completion
menu(Command Flags)
menu(Option Flags)
menu(Alternative Completion)
menu(Extended Completion)
menu(Example)
Zsh Modules
menu(The cap Module)
menu(The clone Module)
menu(The comp1 Module)
menu(The compctl Module)
menu(The deltochar Module)
menu(The example Module)
menu(The files Module)
menu(The sched Module)
menu(The stat Module)
menu(The zle Module)
endmenu()
texinode(The Z Shell Guide)(Introduction)(Top)(Top)
chapter(The Z Shell Guide)
This document has been produced from the texinfo file tt(zsh.texi),
included in the tt(Doc) sub-directory of the Zsh distribution.
sect(Producing documentation from zsh.texi)
The texinfo source may be converted into several formats:
startitem()
item(The Info guide)(
The Info format allows searching for topics, commands, functions, etc.
from the many Indices. The command `tt(makeinfo zsh.texi)' is used to
produce the Info documentation.
)
item(The printed guide)(
The command `tt(texi2dvi zsh.texi)' will output tt(zsh.dvi) which can
then be processed with bf(dvips) and optionally bf(gs) (Ghostscript) to
produce a nicely formatted printed guide.
)
item(The HTML guide)(
Mark Borges, tt(<mdb@cdc.noaa.gov), maintains an HTML version of this
guide at tt(http://www.peak.org/zsh/Doc/zsh_toc.html).
(The HTML version is produced with bf(texi2html), which may be obtained
from tt(http://wwwcn.cern.ch/dci/texi2html/). The command is
`tt(texi2html -split_chapter -expandinfo zsh.texi)'.)
)
enditem()
For those who do not have the necessary tools to process texinfo,
precompiled documentation (PostScript, dvi, info and HTML formats)
is available from the zsh archive site or its mirrors, in the file
tt(zsh-doc.tar.gz). (See noderef(Availability) for a list of sites.)

24
Doc/Zsh/index.yo Normal file
View File

@ -0,0 +1,24 @@
ifztexi(\
def(printindex)(2)(\
NOTRANS(@unnumbered) ARG1NL()\
NL()\
NOTRANS(@printindex) ARG2\
)\
texinode(Concept Index)(Variables Index)(Top)(Top)
printindex(Concept Index)(cp)
texinode(Variables Index)(Options Index)(Concept Index)(Top)
printindex(Variables Index)(vr)
texinode(Options Index)(Functions Index)(Variables Index)(Top)
printindex(Options Index)(pg)
texinode(Functions Index)(Editor Functions Index)(Options Index)(Top)
printindex(Functions Index)(fn)
texinode(Editor Functions Index)(Keystroke Index)(Functions Index)(Top)
printindex(Editor Functions Index)(tp)
texinode(Keystroke Index)()(Editor Functions Index)(Top)
printindex(Keystroke Index)(ky)
)\

38
Doc/Zsh/intro.yo Normal file
View File

@ -0,0 +1,38 @@
texinode(Introduction)(Invocation)(The Z Shell Guide)(Top)
chapter(Introduction)
ifzman(\
sect(Synopsis)
Because zsh contains many features, the zsh manual has been split into
a number of section+CHAR(s)\
ifzshall(\
. This manual page includes all the separate manual pages in the
following order\
)\
:
startlist()
ifzshone(\
list(em(zsh) Zsh overview (this section))
)\
list(em(zshmisc) Anything not fitting into the other sections)
list(em(zshexpn) Zsh command and parameter expansion)
list(em(zshparam) Zsh parameters)
list(em(zshoptions) Zsh options)
list(em(zshbuiltins) Zsh built-in functions)
list(em(zshzle) Zsh command line editing)
list(em(zshcompctl) Zsh completion control)
list(em(zshmodules) Zsh loadable modules)
ifzshone(\
list(em(zshall) Meta-man page containing all of the above)
)\
endlist()
sect(Description)
)\
Zsh is a UNIX command interpreter (shell) usable as an interactive
login shell and as a shell script command processor. Of the standard shells,
zsh most closely resembles bf(ksh) but includes many enhancements. Zsh
has command line editing, builtin spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and a host of other features.
includefile(Zsh/metafaq.yo)
ifnzman(includefile(Zsh/seealso.yo))

23
Doc/Zsh/invoke.yo Normal file
View File

@ -0,0 +1,23 @@
texinode(Invocation)(Files)(Introduction)(Top)
chapter(Invocation)
cindex(invocation)
sect(Invocation Options)
cindex(flags, shell)
cindex(shell flags)
If the tt(-s) flag is not present and an argument is given,
the first argument is taken to be the pathname of a script to
execute. The remaining arguments are assigned to the positional
parameters. The following flags are interpreted by the shell
when invoked:
startitem()
item(tt(-c) var(string))(
Read commands from var(string).
)
item(tt(-i))(
Force shell to be interactive.
)
item(tt(-s))(
Read command from the standard input.
)
enditem()

91
Doc/Zsh/jobs.yo Normal file
View File

@ -0,0 +1,91 @@
texinode(Jobs & Signals)(Arithmetic Evaluation)(Functions)(Top)
chapter(Jobs & Signals)
sect(Jobs)
cindex(jobs)
If the tt(MONITOR) option is set,
an interactive shell associates a em(job) with each pipeline.
It keeps a table of current jobs, printed by the tt(jobs)
command, and assigns them small integer numbers.
When a job is started asynchronously with `tt(&)',
the shell prints a line which looks like:
nofill(tt([1] 1234))
indicating that the job which was started asynchronously was job number
1 and had one (top-level) process, whose process ID was 1234.
If a job is started with `tt(&|)' or `tt(&!)',
then that job is immediately disowned. After startup, it
does not have a place in the job table, and is not subject
to the job control features described here.
If you are running a job and wish to do something else you may hit the key
^Z (control-Z) which sends a tt(TSTP) signal to the current job.
cindex(jobs, suspending)
cindex(suspending jobs)
The shell will then normally indicate that the job has been `suspended',
and print another prompt. You can then manipulate the state of this job,
findex(bg, use of)
putting it in the background with the tt(bg) command, or run some other
commands and then eventually bring the job back into the foreground with
findex(fg, use of)
the foreground command tt(fg). A ^Z takes effect immediately and
is like an interrupt in that pending output and unread input are discarded
when it is typed.
A job being run in the background will suspend if it tries to read
from the terminal.
cindex(background jobs, I/O)
cindex(jobs, background, I/O)
Background jobs are normally allowed to produce output,
but this can be disabled by giving the command `tt(stty tostop)'.
If you set this
tty option, then background jobs will suspend when they try to produce
output like they do when they try to read input.
cindex(jobs, referring to)
cindex(referring to jobs)
There are several ways to refer to jobs in the shell.
A job can be referred to by the process ID of any process of the job
or by one of the following:
startsitem()
sitem(tt(%)var(number))(The job with the given number.)
sitem(tt(%)var(string))(Any job whose command line begins with var(string).)
sitem(tt(%?)var(string))(Any job whose command line contains var(string).)
sitem(tt(%%))(Current job.)
sitem(tt(%PLUS()))(Equivalent to `tt(%%)'.)
sitem(tt(%-))(Previous job.)
endsitem()
The shell learns immediately whenever a process changes state.
pindex(NOTIFY, use of)
It normally informs you whenever a job becomes blocked so that
no further progress is possible. If the tt(NOTIFY) option is not set,
it waits until just before it prints a prompt before it informs you.
When the monitor mode is on, each background job that completes
triggers any trap set for tt(CHLD).
When you try to leave the shell while jobs are running or suspended, you will
be warned that `You have suspended (running) jobs'.
You may use the tt(jobs) command to see what they are.
If you do this or immediately try to
exit again, the shell will not warn you a second time; the suspended
jobs will be terminated, and the running jobs will be sent
a tt(SIGHUP) signal, if the tt(HUP) option is set.
pindex(HUP, use of)
cindex(jobs, disowning)
cindex(disowning jobs)
findex(disown, use of)
To avoid having the shell terminate the running jobs, either
use the bf(nohup) command (see manref(nohup)(1))
or the tt(disown) builtin.
sect(Signals)
The tt(INT) and tt(QUIT) signals for an invoked
command are ignored if the command is followed by
`tt(&)' and the tt(MONITOR) option is not active.
Otherwise, signals have the values
inherited by the shell from its parent
(but see the tt(TRAP)var(NAL) special functions in noderef(Functions)).

142
Doc/Zsh/metafaq.yo Normal file
View File

@ -0,0 +1,142 @@
startmenu()
menu(Author)
menu(Availability)
menu(Mailing Lists)
menu(The Zsh FAQ)
menu(The Zsh Web Page)
menu(See Also)
endmenu()
texinode(Author)(Availability)()(Introduction)
sect(Author)
cindex(author)
Zsh was originally written by Paul Falstad tt(<pf@zsh.org>).
Zsh is now maintained by the members of the zsh-workers mailing
list tt(<zsh-workers@math.gatech.edu>). The development is currently
coordinated by Andrew Main (Zefram) tt(<zefram@zsh.org>). The coordinator
can be contacted at tt(<coordinator@zsh.org>), but matters relating to
the code should generally go to the mailing list.
texinode(Availability)(Mailing Lists)(Author)(Introduction)
sect(Availability)
Zsh is available from the following anonymous FTP sites. These mirror
sites are kept frequently up to date. The sites marked with em((G))
may be mirroring tt(ftp.math.gatech.edu) instead of the primary site.
The sites marked with em((H)) may be mirroring tt(ftp.cs.elte.hu)
instead of the primary site.
startitem()
item(Primary site)(
nofill(tt(ftp://ftp.zsh.org/pub/zsh/)
tt(http://www.zsh.org/pub/zsh/))
)
item(Australia)(
nofill(tt(ftp://ftp.zsh.org/pub/zsh/)
tt(http://www.zsh.org/pub/zsh/)
tt(ftp://ftp.ips.oz.au/pub/packages/zsh/) em((G)) em((H)))
)
item(Denmark)(
nofill(tt(ftp://sunsite.auc.dk/pub/unix/shells/zsh/))
)
item(Finland)(
nofill(tt(ftp://ftp.funet.fi/pub/unix/shells/zsh/) em((H)))
)
item(France)(
nofill(tt(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/))
)
item(Germany)(
nofill(tt(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/) em((H))
tt(ftp://ftp.gmd.de/packages/zsh/) em((H))
tt(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/) em((H)))
)
item(Hungary)(
nofill(tt(ftp://ftp.cs.elte.hu/pub/zsh/)
tt(http://www.cs.elte.hu/pub/zsh/)
tt(ftp://ftp.kfki.hu/pub/packages/zsh/) em((H)))
)
item(Israel)(
nofill(tt(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
tt(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/))
)
item(Japan)(
nofill(tt(ftp://ftp.tohoku.ac.jp/mirror/zsh/) em((H))
tt(ftp://ftp.nis.co.jp/pub/shells/zsh/) em((H)))
)
item(Norway)(
nofill(tt(ftp://ftp.uit.no/pub/unix/shells/zsh/) em((H)))
)
item(Romania)(
nofill(tt(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/))
)
item(Slovenia)(
nofill(tt(ftp://ftp.siol.net/pub/unix/shells/zsh/) em((H)))
)
item(Sweden)(
nofill(tt(ftp://ftp.lysator.liu.se/pub/unix/zsh/) em((H)))
)
item(UK)(
nofill(tt(ftp://ftp.net.lut.ac.uk/zsh/) em((H))
tt(ftp://sunsite.doc.ic.ac.uk/packages/unix/shells/zsh/) em((G)))
)
item(USA)(
nofill(tt(ftp://ftp.math.gatech.edu/pub/zsh/)
tt(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
tt(ftp://ftp.sterling.com/zsh/) em((G)) em((H))
tt(ftp://ftp.rge.com/pub/shells/zsh/) em((G)) em((H))
tt(ftp://foad.org/pub/zsh/)
tt(http://foad.org/zsh/))
)
enditem()
texinode(Mailing Lists)(The Zsh FAQ)(Availability)(Introduction)
sect(Mailing Lists)
cindex(mailing lists)
Zsh has 3 mailing lists:
startitem()
item(tt(<zsh-announce@math.gatech.edu>))(
Announcements about releases, major changes in the shell and the
monthly posting of the Zsh FAQ. (moderated)
)
item(tt(<zsh-users@math.gatech.edu>))(
User discussions.
)
item(tt(<zsh-workers@math.gatech.edu>))(
Hacking, development, bug reports and patches.
)
enditem()
To subscribe, send mail with the SUBJECT `tt(subscribe) var(<e-mail-address>)'
to the associated administrative address for the mailing list.
startlist()
list(tt(<zsh-announce-request@math.gatech.edu>))
list(tt(<zsh-users-request@math.gatech.edu>))
list(tt(<zsh-workers-request@math.gatech.edu>))
endlist()
Unsubscribing is done similarly.
YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED.
All submissions to bf(zsh-announce) are automatically forwarded to
bf(zsh-users). All submissions to bf(zsh-users) are automatically
forwarded to bf(zsh-workers).
If you have problems subscribing/unsubscribing to any of the mailing
lists, send mail to tt(<listmaster@zsh.org>). The mailing lists are
maintained by Richard Coleman tt(<coleman@zsh.org>).
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above. There is also a hypertext
archive, maintained by Geoff Wing tt(<gcw@zsh.org>), available at
tt(http://www.zsh.org/mla/).
texinode(The Zsh FAQ)(The Zsh Web Page)(Mailing Lists)(Introduction)
sect(The Zsh FAQ)
Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson tt(<pws@zsh.org>). It is regularly posted to the
newsgroup bf(comp.unix.shell) and the bf(zsh-announce) mailing list.
The latest version can be found at any of the Zsh FTP sites, or at
tt(http://www.zsh.org/FAQ/). The contact address for FAQ-related matters
is tt(<faqmaster@zsh.org>).
texinode(The Zsh Web Page)(See Also)(The Zsh FAQ)(Introduction)
sect(The Zsh Web Page)
Zsh has a web page which is located at tt(http://www.zsh.org/). This is
maintained by Karsten Thygesen tt(<karthy@zsh.org>), of SunSITE Denmark.
The contact address for web-related matters is tt(<webmaster@zsh.org>).

28
Doc/Zsh/mod_cap.yo Normal file
View File

@ -0,0 +1,28 @@
texinode(The cap Module)(The clone Module)()(Zsh Modules)
sect(The cap Module)
The tt(cap) module is used for manipulating POSIX.1e (POSIX.6) capability
sets. If the operating system does not support this interface, the
builtins defined by this module will do nothing.
The builtins in this module are:
startitem()
findex(cap)
cindex(capabilities, setting)
item(tt(cap) [ var(capabilities) ])(
Change the shell's process capability sets to the specified var(capabilities),
otherwise display the shell's current capabilities.
)
findex(getcap)
cindex(capabilities, getting from files)
item(tt(getcap) var(filename) ...)(
This is a built-in implementation of the POSIX standard utility. It displays
the capability sets on each specified var(filename).
)
findex(setcap)
cindex(capabilities, setting on files)
item(tt(setcap) var(capabilities) var(filename) ...)(
This is a built-in implementation of the POSIX standard utility. It sets
the capability sets on each specified var(filename) to the specified
var(capabilities).
)
enditem()

19
Doc/Zsh/mod_clone.yo Normal file
View File

@ -0,0 +1,19 @@
texinode(The clone Module)(The comp1 Module)(The cap Module)(Zsh Modules)
sect(The clone Module)
The tt(clone) module makes available one builtin command:
startitem()
findex(clone)
cindex(shell, cloning)
cindex(cloning the shell)
cindex(terminal)
item(tt(clone) var(tty))(
Creates a forked instance of the current shell, attached to the specified
var(tty). In the new shell, the tt(PID), tt(PPID) and tt(TTY) special
parameters are changed appropriately. tt($!) is set to zero in the new
shell, and to the new shell's PID in the original shell.
The return value of the builtin is zero in both shells if successful,
and non-zero on error.
)
enditem()

11
Doc/Zsh/mod_comp1.yo Normal file
View File

@ -0,0 +1,11 @@
texinode(The comp1 Module)(The compctl Module)(The clone Module)(Zsh Modules)
sect(The comp1 Module)
The tt(comp1) module does nothing that is visible to the user.
Its purpose is to provide the internal basis of the programmable
completion mechanism.
This module must be loaded before any module that
provides a means of controlling completion (such as the tt(compctl)
module), or that uses completions (such as the tt(zle) module).
This is done automatically for modules distributed with zsh, and
for other modules can be effected by the use of tt(zmodload -d).

7
Doc/Zsh/mod_compctl.yo Normal file
View File

@ -0,0 +1,7 @@
texinode(The compctl Module)(The deltochar Module)(The comp1 Module)(Zsh Modules)
sect(The compctl Module)
The tt(compctl) module makes available one builtin command, tt(compctl),
which is the standard way to control completions for ZLE. See
ifzman(zmanref(zshcompctl))\
ifnzman(noderef(Programmable Completion))\
.

12
Doc/Zsh/mod_deltochar.yo Normal file
View File

@ -0,0 +1,12 @@
texinode(The deltochar Module)(The example Module)(The compctl Module)(Zsh Modules)
sect(The deltochar Module)
The tt(deltochar) module makes available one ZLE function:
startitem()
tindex(delete-to-char)
item(tt(delete-to-char))(
Read a character from the keyboard, and
delete from the cursor position up to and including the next
(or, with repeat count var(n), the var(n)th) instance of that character.
)
enditem()

16
Doc/Zsh/mod_example.yo Normal file
View File

@ -0,0 +1,16 @@
texinode(The example Module)(The files Module)(The deltochar Module)(Zsh Modules)
sect(The example Module)
The tt(example) module makes available one builtin command:
startitem()
findex(example)
cindex(modules, example)
cindex(modules, writing)
cindex(writing modules)
item(tt(example) [ tt(-flags) ] [ var(args) ... ])(
Displays the flags and arguments it is invoked with.
)
enditem()
The purpose of the module is to serve as an example of how to write a
module.

100
Doc/Zsh/mod_files.yo Normal file
View File

@ -0,0 +1,100 @@
texinode(The files Module)(The sched Module)(The example Module)(Zsh Modules)
sect(The files Module)
cindex(files, manipulating)
The tt(files) module makes some standard commands available as builtins:
startitem()
findex(ln)
xitem(tt(ln) [ tt(-dfis) ] var(filename) var(dest))
item(tt(ln) [ tt(-dfis) ] var(filename) ... var(dir))(
Creates hard (or, with tt(-s), symbolic) links. In the first form, the
specified var(dest)ination is created, as a link to the specified
var(filename). In the second form, each of the var(filename)s is
taken in turn, and linked to a pathname in the specified var(dir)ectory
that has the same last pathname component.
Normally, tt(ln) will not attempt to create hard links to
directories. This check can be overridden using the tt(-d) option.
Typically only the super-user can actually succeed in creating
hard links to directories.
This does not apply to symbolic links in any case.
By default, existing files cannot be replaced by links.
The tt(-i) option causes the user to be queried about replacing
existing files. The tt(-f) option causes existing files to be
silently deleted, without querying. tt(-f) takes precedence.
)
findex(mkdir)
item(tt(mkdir) [ tt(-p) ] [ tt(-m) var(mode) ] var(dir) ...)(
Creates directories. With the tt(-p) option, non-existing parent
directories are first created if necessary, and there will be
no complaint if the directory already exists.
The tt(-m) option can be used to specify (in octal) a set of file permissions
for the created directories, otherwise mode 777 modified by the current
tt(umask) (see manref(umask)(2)) is used.
)
findex(mv)
xitem(tt(mv) [ tt(-fi) ] var(filename) var(dest))
item(tt(mv) [ tt(-fi) ] var(filename) ... var(dir))(
Moves files. In the first form, the specified var(filename) is moved
to the specified var(dest)ination. In the second form, each of the
var(filename)s is
taken in turn, and moved to a pathname in the specified var(dir)ectory
that has the same last pathname component.
By default, the user will be queried before replacing any file
that the user cannot write to, but writable files will be silently
removed.
The tt(-i) option causes the user to be queried about replacing
any existing files. The tt(-f) option causes any existing files to be
silently deleted, without querying. tt(-f) takes precedence.
Note that this tt(mv) will not move files across devices.
Historical versions of tt(mv), when actual renaming is impossible,
fall back on copying and removing files; if this behaviour is desired,
use tt(cp) and tt(rm) manually. This may change in a future version.
)
findex(rm)
item(tt(rm) [ tt(-dfirs) ] var(filename) ...)(
Removes files and directories specified.
Normally, tt(rm) will not remove directories (except with the tt(-r)
option). The tt(-d) option causes tt(rm) to try removing directories
with tt(unlink) (see manref(unlink)(2)), the same method used for files.
Typically only the super-user can actually succeed in unlinking
directories in this way.
tt(-d) takes precedence over tt(-r).
By default, the user will be queried before removing any file
that the user cannot write to, but writable files will be silently
removed.
The tt(-i) option causes the user to be queried about removing
any files. The tt(-f) option causes files to be
silently deleted, without querying, and suppresses all error indications.
tt(-f) takes precedence.
The tt(-r) option causes tt(rm) to recursively descend into directories,
deleting all files in the directory before removing the directory with
the tt(rmdir) system call (see manref(rmdir)(2)).
The tt(-s) option is a zsh extension to tt(rm) functionality. It enables
paranoid behaviour, intended to avoid common security problems involving
a root-run tt(rm) being tricked into removing files other than the ones
intended. It will refuse to follow symbolic links, so that (for example)
``tt(rm /tmp/foo/passwd)'' can't accidentally remove tt(/etc/passwd)
if tt(/tmp/foo) happens to be a link to tt(/etc). It will also check
where it is after leaving directories, so that a recursive removal of
a deep directory tree can't end up recursively removing tt(/usr) as
a result of directories being moved up the tree.
)
findex(rmdir)
item(tt(rmdir) var(dir) ...)(
Removes empty directories specified.
)
findex(sync)
item(tt(sync))(
Calls the system call of the same name (see manref(sync)(2)), which
flushes dirty buffers to disk. It might return before the I/O has
actually been completed.
)
enditem()

17
Doc/Zsh/mod_sched.yo Normal file
View File

@ -0,0 +1,17 @@
texinode(The sched Module)(The stat Module)(The files Module)(Zsh Modules)
sect(The sched Module)
The tt(sched) module makes available one builtin command:
startitem()
findex(sched)
cindex(timed execution)
cindex(execution, timed)
xitem(tt(sched) [tt(PLUS())]var(hh)tt(:)var(mm) var(command) ...)
item(tt(sched) [ tt(-)var(item) ])(
Make an entry in the scheduled list of commands to execute.
The time may be specified in either absolute or relative time.
With no arguments, prints the list of scheduled commands.
With the argument `tt(-)var(item)', removes the given item
from the list.
)
enditem()

145
Doc/Zsh/mod_stat.yo Normal file
View File

@ -0,0 +1,145 @@
texinode(The stat Module)(The zle Module)(The sched Module)(Zsh Modules)
sect(The stat Module)
The tt(stat) module makes available one builtin command:
startitem()
findex(stat)
cindex(files, listing)
cindex(files, examining)
item(tt(stat) [ tt(-gnNlLtTrs) ] [ tt(-f) var(fd) ] [ tt(-A) var(array) ] \
[ tt(-F) var(fmt) ] [ tt(PLUS())var(element) ] [ var(file) ... ])(
The command acts as a front end to the tt(stat) system call (see
manref(stat)(2)).
If the tt(stat) call fails, the appropriate system error message
printed and status 1 is returned.
The fields of tt(struct stat) give information about
the files provided as arguments to the command. In addition to those
available from the tt(stat) call, an extra element `tt(link)' is provided.
These elements are:
startitem()
item(tt(device))(
The number of the device on which the file resides.
)
item(tt(inode))(
The unique number of the file on this device (`em(inode)' number).
)
item(tt(mode))(
The mode of the file; that is, the file's type and access permissions.
With the tt(-s) option, this will
be returned as a string corresponding to the first column in the
display of the tt(ls -l) command.
)
item(tt(nlink))(
The number of hard links to the file.
)
item(tt(uid))(
The user ID of the owner of the file. With the tt(-s)
option, this is displayed as a user name.
)
item(tt(gid))(
The group ID of the file. With the tt(-s) option, this
is displayed as a group name.
)
item(tt(rdev))(
The raw device number. This is only useful for special devices.
)
item(tt(size))(
The size of the file in bytes.
)
xitem(tt(atime))
xitem(tt(mtime))
item(tt(ctime))(
The last access, modification and inode change times
of the file, respectively, as the number of seconds since
midnight GMT on 1st January, 1970. With the tt(-s) option,
these are printed as strings for the local time zone; the format
can be altered with the tt(-F) option, and with the tt(-g)
option the times are in GMT.
)
item(tt(blksize))(
The number of bytes in one allocation block on the
device on which the file resides.
)
item(tt(block))(
The number of disk blocks used by the file.
)
item(tt(link))(
If the file is a link and the tt(-L) option is in
effect, this contains the name of the file linked to, otherwise
it is empty. Note that if this element is selected (``tt(stat PLUS()link)'')
then the tt(-L) option is automatically used.
)
enditem()
A particular element may be selected by including its name
preceded by a `tt(PLUS())' in the option list; only one element is allowed.
The element may be shortened to any unique set of leading
characters. Otherwise, all elements will be shown for all files.
Options:
startitem()
item(tt(-A) var(array))(
Instead of displaying the results on standard
output, assign them to an var(array), one tt(struct stat) element per array
element for each file in order. In this case neither the name
of the element nor the name of the files is provided unless the
tt(-t) or tt(-n) options are provided, respectively. In the
former case the element name appears as a prefix to the
appropriate array element and in the latter case the file name
appears as a separate array element preceding all the others.
Other formatting options are respected.
)
item(tt(-f) var(fd))(
Use the file on file descriptor var(fd) instead of
named files; no list of file names is allowed in this case.
)
item(tt(-F) var(fmt))(
Supplies a tt(strftime) (see manref(strftime)(3)) string for the
formatting of the time elements. The tt(-s) option is implied.
)
item(tt(-g))(
Show the time elements in the GMT time zone. The
tt(-s) option is implied.
)
item(tt(-l))(
List the names of the type elements (to standard
output or an array as appropriate) and return immediately;
options other than tt(-A) and arguments are ignored.
)
item(tt(-L))(
Perform an tt(lstat) (see manref(lstat)(2)) rather than a tt(stat)
system call. In this case, if the file is a link, information
about the link itself rather than the target file is returned.
This option is required to make the tt(link) element useful.
)
item(tt(-n))(
Always show the names of files. Usually these are
only shown when output is to standard output and there is more
than one file in the list.
)
item(tt(-N))(
Never show the names of files.
)
item(tt(-r))(
Print raw data (the default format) alongside string
data (the tt(-s) format); the string data appears in parentheses
after the raw data.
)
item(tt(-s))(
Print tt(mode), tt(uid), tt(gid) and the three time
elements as strings instead of numbers. In each case the format
is like that of tt(ls -l).
)
item(tt(-t))(
Always show the type names for the elements of
tt(struct stat). Usually these are only shown when output is to
standard output and no individual element has been selected.
)
item(tt(-T))(
Never show the type names of the tt(struct stat) elements.
)
enditem()
)
enditem()

421
Doc/Zsh/mod_zftp.yo Normal file
View File

@ -0,0 +1,421 @@
texinode(The zftp Module)(The zle Module)(The stat Module)(Zsh Modules)
sect(The zftp Module)
The tt(zftp) module makes available one builtin command:
startitem()
findex(zftp)
cindex(FTP)
cindex(files, transferring)
item(tt(zftp) var(subcommand) [ var(args) ])(
The tt(zftp) module is a client for FTP (file transfer protocol). It
is implemented as a builtin to allow full use of shell command line
editing, file I/O, and job control mechanisms. Often, users will
access it via shell functions providing higher level abilities such as
username and password lookup. However, it is entirely usable in its
own right.
All commands consist of the command name tt(zftp) followed by the name
of a subcommand. These are listed below. The return status of each
subcommand is supposed to reflect the success or failure of the remote
operation. See a description of the variable tt(ZFTP_VERBOSE) for
more information on how responses from the server may be printed.
)
enditem()
subsect(Subcommands)
cindex(zftp, subcommands)
startitem()
cindex(FTP, starting a session)
item(tt(open) var(host) [ var(user) [ var(password) [ var(account) ] ] ])(
Open a new FTP session to var(host), which may be the name of a TCP/IP
connected host or an IP number in the standard dot notation.
Remaining arguments are passed to the tt(login) subcommand. Note that
if no arguments beyond var(host) are supplied, tt(open) will em(not)
automatically call tt(login). If no arguments at all are supplied,
tt(open) will use the parameters set by the tt(params) subcommand.
After a successful open, the shell variables tt(ZFTP_HOST),
tt(ZFTP_IP) and tt(ZFTP_SYSTEM) are available; see `Variables'
below.
)
xitem(tt(login) [ var(name) [ var(password) [ var(account) ] ] ])
item(tt(user) [ var(name) [ var(password) [ var(account) ] ] ])(
Login the user var(name) with parameters var(password) and var(account).
Any of the parameters can be omitted, and will be read from standard
input if needed (var(name) is always needed). If
standard input is a terminal, a prompt for each one will be printed on
standard error and var(password) will not be echoed. If any of the
parameters are not used, a warning message is printed.
After a successful login, the shell variables tt(ZFTP_USER),
tt(ZFTP_ACCOUNT) and tt(ZFTP_PWD) are available; see `Variables'
below.
This command may be re-issued when a user is already logged in, and
the server will first be reinitialized for a new user.
)
xitem(tt(params) [ var(host) [ var(user) [ var(password) \
[ var(account) ] ] ] ])
item(tt(params) tt(-))(
Store the given parameters for a later tt(open) command with no
arguments. Only those given on the command line will be remembered.
Any of the parameters may, however, be specified as a `tt(?)', which
may need to be quoted to protect it from shell expansion: in this case,
the appropriate parameter will be read from stdin as with the
tt(login) subcommand, including special handling of var(password).
If no arguments are given, the parameters currently set are printed,
although the password will appear as a line of stars.
If instead a single `tt(-)' is given, the existing parameters, if any,
are deleted. In that case, calling tt(open) with no arguments will
cause an error.
The list of parameters is not deleted after a tt(close), however it
will be deleted if the tt(zftp) module is unloaded.
For example,
nofill(tt(zftp params ftp.elsewhere.xx juser '?'))
will store the host tt(ftp.elsewhere.xx) and the user tt(juser) and
then prompt the user for the corresponding password.
This command may also be used to set up a transfer which then takes
place completely in the background, freeing tt(zftp) for concurrent
foreground use. For example,
nofill(tt(zftp params ftp.soreeyes.ca bubble squeak))
nofill(tt(LPAR()zftp open; zftp get foo >bar; zftp close)tt(RPAR() &))
--- here, the connection is restricted to a background subshell and
you are free to open a simultaneous connection in the foreground.
)
item(tt(cd) var(directory))(
Change the remote directory to var(directory). Also alters the shell
variable tt(ZFTP_PWD).
)
item(tt(cdup))(
Change the remote directory to the one higher in the directory tree.
Note that tt(cd ..) will also work correctly on non-UNIX systems.
)
item(tt(dir) [ var(args...) ])(
Give a (verbose) listing of the remote directory. The var(args) are
passed directly to the server. The command's behaviour is implementation
dependent, but a UNIX server will typically interpret var(args) as
arguments to the tt(ls) command and with no arguments return the
result of `tt(ls -l)'. The directory is listed to standard output.
)
item(tt(ls) [ var(args) ])(
Give a (short) listing of the remote directory. With no var(args),
produces a raw list of the files in the directory, one per line.
Otherwise, up to vagaries of the server implementation, behaves
similar to tt(dir).
)
item(tt(type) [ var(type) ])(
Change the type for transfer to var(type), or print the current type
if var(type) is absent. The allowed values are `tt(A)' (ASCII),
`tt(I)' (Image, i.e. binary), or `tt(B)' (a synonym for `tt(I)').
The FTP default for a transfer is ASCII. However, if tt(zftp) finds
that the remote host is a UNIX machine with 8-bit byes, it will
automatically switch to using binary for file transfers upon
tt(open). This can subsequently be overridden.
The transfer type is only passed to the remote host when a data
connection is established; this command involves no network overhead.
)
item(tt(ascii))(
The same as tt(type A).
)
item(tt(binary))(
The same as tt(type I).
)
item(tt(mode) [ tt(S) | tt(B) ])(
Set the mode type to stream (tt(S)) or block (tt(B)). Stream mode is
the default; block mode is not widely supported.
)
xitem(tt(remote) var(files...))
item(tt(local) [ var(files...) ])(
Print the size and last modification time of the remote or local
files. If there is more than one item on the list, the name of the
file is printed first. The first number is the file size, the second
is the last modification time of the file in the format
tt(CCYYMMDDhhmmSS) consisting of year, month, date, hour, minutes and
seconds in GMT. Note that this format, including the length, is
guaranteed, so that time strings can be directly compared via the
tt([[) builtin's tt(<) and tt(>) operators, even if they are too long
to be represented as integers.
Not all servers support the commands for retrieving this information.
In that case, the tt(remote) command will print nothing and return
status 2, compared with status 1 for a file not found.
The tt(local) command (but not tt(remote)) may be used with no
arguments, in which case the information comes from examining file
descriptor zero. This is the same file as seen by a tt(put) command
with no further redirection.
)
item(tt(get) var(file) [...])(
Retrieve all var(file)s from the server, concatenating them
and sending them to standard output.
)
item(tt(put) var(file) [...])(
For each var(file), read a file from standard input and send that to
the remote host with the given name.
)
item(tt(append) var(file) [...])(
As tt(put), but if the remote var(file) already exists, data is
appended to it instead of overwriting it.
)
xitem(tt(getat) var(file) var(point))
xitem(tt(putat) var(file) var(point))
item(tt(appendat) var(file) var(point))(
Versions of tt(get), tt(put) and tt(append) which will start the
transfer at the given var(point) in the remote var(file). This is
useful for appending to an incomplete local file. However, note that
this ability is not universally supported by servers (and is not quite
the behaviour specified by the standard).
)
item(tt(delete) var(file) [...])(
Delete the list of files on the server.
)
item(tt(mkdir) var(directory))(
Create a new directory var(directory) on the server.
)
item(tt(rmdir) var(directory))(
Delete the diretory var(directory) on the server.
)
item(tt(rename) var(old-name) var(new-name))(
Rename file var(old-name) to var(new-name) on the server.
)
item(tt(site) var(args...))(
Send a host-specific command to the server. You will probably
only need this if instructed by the server to use it.
)
item(tt(quote) var(args...))(
Send the raw FTP command sequence to the server. You should be
familiar with the FTP command set as defined in RFC959 before doing
this. Useful comands may include tt(STAT) and tt(HELP). Note also
the mechanism for returning messages as described for the variable
tt(ZFTP_VERBOSE) below, in particular that all messages from the
control connection are sent to standard error.
)
xitem(tt(close))
item(tt(quit))(
Close the current data connection. This unsets the shell parameters
tt(ZFTP_HOST), tt(ZFTP_IP), tt(ZFTP_SYSTEM), tt(ZFTP_USER),
tt(ZFTP_ACCOUNT) and tt(ZFTP_PWD).
)
enditem()
subsect(Parameters)
cindex(zftp, parameters)
The following shell parameters are used by tt(zftp). Currently none
of them are special.
startitem()
item(tt(ZFTP_TMOUT))(
Integer. The time in seconds to wait for a network operation to
complete before returning an error. If this is not set when the
module is loaded, it will be given the default value 60. A value of
zero turns off timeouts. If a timeout occurs on the control
connection it will be closed. Use a larger value if this occurs too
frequently.
)
vindex(ZFTP_IP)
item(tt(ZFTP_IP))(
Readonly. The IP address of the current connection in dot notation.
)
vindex(ZFTP_HOST)
item(tt(ZFTP_HOST))(
Readonly. The hostname of the current remote server. If the host was
opened as an IP number, tt(ZFTP_HOST) contains that instead; this
saves the overhead for a name lookup, as IP numbers are most commonly
used when a nameserver is unavailable.
)
vindex(ZFTP_SYSTEM)
item(tt(ZFTP_SYSTEM))(
Readonly. The system type string returned by the server in response
to an FTP tt(SYST) request. The most interesting case is a string
beginning tt("UNIX Type: L8"), which ensures maximum compatibility
with a local UNIX host.
)
vindex(ZFTP_TYPE)
item(tt(ZFTP_TYPE))(
Readonly. The type to be used for data transfers , either `tt(A)' or
`tt(I)'. Use the tt(type) subcommand to change this.
)
vindex(ZFTP_USER)
item(tt(ZFTP_USER))(
Readonly. The username currently logged in, if any.
)
vindex(ZFTP_ACCT)
item(tt(ZFTP_ACCT))(
Readonly. The account name of the current user, if any. Most servers
do not require an account name.
)
vindex(ZFTP_PWD)
item(tt(ZFTP_PWD))(
Readonly. The current directory on the server.
)
vindex(ZFTP_CODE)
item(tt(ZFTP_CODE))(
Readonly. The three digit code of the last FTP reply from the server
as a string. This can still be read after the connection is closed.
)
vindex(ZFTP_REPLY)
item(tt(ZFTP_REPLY))(
Readonly. The last line of the last reply sent by the server. This
can still be read after the connection is closed.
)
vindex(ZFTP_PREFS)
item(tt(ZFTP_PREFS))(
A string of preferences for altering aspects of tt(zftp)'s behaviour.
Each preference is a single character. The following are defined:
startitem()
item(tt(P))(
Passive: attempt to make the remote server initiate data transfers.
This is slightly more efficient than sendport mode. If the letter
tt(S) occurs later in the string, tt(zftp) will use sendport mode if
passive mode is not available.
)
item(tt(S))(
Sendport: initiate transfers by the FTP tt(PORT) command. If this
occurs before any tt(P) in the string, passive mode will never be
attempted.
)
item(tt(D))(
Dumb: use only the bare minimum of FTP commands. This prevents
the variables tt(ZFTP_SYSTEM) and tt(ZFTP_PWD) from being set, and
will mean all connections default to ASCII type. It may prevent
tt(ZFTP_SIZE) from being set during a transfer if the server
does not send it anyway (many servers do).
)
enditem()
If tt(ZFTP_PREFS) is not set when tt(zftp) is loaded, it will be set to a
default of `tt(PS)', i.e. use passive mode if available, otherwise
fall back to sendport mode.
)
vindex(ZFTP_VERBOSE)
item(tt(ZFTP_VERBOSE))(
A string of digits between 0 and 5 inclusive, specifying which
responses from the server should be printed. All responses go to
standard error. If any of the numbers 1 to 5 appear in the string,
raw responses from the server with reply codes beginning with that
digit will be printed to standard error. The first digit of the three
digit reply code is defined by RFC959 to correspond to:
startitem()
item(1.)(
A positive prelimnary reply.
)
item(2.)(
A positive completion reply.
)
item(3.)(
A positive intermediate reply.
)
item(4.)(
A transient negative completion reply.
)
item(5.)(
A permanent negative completion reply.
)
enditem()
It should be noted that, for unknown reasons, the reply `Service not
available', which forces termination of a connection, is classified as
421, i.e. `transient negative', an interesting interpretation of the word
`transient'.
The code 0 is special: it indicates that all but the last line of
multiline replies read from the server will be printed to standard
error in a processed format. By convention, servers use this
mechanism for sending information for the user to read. The
appropriate reply code, if it matches the same response, takes
priority.
If tt(ZFTP_VERBOSE) is not set when tt(zftp) is loaded, it will be
set to the default value tt(450), i.e., messages destined for the user
and all errors will be printed. A null string is valid and
specifies that no messages should be printed.
)
enditem()
subsect(Functions)
cindex(zftp, functions)
startitem()
findex(zftp_chpwd)
item(tt(zftp_chpwd))(
If this function is set by the user, it is called every time the
directory changes on the server, including when a user is logged
in, or when a connection is closed. In the last case, tt($ZFTP_PWD)
will be unset; otherwise it will reflect the new directory.
)
findex(zftp_progress)
item(tt(zftp_progress))(
If this function is set by the user, it will be called during
a tt(get), tt(put) or tt(append) operation each time sufficient data
has been received from the host. During a tt(get), the data is sent
to standard output, so it is vital that this function should write
to standard error or directly to the terminal, em(not) to standard
output.
When it is called with a transfer in progress, the following
additional shell parameters are set:
startitem()
vindex(ZFTP_FILE)
item(tt(ZFTP_FILE))(
The name of the remote file being transferred from or to.
)
vindex(ZFTP_TRANSFER)
item(tt(ZFTP_TRANSFER))(
A tt(G) for a tt(get) operation and a tt(P) for a tt(put) operation.
)
vindex(ZFTP_SIZE)
item(tt(ZFTP_SIZE))(
The total size of the complete file being transferred:
the same as the first value provided by the
tt(remote) and tt(local) subcommands for a particular file.
If the server cannot supply this value for a remote file being
retrieved, it will not be set. If input is from a pipe the value may
be incorrect and correspond simply to a full pipe buffer.
)
vindex(ZFTP_COUNT)
item(tt(ZFTP_COUNT))(
The amount of data so far transferred; a number between zero and
tt($ZFTP_SIZE), if that is set. This number is always available.
)
enditem()
The function is initially called with tt(ZFTP_TRANSFER) set
appropriately and tt(ZFTP_COUNT) set to zero. After the transfer is
finished, the function will be called one more time with
tt(ZFTP_TRANSFER) set to tt(GF) or tt(PF), in case it wishes to tidy
up. It is otherwise never called twice with the same value of
tt(ZFTP_COUNT).
Sometimes the progress meter may cause disruption. It is up to the
user to decide whether the function should be defined and to use
tt(unfunction) when necessary.
)
subsect(Problems)
cindex(zftp, problems)
With the exception noted for the tt(params) subcommand, a connection
may not be opened in the left hand side of a pipe as this occurs in a
subshell and the file information is not updated in the main shell.
In the case of type or mode changes or closing the connection in a
subshell, the information is returned but variables are not updated
until the next call to tt(zftp). Other status changes in subshells
will not be reflected by changes to the variables (but should
be otherwise harmless).
enditem()

193
Doc/Zsh/mod_zle.yo Normal file
View File

@ -0,0 +1,193 @@
texinode(The zle Module)()(The stat Module)(Zsh Modules)
sect(The zle Module)
The tt(zle) module contains the Zsh Line Editor. See
ifzman(zmanref(zshzle))\
ifnzman(noderef(Zsh Line Editor))\
. It also contains three related builtin commands:
startitem()
findex(bindkey)
cindex(keys, rebinding)
cindex(rebinding keys)
cindex(keys, binding)
cindex(binding keys)
cindex(keymaps)
xitem(tt(bindkey) [ var(options) ] tt(-l))
xitem(tt(bindkey) [ var(options) ] tt(-d))
xitem(tt(bindkey) [ var(options) ] tt(-D) var(keymap) ...)
xitem(tt(bindkey) [ var(options) ] tt(-A) var(old-keymap new-keymap))
xitem(tt(bindkey) [ var(options) ] tt(-N) var(new-keymap) [ var(old-keymap) ])
xitem(tt(bindkey) [ var(options) ] tt(-m))
xitem(tt(bindkey) [ var(options) ] tt(-r) var(in-string) ...)
xitem(tt(bindkey) [ var(options) ] tt(-s) var(in-string out-string) ...)
xitem(tt(bindkey) [ var(options) ] var(in-string command) ...)
item(tt(bindkey) [ var(options) ] [ var(in-string) ])(
tt(bindkey)'s options can be divided into three categories: keymap selection,
operation selection, and others. The keymap selection options are:
startitem()
item(tt(-e))(
Selects keymap `tt(emacs)', and also links it to `tt(main)'.
)
item(tt(-v))(
Selects keymap `tt(viins)', and also links it to `tt(main)'.
)
item(tt(-a))(
Selects keymap `tt(vicmd)'.
)
item(tt(-M))(
The first non-option argument is used as a keymap name,
and does not otherwise count as an argument.
)
enditem()
Some operations do not permit a keymap to be selected.
If a keymap selection is required and none of the options above are used, the
`tt(main)' keymap is used. These operations do not permit a keymap to be
selected:
startitem()
item(tt(-l))(
List all existing keymap names. If the tt(-L)
option is used, list in the form of tt(bindkey)
commands to create the keymaps.
)
item(tt(-d))(
Delete all existing keymaps and reset to the default state.
)
item(tt(-D) var(keymap) ...)(
Delete the named var(keymap)s.
)
item(tt(-A) var(old-keymap new-keymap))(
Make the var(new-keymap) name an alias for var(old-keymap), so that
both names refer to the same keymap. The names have equal standing;
if either is deleted, the other remains. If there is already a keymap
with the var(new-keymap) name, it is deleted.
)
item(tt(-N) var(new-keymap) [ var(old-keymap) ])(
Create a new keymap, named var(new-keymap). If a keymap already has that
name, it is deleted. If an var(old-keymap) name is given, the new keymap
is initialised to be a duplicate of it, otherwise the new keymap will
be empty.
)
enditem()
The following operations require a keymap to be selected:
startitem()
item(tt(-m))(
Add the built-in set of meta-key bindings to the selected keymap.
Only keys that are unbound or bound to tt(self-insert) are affected.
)
item(tt(-r) var(in-string) ...)(
Unbind the specified var(in-string)s in the selected keymap.
This is exactly equivalent to binding the strings to tt(undefined-key).
)
item(tt(-s) var(in-string out-string) ...)(
Bind each var(in-string) to each var(out-string).
When var(in-string) is typed, var(out-string) will be
pushed back and treated as input to the line editor.
)
item(var(in-string command) ...)(
Bind each var(in-string) to each var(command).
)
item([ var(in-string) ])(
List key bindings. If an var(in-string) is specified, the binding of
that string in the selected keymap is displayed. Otherwise, all key
bindings in the selected keymap are displayed. As an exception,
if the tt(-e) or tt(-v) options are used alone, the keymap is em(not)
displayed - the implicit linking of keymaps is the only thing that happens.
)
enditem()
In the binding operations, if the tt(-R) option is used, the var(in-string)s
are interpreted as ranges, instead of plain strings. A valid range
consists of two characters, with an optional `tt(-)'
between them. All characters between the two specified, inclusive,
are bound as specified.
For either var(in-string) or var(out-string), the following
escape sequences are recognised:
startsitem()
sitem(tt(\a))(bell character)
sitem(tt(\b))(backspace)
sitem(tt(\e), tt(\E))(escape)
sitem(tt(\f))(form feed)
sitem(tt(\n))(linefeed (newline))
sitem(tt(\r))(carriage return)
sitem(tt(\t))(horizontal tab)
sitem(tt(\v))(vertical tab)
sitem(tt(\)var(NNN))(character code in octal)
sitem(tt(\x)var(NN))(character code in hexadecimal)
sitem(tt(\M)[tt(-)]var(X))(character with meta bit set)
sitem(tt(\C)[tt(-)]var(X))(control character)
sitem(tt(^)var(X))(control character)
endsitem()
In all other cases, `tt(\)' escapes the following character. Delete is
written as `tt(^?)'. Note that `tt(\M^?)' and `tt(^\M?)' are not the same.
)
findex(vared)
cindex(parameters, editing)
cindex(editing parameters)
item(tt(vared) [ tt(-ch) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ] var(name))(
The value of the parameter var(name) is loaded into the edit
buffer, and the line editor is invoked. When the editor exits,
var(name) is set to the string value returned by the editor.
If the tt(-c) flag is given, the parameter is created if it doesn't
already exist.
If the tt(-p) flag is given, the following string will be taken as
the prompt to display at the left. If the tt(-r) flag is given,
the following string gives the prompt to display at the right. If the
tt(-h) flag is specified, the history can be accessed from ZLE.
)
findex(zle)
cindex(widgets, rebinding)
cindex(rebinding widgets)
cindex(widgets, binding)
cindex(binding widgets)
cindex(widgets, invoking)
cindex(invoking widgets)
cindex(widgets, calling)
cindex(calling widgets)
cindex(widgets, defining)
cindex(defining widgets)
xitem(tt(zle) tt(-l) [ tt(-L) ])
xitem(tt(zle) tt(-D) var(widget) ...)
xitem(tt(zle) tt(-A) var(old-widget) var(new-widget))
xitem(tt(zle) tt(-N) var(widget) [ var(function) ])
item(tt(zle) var(widget))(
The tt(zle) builtin performs a number of different actions concerning
ZLE. Which operation it performs depends on its options:
startitem()
item(tt(-l) [ tt(-L) ])(
List all existing user-defined widgets. If the tt(-L)
option is used, list in the form of tt(zle)
commands to create the widgets.
Built-in widgets are not listed.
)
item(tt(-D) var(widget) ...)(
Delete the named var(widget)s.
)
item(tt(-A) var(old-widget) var(new-widget))(
Make the var(new-widget) name an alias for var(old-widget), so that
both names refer to the same widget. The names have equal standing;
if either is deleted, the other remains. If there is already a widget
with the var(new-widget) name, it is deleted.
)
item(tt(-N) var(widget) [ var(function) ])(
Create a user-defined widget. If there is already a widget with the
specified name, it is overwritten. When the new
widget is invoked from within the editor, the specified shell var(function)
is called. If no function name is specified, it defaults to
the same name as the widget.
)
item(var(widget))(
Invoke the specified widget. This can only be done when ZLE is
active; normally this will be within a user-defined widget.
)
enditem()
)
enditem()

64
Doc/Zsh/modules.yo Normal file
View File

@ -0,0 +1,64 @@
texinode(Zsh Modules)()(Programmable Completion)(Top)
chapter(Zsh Modules)
cindex(modules)
sect(Description)
Some optional parts of zsh are in modules, separate from the core
of the shell. Each of these modules may be linked in to the
shell at build time,
or can be dynamically linked while the shell is running
if the installation supports this feature. The modules available are:
startitem()
item(tt(cap))(
Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets.
)
item(tt(clone))(
A builtin that can clone a running shell onto another terminal.
)
item(tt(comp1))(
Base of the completion system. Used by the tt(compctl) and tt(zle) modules.
)
item(tt(compctl))(
The tt(compctl) builtin for controlling completion.
)
item(tt(deltochar))(
A ZLE function duplicating EMACS' tt(zap-to-char).
)
item(tt(example))(
An example of how to write a module.
)
item(tt(files))(
Some basic file manipulation commands as builtins.
)
item(tt(sched))(
A builtin that provides a timed execution facility within the shell.
)
item(tt(stat))(
A builtin command interface to the tt(stat) system call.
)
item(tt(zle))(
The Zsh Line Editor, including the tt(bindkey) and tt(vared) builtins.
)
enditem()
startmenu()
menu(The cap Module)
menu(The clone Module)
menu(The comp1 Module)
menu(The compctl Module)
menu(The deltochar Module)
menu(The example Module)
menu(The files Module)
menu(The sched Module)
menu(The stat Module)
menu(The zle Module)
endmenu()
includefile(Zsh/mod_cap.yo)
includefile(Zsh/mod_clone.yo)
includefile(Zsh/mod_comp1.yo)
includefile(Zsh/mod_compctl.yo)
includefile(Zsh/mod_deltochar.yo)
includefile(Zsh/mod_example.yo)
includefile(Zsh/mod_files.yo)
includefile(Zsh/mod_sched.yo)
includefile(Zsh/mod_stat.yo)
includefile(Zsh/mod_zle.yo)

1039
Doc/Zsh/options.yo Normal file
View File

@ -0,0 +1,1039 @@
texinode(Options)(Shell Builtin Commands)(Parameters)(Top)
chapter(Options)
cindex(options)
startmenu()
menu(Specifying Options)
menu(Description of Options)
menu(Option Aliases)
menu(Single Letter Options)
endmenu()
texinode(Specifying Options)(Description of Options)()(Options)
sect(Specifying Options)
cindex(options, specifying)
Options are primarily referred to by name.
These names are case insensitive and underscores are ignored.
For example, `tt(allexport)' is equivalent to `tt(A__lleXP_ort)'.
The sense of an option name may be inverted by preceding it with
`tt(no)', so `tt(setopt No_Beep)' is equivalent to `tt(unsetopt beep)'.
This inversion can only be done once, so `tt(nonobeep)' is em(not)
a synonym for `tt(beep)'. Similarly, `tt(tify)' is not a synonym for
`tt(nonotify)' (the inversion of `tt(notify)').
Some options also have one or more single letter names.
There are two sets of single letter options: one used by default,
and another used to emulate bf(sh)/bf(ksh) (used when the
tt(SH_OPTION_LETTERS) option is set).
The single letter options can be used on the shell command line,
or with the tt(set), tt(setopt) and tt(unsetopt)
builtins, as normal Unix options preceded by `tt(-)'.
The sense of the single letter options may be inverted by using
`tt(PLUS())' instead of `tt(-)'.
Some of the single letter option names refer to an option being off,
in which case the inversion of that name refers to the option being on.
For example, `tt(PLUS()n)' is the short name of `tt(exec)', and
`tt(-n)' is the short name of its inversion, `tt(noexec)'.
texinode(Description of Options)(Option Aliases)(Specifying Options)(Options)
sect(Description of Options)
cindex(options, description)
startitem()
pindex(ALL_EXPORT)
cindex(export, automatic)
item(tt(ALL_EXPORT) (tt(-a), ksh: tt(-a)))(
All parameters subsequently defined are automatically exported.
)
pindex(ALWAYS_LAST_PROMPT)
item(tt(ALWAYS_LAST_PROMPT))(
If unset, key functions that list completions try to return to the last
prompt if given a numeric argument. If set these functions try to
return to the last prompt if given em(no) numeric argument.
)
pindex(ALWAYS_TO_END)
item(tt(ALWAYS_TO_END))(
If a completion is performed with the cursor within a word, and a
full completion is inserted, the cursor is moved to the end of the
word. That is, the cursor is moved to the end of the word if either
a single match is inserted or menu completion is performed.
)
pindex(APPEND_HISTORY)
cindex(history, appending to a file)
item(tt(APPEND_HISTORY))(
If this is set, zsh sessions will append their history list to
the history file, rather than overwrite it. Thus, multiple parallel
zsh sessions will all have their history lists added to the
history file, in the order they are killed.
)
pindex(AUTO_CD)
cindex(cd, automatic)
item(tt(AUTO_CD) (tt(-J)))(
If a command is issued that can't be executed as a normal command,
and the command is the name of a directory, perform the tt(cd)
command to that directory.
)
pindex(AUTO_LIST)
cindex(completion, listing choices)
item(tt(AUTO_LIST) (tt(-9)))(
Automatically list choices on an ambiguous completion.
)
pindex(AUTO_MENU)
cindex(completion, menu)
item(tt(AUTO_MENU))(
Automatically use menu completion after the second consecutive request for
completion, for example by pressing the tab key repeatedly. This option
is overridden by tt(MENU_COMPLETE).
)
pindex(AUTO_NAME_DIRS)
cindex(directories, named)
item(tt(AUTO_NAME_DIRS))(
Any parameter that is set to the absolute name of a directory
immediately becomes a name for that directory, that will be used
by the `tt(%~)'
and related prompt sequences, and will be available when completion
is performed on a word starting with `tt(~)'.
(Otherwise, the parameter must be used in the form `tt(~)var(param)' first.)
)
pindex(AUTO_PARAM_KEYS)
item(tt(AUTO_PARAM_KEYS))(
If a parameter name was completed and a following character
(normally a space) automatically
inserted, and the next character typed is one
of those that have to come directly after the name (like `tt(})', `tt(:)',
etc.), the automatically added character is deleted, so that the character
typed comes immediately after the parameter name.
Completion in a brace expansion is affected similarly: the added character
is a `tt(,)', which will be removed if `tt(})' is typed next.
)
pindex(AUTO_PARAM_SLASH)
item(tt(AUTO_PARAM_SLASH))(
If a parameter is completed whose content is the name of a directory,
then add a trailing slash instead of a space.
)
pindex(AUTO_PUSHD)
cindex(cd, behaving like pushd)
cindex(pushd, making cd behave like)
item(tt(AUTO_PUSHD) (tt(-N)))(
Make tt(cd) push the old directory onto the directory stack.
)
pindex(AUTO_REMOVE_SLASH)
cindex(slash, removing trailing)
item(tt(AUTO_REMOVE_SLASH))(
When the last character resulting from a completion is a slash and the next
character typed is a word delimiter or a slash, remove the slash.
)
pindex(AUTO_RESUME)
cindex(jobs, resuming automatically)
cindex(resuming jobs automatically)
item(tt(AUTO_RESUME) (tt(-W)))(
Treat single word simple commands without redirection
as candidates for resumption of an existing job.
)
pindex(BAD_PATTERN)
cindex(globbing, bad pattern)
cindex(filename generation, bad pattern)
item(tt(BAD_PATTERN) (tt(PLUS()2)))(
If a pattern for filename generation is badly formed, print an error message.
(If this option is unset, the pattern will be left unchanged.)
)
pindex(BANG_HIST)
cindex(history, enable substitution)
cindex(enable history substitution)
item(tt(BANG_HIST) (tt(PLUS()K)))(
Perform textual history substitution, bf(csh)-style,
treating the character `tt(!)' specially.
)
pindex(BARE_GLOB_QUAL)
cindex(globbing qualifiers, enable)
cindex(enable globbing qualifiers)
item(tt(BARE_GLOB_QUAL))(
In a glob pattern, treat a trailing set of parentheses as a qualifier
list, if it contains no `tt(|)', `tt(LPAR())' or (if special) `tt(~)'
characters. See noderef(Filename Generation).
)
pindex(BEEP)
cindex(beep, enabling)
cindex(enabling the beep)
item(tt(BEEP) (tt(PLUS()B)))(
Beep on error in ZLE.
)
pindex(BG_NICE)
cindex(jobs, background priority)
cindex(background jobs, priority of)
cindex(priority of background jobs)
item(tt(BG_NICE) (tt(-6)))(
Run all background jobs at a lower priority. This option
is set by default.
)
pindex(BRACE_CCL)
cindex(brace expansion, extending)
cindex(expansion, brace, extending)
item(tt(BRACE_CCL))(
Expand expressions in braces which would not otherwise undergo brace
expansion to a lexically ordered list of all the characters. See
noderef(Brace Expansion).
)
pindex(BSD_ECHO)
cindex(echo, BSD compatible)
item(tt(BSD_ECHO))(
Make the tt(echo) builtin compatible with the BSD manref(echo)(1) command.
This disables backslashed escape sequences in echo strings unless the
tt(-e) option is specified.
)
pindex(CDABLE_VARS)
cindex(cd, to parameter)
item(tt(CDABLE_VARS) (tt(-T)))(
If the argument to a tt(cd) command (or an implied tt(cd) with the
tt(AUTO_CD) option set) is not a directory, and does not begin with a
slash, try to expand the expression as if it were preceded by a `tt(~)' (see
noderef(Filename Expansion)).
)
pindex(CHASE_LINKS)
cindex(links, symbolic)
cindex(symbolic links)
item(tt(CHASE_LINKS) (tt(-w)))(
Resolve symbolic links to their true values when changing directory.
)
pindex(CLOBBER)
cindex(clobbering, of files)
cindex(file clobbering, allowing)
item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)))(
Allows `tt(>)' redirection to truncate existing files,
and `tt(>>)' to create files.
Otherwise `tt(>!)' or `tt(>|)' must be used to truncate a file,
and `tt(>>!)' or `tt(>>|)' to create a file.
)
pindex(COMPLETE_ALIASES)
cindex(aliases, completion of)
item(tt(COMPLETE_ALIASES))(
Prevents aliases on the command line from being internally substituted
before completion is attempted. The effect is to make the alias a
distinct command for completion purposes.
)
pindex(COMPLETE_IN_WORD)
item(tt(COMPLETE_IN_WORD))(
If unset, the cursor is set to the end of the word if completion is
started. Otherwise it stays there and completion is done from both ends.
)
pindex(CORRECT)
cindex(correction, spelling)
cindex(spelling correction)
item(tt(CORRECT) (tt(-0)))(
Try to correct the spelling of commands.
)
pindex(CORRECT_ALL)
item(tt(CORRECT_ALL) (tt(-O)))(
Try to correct the spelling of all arguments in a line.
)
pindex(CSH_JUNKIE_HISTORY)
cindex(csh, history style)
cindex(history style, csh)
item(tt(CSH_JUNKIE_HISTORY))(
A history reference without an event specifier will always refer to the
previous command. Without this option, such a history reference refers
to the same event as the previous history reference, defaulting to the
previous command.
)
pindex(CSH_JUNKIE_LOOPS)
cindex(csh, loop style)
cindex(loop style, csh)
item(tt(CSH_JUNKIE_LOOPS))(
Allow loop bodies to take the form `var(list); tt(end)' instead of
`tt(do) var(list); tt(done)'.
)
pindex(CSH_JUNKIE_QUOTES)
cindex(csh, quoting style)
cindex(quoting style, csh)
item(tt(CSH_JUNKIE_QUOTES))(
Changes the rules for single- and double-quoted text to match that of
bf(csh). These require that embedded newlines be preceded by a backslash;
unescaped newlines will cause an error message.
In double-quoted strings, it is made impossible to escape `tt($)', `tt(`)'
or `tt(")' (and `tt(\)' itself no longer needs escaping).
Command substitutions are only expanded once, and cannot be nested.
)
pindex(CSH_NULL_GLOB)
cindex(csh, null globbing style)
cindex(null globbing style, csh)
cindex(globbing, null, style, csh)
item(tt(CSH_NULL_GLOB))(
If a pattern for filename generation has no matches,
delete the pattern from the argument list;
do not report an error unless all the patterns
in a command have no matches.
Overrides tt(NULL_GLOB).
)
pindex(EQUALS)
cindex(filename substitution, =)
item(tt(EQUALS))(
Perform tt(=) filename substitution.
(See noderef(Filename Expansion).)
)
pindex(ERR_EXIT)
cindex(exit status, trapping)
item(tt(ERR_EXIT) (tt(-e), ksh: tt(-e)))(
If a command has a non-zero exit status, execute the tt(ZERR)
trap, if set, and exit. This is disabled while running initialization
scripts.
)
pindex(EXEC)
cindex(command execution, enabling)
item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)))(
Do execute commands. Without this option, commands are
read and checked for syntax errors, but not executed.
)
pindex(EXTENDED_GLOB)
cindex(globbing, extended)
item(tt(EXTENDED_GLOB))(
Treat the `tt(#)', `tt(~)' and `tt(^)' characters as part of patterns
for filename generation, etc. (An initial unquoted `tt(~)'
always produces named directory expansion.)
)
pindex(EXTENDED_HISTORY)
cindex(history, timestamping)
item(tt(EXTENDED_HISTORY))(
Save beginning and ending timestamps to the history file.
The format of these timestamps is
`tt(:)var(<beginning time>)tt(:)var(<ending time>)tt(:)var(<command>)'.
)
pindex(FLOW_CONTROL)
cindex(flow control)
item(tt(FLOW_CONTROL))(
If this option is unset,
output flow control via start/stop characters (usually assigned to
^S/^Q) is disabled in the shell's editor.
)
pindex(FUNCTION_ARGZERO)
cindex($0, setting)
item(tt(FUNCTION_ARGZERO))(
When executing a shell function or sourcing a script, set tt($0)
temporarily to the name of the function/script.
)
pindex(GLOB)
cindex(globbing, enabling)
cindex(enabling globbing)
item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)))(
Perform filename generation (globbing).
(See noderef(Filename Generation).)
)
pindex(GLOB_ASSIGN)
item(tt(GLOB_ASSIGN))(
If this option is set, filename generation (globbing) is
performed on the right hand side of scalar parameter assignments of
the form `var(name)tt(=)var(pattern) (e.g. `tt(foo=*)').
If the result has more than one word the parameter will become an array
with those words as arguments. This option is provided for backwards
compatibility only: globbing is always performed on the right hand side
of array assignments of the form `var(name)tt(=LPAR())var(value)tt(RPAR())'
(e.g. `tt(foo=(*))') and this form is recommended for clarity;
with this option set, it is not possible to predict whether the result
will be an array or a scalar.
)
pindex(GLOB_COMPLETE)
item(tt(GLOB_COMPLETE))(
When the current word has a glob pattern, do not insert all the words
resulting from the expansion but cycle through them like
tt(MENU_COMPLETE). If no matches are found, a `tt(*)' is added to the end of the
word or inserted at the cursor if tt(COMPLETE_IN_WORD) is set, and expansion
is attempted again. Using patterns works not only for files but for all
completions, such as options, user names, etc.
)
pindex(GLOB_DOTS)
cindex(globbing, of . files)
item(tt(GLOB_DOTS) (tt(-4)))(
Do not require a leading `tt(.)' in a filename to be matched explicitly.
)
pindex(GLOB_SUBST)
item(tt(GLOB_SUBST))(
Treat any characters resulting from parameter substitution as being
eligible for file expansion and filename generation, and any
characters resulting from command substitution as being eligible for
filename generation.
)
pindex(HASH_CMDS)
cindex(hashing, of commands)
cindex(command hashing)
item(tt(HASH_CMDS))(
Note the location of each command the first time it is executed.
Subsequent invocations of the same command will use the
saved location, avoiding a path search.
If this option is unset, no path hashing will be done at all.
)
pindex(HASH_DIRS)
cindex(hashing, of directories)
cindex(directories, hashing)
item(tt(HASH_DIRS))(
Whenever a command is executed, hash the directory containing it,
as well as all directories that occur earlier in the path.
Has no effect if tt(HASH_CMDS) is unset.
)
pindex(HASH_LIST_ALL)
item(tt(HASH_LIST_ALL))(
Whenever a command completion is attempted, make sure the entire
command path is hashed first. This makes the first completion slower.
)
pindex(HIST_ALLOW_CLOBBER)
item(tt(HIST_ALLOW_CLOBBER))(
Add `tt(|)' to output redirections in the history. This allows history
references to clobber files even when tt(CLOBBER) is unset.
)
pindex(HIST_BEEP)
cindex(history beeping)
cindex(beep, history)
item(tt(HIST_BEEP))(
Beep when an attempt is made to access a history entry which
isn't there.
)
pindex(HIST_IGNORE_DUPS)
cindex(history, ignoring duplicates)
item(tt(HIST_IGNORE_DUPS) (tt(-h)))(
Do not enter command lines into the history list
if they are duplicates of the previous event.
)
pindex(HIST_IGNORE_SPACE)
cindex(history, ignoring spaces)
item(tt(HIST_IGNORE_SPACE) (tt(-g)))(
Do not enter command lines into the history list
if any command on the line begins with a blank.
)
pindex(HIST_NO_FUNCTIONS)
item(tt(HIST_NO_FUNCTIONS))(
Do not store function definitions in the history list.
)
pindex(HIST_NO_STORE)
item(tt(HIST_NO_STORE))(
Remove the tt(history) (tt(fc -l)) command from
the history when invoked.
)
pindex(HIST_REDUCE_BLANKS)
item(tt(HIST_REDUCE_BLANKS))(
Remove superfluous blanks from each command line
being added to the history list.
)
pindex(HIST_VERIFY)
cindex(history, verifying substitution)
item(tt(HIST_VERIFY))(
Whenever the user enters a line with history substitution,
don't execute the line directly; instead, perform
history substitution and reload the line into the editing buffer.
)
pindex(HUP)
cindex(jobs, HUP)
item(tt(HUP))(
Send the tt(HUP) signal to running jobs when the
shell exits.
)
pindex(IGNORE_BRACES)
cindex(disabling brace expansion)
cindex(brace expansion, disabling)
cindex(expansion, brace, disabling)
item(tt(IGNORE_BRACES) (tt(-I)))(
Do not perform brace expansion.
)
pindex(IGNORE_EOF)
cindex(EOF, ignoring)
item(tt(IGNORE_EOF) (tt(-7)))(
Do not exit on end-of-file. Require the use
of tt(exit) or tt(logout) instead.
However, ten consecutive EOFs will cause the shell to exit anyway,
to avoid the shell hanging if its tty goes away.
)
pindex(INTERACTIVE)
item(tt(INTERACTIVE) (tt(-i), ksh: tt(-i)))(
This is an interactive shell. This option is set upon initialisation if
the standard input is a tty and commands are being read from standard input.
(See the discussion of tt(SHIN_STDIN).)
This heuristic may be overridden by specifying a state for this option
on the command line.
The value of this option cannot be changed anywhere other than the command line.
)
pindex(INTERACTIVE_COMMENTS)
cindex(comments, in interactive shells)
item(tt(INTERACTIVE_COMMENTS) (tt(-k)))(
Allow comments even in interactive shells.
)
pindex(KSH_ARRAYS)
cindex(arrays, ksh style)
cindex(array style, ksh)
cindex(ksh, array style)
item(tt(KSH_ARRAYS))(
Emulate bf(ksh) array handling as closely as possible. If this option
is set, array elements are numbered from zero, an array parameter
without subscript refers to the first element instead of the whole array,
and braces are required to delimit a subscript (`tt(${path[2]})' rather
than just `tt($path[2])').
)
pindex(KSH_AUTOLOAD)
item(tt(KSH_AUTOLOAD))(
Emulate bf(ksh) function autoloading. This means that when a function is
autoloaded, the corresponding file is merely executed, and must define
the function itself. (By default, the function is defined to the contents
of the file. However, the most common bf(ksh)-style case - of the file
containing only a simple definition of the function - is always handled
in the bf(ksh)-compatible manner.)
)
pindex(KSH_GLOB)
item(tt(KSH_GLOB))(
In pattern matching, the interpretation of parentheses is affected by
a preceding `tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)'.
See noderef(Filename Generation).
)
pindex(KSH_OPTION_PRINT)
cindex(option printing, ksh style)
cindex(option printing style, ksh)
cindex(ksh, option printing style)
item(tt(KSH_OPTION_PRINT))(
Alters the way options settings are printed.
)
pindex(LIST_AMBIGUOUS)
cindex(ambiguous completion)
cindex(completion, ambiguous)
item(tt(LIST_AMBIGUOUS))(
If this option is set, completions are shown only if the completions
don't have a unambiguous prefix or suffix that could be inserted in
the command line.
)
pindex(LIST_BEEP)
cindex(beep, ambiguous completion)
cindex(completion, beep on ambiguous)
item(tt(LIST_BEEP))(
Beep on an ambiguous completion.
)
pindex(LIST_TYPES)
cindex(marking file types)
cindex(files, marking type of)
item(tt(LIST_TYPES) (tt(-X)))(
When listing files that are possible completions, show the
type of each file with a trailing identifying mark.
)
pindex(LOCAL_OPTIONS)
item(tt(LOCAL_OPTIONS))(
If this option is set at the point of return from a shell function,
all the options (including this one) which were in force upon entry to
the function are restored. Otherwise, only this option and the
tt(XTRACE) and tt(PRINT_EXIT_VALUE) options are restored. Hence
if this is explicitly unset by a shell function the other options in
force at the point of return will remain so.
A shell function can also guarantee itself a known shell configuration
with a formulation like `tt(emulate zsh; setopt localoptions)'.
)
pindex(LOGIN)
item(tt(LOGIN) (tt(-l), ksh: tt(-l)))(
This is a login shell.
If this option is not explicitly set, the shell is a login shell if
the first character of the tt(argv[0]) passed to the shell is a `tt(-)'.
)
pindex(LONG_LIST_JOBS)
cindex(jobs, list format)
item(tt(LONG_LIST_JOBS) (tt(-R)))(
List jobs in the long format by default.
)
pindex(MAGIC_EQUAL_SUBST)
item(tt(MAGIC_EQUAL_SUBST))(
All unquoted arguments of the form `var(identifier)tt(=)var(expression)'
appearing after the command name have filename expansion (that is,
where var(expression) has a leading `tt(~)' or `tt(=)') performed on
var(expression) as if it were a parameter assignment. The argument is
not otherwise treated specially; it is passed to the command as a single
argument, and not used as an actual parameter assignment.
)
pindex(MAIL_WARNING)
cindex(mail, warning of reading)
item(tt(MAIL_WARNING) (tt(-U)))(
Print a warning message if a mail file has been
accessed since the shell last checked.
)
pindex(MARK_DIRS)
cindex(directories, marking)
cindex(marking directories)
item(tt(MARK_DIRS) (tt(-8), ksh: tt(-X)))(
Append a trailing `tt(/)' to all directory
names resulting from filename generation (globbing).
)
pindex(MENU_COMPLETE)
cindex(completion, menu)
item(tt(MENU_COMPLETE) (tt(-Y)))(
On an ambiguous completion, instead of listing possibilities or beeping,
insert the first match immediately. Then when completion is requested
again, remove the first match and insert the second match, etc.
When there are no more matches, go back to the first one again.
tt(reverse-menu-complete) may be used to loop through the list
in the other direction. This option overrides tt(AUTO_MENU).
)
pindex(MONITOR)
cindex(job control, allowing)
item(tt(MONITOR) (tt(-m), ksh: tt(-m)))(
Allow job control. Set by default in interactive shells.
)
pindex(MULTIOS)
item(tt(MULTIOS))(
Perform implicit bf(tee)s or bf(cat)s when multiple
redirections are attempted (see noderef(Redirection)).
)
pindex(NOMATCH)
cindex(globbing, no matches)
item(tt(NOMATCH) (tt(PLUS()3)))(
If a pattern for filename generation has no matches,
print an error, instead of
leaving it unchanged in the argument list.
This also applies to file expansion
of an initial `tt(~)' or `tt(=)'.
)
pindex(NOTIFY)
cindex(background jobs, notification)
cindex(notification of background jobs)
item(tt(NOTIFY) (tt(-5), ksh: tt(-b)))(
Report the status of background jobs immediately, rather than
waiting until just before printing a prompt.
)
pindex(NULL_GLOB)
cindex(globbing, no matches)
item(tt(NULL_GLOB) (tt(-G)))(
If a pattern for filename generation has no matches,
delete the pattern from the argument list instead
of reporting an error. Overrides tt(NOMATCH).
)
pindex(NUMERIC_GLOB_SORT)
cindex(globbing, sorting numerically)
item(tt(NUMERIC_GLOB_SORT))(
If numeric filenames are matched by a filename generation pattern,
sort the filenames numerically rather than lexicographically.
)
pindex(OVERSTRIKE)
cindex(editor, overstrike mode)
cindex(overstrike mode, of editor)
item(tt(OVERSTRIKE))(
Start up the line editor in overstrike mode.
)
pindex(PATH_DIRS)
cindex(path search, extended)
item(tt(PATH_DIRS) (tt(-Q)))(
Perform a path search even on command names with slashes in them.
Thus if `tt(/usr/local/bin)' is in the user's path, and he types
`tt(X11/xinit)', the command `tt(/usr/local/bin/X11/xinit)' will be executed
(assuming it exists).
Commands explicitly beginning with `tt(/)', `tt(./)' or `tt(../)'
are not subject to the path search.
This also applies to the tt(.) builtin,
and searches for modules performed by the tt(zmodload) builtin.
)
pindex(POSIX_BUILTINS)
item(tt(POSIX_BUILTINS))(
When this option is set the tt(command) builtin can be used to execute
shell builtin commands. Parameter assignments specified before shell
functions and special builtins are kept after the command completes unless
the special builtin is prefixed with the tt(command) builtin. Special
builtins are
tt(.),
tt(:),
tt(break),
tt(continue),
tt(declare),
tt(eval),
tt(exit),
tt(export),
tt(integer),
tt(local),
tt(readonly),
tt(return),
tt(set),
tt(shift),
tt(source),
tt(times),
tt(trap) and
tt(unset).
)
pindex(PRINT_EIGHT_BIT)
cindex(exit status, printing)
item(tt(PRINT_EIGHT_BIT))(
Print eight bit characters literally in completion lists, etc.
This option is not necessary if your system correctly returns the
printability of eight bit characters (see manref(ctype)(3)).
)
pindex(PRINT_EXIT_VALUE)
cindex(exit status, printing)
item(tt(PRINT_EXIT_VALUE) (tt(-1)))(
Print the exit value of programs with non-zero exit status.
)
pindex(PRIVILEGED)
cindex(privileged mode)
cindex(mode, privileged)
item(tt(PRIVILEGED) (tt(-p), ksh: tt(-p)))(
Turn on privileged mode. This is enabled automatically on startup if the
effective user (group) ID is not equal to the real user (group) ID. Turning
this option off causes the effective user and group IDs to be set to the
real user and group IDs. This option disables sourcing user startup files.
If zsh is invoked as `tt(sh)' or `tt(ksh)' with this option set,
tt(/etc/suid_profile) is sourced (after tt(/etc/profile) on interactive
shells). Sourcing tt(~/.profile) is disabled and the contents of the
tt(ENV) variable is ignored. This option cannot be changed using the
tt(-m) option of tt(setopt) and tt(unsetopt), and changing it inside a
function always changes it globally regardless of the tt(LOCAL_OPTIONS)
option.
)
pindex(PROMPT_BANG)
cindex(prompt, ! expansion)
item(tt(PROMPT_BANG))(
If set, `tt(!)' is treated specially in prompt expansion.
See noderef(Prompt Expansion).
)
pindex(PROMPT_CR)
cindex(prompt, with CR)
item(tt(PROMPT_CR) (tt(PLUS()V)))(
Print a carriage return just before printing
a prompt in the line editor.
)
pindex(PROMPT_PERCENT)
cindex(prompt, % expansion)
item(tt(PROMPT_PERCENT))(
If set, `tt(%)' is treated specially in prompt expansion.
See noderef(Prompt Expansion).
)
pindex(PROMPT_SUBST)
cindex(prompt, parameter expansion)
item(tt(PROMPT_SUBST))(
If set, em(parameter expansion), em(command substitution) and
em(arithmetic expansion) are performed in prompts.
)
pindex(PUSHD_IGNORE_DUPS)
cindex(directory stack, ignoring duplicates)
item(tt(PUSHD_IGNORE_DUPS))(
Don't push multiple copies of the same directory onto the directory stack.
)
pindex(PUSHD_MINUS)
cindex(directory stack, controlling syntax)
item(tt(PUSHD_MINUS))(
Exchanges the meanings of `tt(PLUS())' and `tt(-)'
when used with a number to specify a directory in the stack.
)
pindex(PUSHD_SILENT)
cindex(directory stack, silencing)
item(tt(PUSHD_SILENT) (tt(-E)))(
Do not print the directory stack after tt(pushd) or tt(popd).
)
pindex(PUSHD_TO_HOME)
cindex(pushd, to home)
item(tt(PUSHD_TO_HOME) (tt(-D)))(
Have tt(pushd) with no arguments act like `tt(pushd $HOME)'.
)
pindex(RC_EXPAND_PARAM)
cindex(rc, parameter expansion style)
cindex(parameter expansion style, rc)
item(tt(RC_EXPAND_PARAM) (tt(-P)))(
Array expansions of the form
`var(foo)tt(${)var(xx)tt(})var(bar)', where the parameter
var(xx) is set to tt(LPAR())var(a b c)tt(RPAR()), are substituted with
`var(fooabar foobbar foocbar)' instead of the default
`var(fooa b cbar)'.
)
pindex(RC_QUOTES)
cindex(rc, quoting style)
cindex(quoting style, rc)
item(tt(RC_QUOTES))(
Allow the character sequence `tt('')' to signify a single quote
within singly quoted strings.
)
pindex(RCS)
cindex(startup files, sourcing)
item(tt(RCS) (tt(PLUS()f)))(
After tt(/etc/zshenv) is sourced on startup, source the
tt(.zshenv), tt(/etc/zprofile), tt(.zprofile),
tt(/etc/zshrc), tt(.zshrc), tt(/etc/zlogin), tt(.zlogin), and tt(.zlogout)
files, as described in noderef(Files).
If this option is unset, only the tt(/etc/zshenv) file is sourced.
)
pindex(REC_EXACT)
cindex(completion, exact matches)
item(tt(REC_EXACT) (tt(-S)))(
In completion, recognize exact matches even
if they are ambiguous.
)
pindex(RESTRICTED)
cindex(restricted shell)
item(tt(RESTRICTED) (tt(-r)))(
Enables restricted mode. This option cannot be changed using
tt(unsetopt), and setting it inside a function always changes it
globally regardless of the tt(LOCAL_OPTIONS) option. See
noderef(Restricted Shell).
)
pindex(RM_STAR_SILENT)
cindex(rm *, querying before)
cindex(querying before rm *)
item(tt(RM_STAR_SILENT) (tt(-H)))(
Do not query the user before executing `tt(rm *)' or `tt(rm path/*)'.
)
pindex(RM_STAR_WAIT)
cindex(rm *, waiting before)
cindex(waiting before rm *)
item(tt(RM_STAR_WAIT))(
If querying the user before executing `tt(rm *)' or `tt(rm path/*)',
first wait ten seconds and ignore anything typed in that time.
This avoids the problem of reflexively answering `yes' to the query
when one didn't really mean it. The wait and query can always be
avoided by expanding the `tt(*)' in ZLE (with tab).
)
pindex(SH_FILE_EXPANSION)
cindex(sh, expansion style)
cindex(expansion style, sh)
item(tt(SH_FILE_EXPANSION))(
Perform filename expansion (e.g., ~ expansion) em(before)
parameter expansion, command substitution, arithmetic expansion
and brace expansion.
If this option is unset, it is performed em(after)
brace expansion, so things like `tt(~$USERNAME)' and
`tt(~{pfalstad,rc})' will work.
)
pindex(SH_GLOB)
cindex(sh, globbing style)
cindex(globbing style, sh)
item(tt(SH_GLOB))(
Disables the special meaning of `tt(LPAR())', `tt(|)', `tt(RPAR())'
and 'tt(<)' for globbing the result of parameter and command substitutions,
and in some other places where
the shell accepts patterns. This option is set by default if zsh is
invoked as tt(sh) or tt(ksh).
)
pindex(SHIN_STDIN)
item(tt(SHIN_STDIN) (tt(-s), ksh: tt(-s)))(
Commands are being read from the standard input.
Commands are read from standard input if no command is specified with
tt(-c) and no file of commands is specified. If tt(SHIN_STDIN)
is set explicitly on the command line,
any argument that would otherwise have been
taken as a file to run will instead be treated as a normal positional
parameter.
Note that setting or unsetting this option on the command line does not
necessarily affect the state the option will have while the shell is
running - that is purely an indicator of whether on not commands are
em(actually) being read from standard input.
The value of this option cannot be changed anywhere other than the command line.
)
pindex(SH_OPTION_LETTERS)
cindex(sh, single letter options style)
cindex(ksh, single letter options style)
cindex(single letter options, ksh style)
cindex(options, single letter, ksh style)
item(tt(SH_OPTION_LETTERS))(
If this option is set the shell tries to interpret single letter options
(which are used with tt(set) and tt(setopt)) like bf(ksh) does.
This also affects the value of the tt(-) special parameter.
)
pindex(SHORT_LOOPS)
item(tt(SHORT_LOOPS))(
Allow the short forms of tt(for), tt(select),
tt(if), and tt(function) constructs.
)
pindex(SH_WORD_SPLIT)
cindex(field splitting, sh style)
cindex(sh, field splitting style)
item(tt(SH_WORD_SPLIT) (tt(-y)))(
Causes field splitting to be performed on unquoted parameter expansions.
Note that this option has nothing to do with word splitting.
(See noderef(Parameter Expansion).)
)
pindex(SINGLE_COMMAND)
cindex(single command)
pindex(INTERACTIVE, use of)
item(tt(SINGLE_COMMAND) (tt(-t), ksh: tt(-t)))(
If the shell is reading from standard input, it exits after a single command
has been executed. This also makes the shell non-interactive, unless the
tt(INTERACTIVE) option is explicitly set on the command line.
The value of this option cannot be changed anywhere other than the command line.
)
pindex(SINGLE_LINE_ZLE)
cindex(editor, single line mode)
item(tt(SINGLE_LINE_ZLE) (tt(-M)))(
Use single-line command line editing instead of multi-line.
)
pindex(SUN_KEYBOARD_HACK)
cindex(sun keyboard, annoying)
cindex(annoying keyboard, sun)
item(tt(SUN_KEYBOARD_HACK) (tt(-L)))(
If a line ends with a backquote, and there are an odd number
of backquotes on the line, ignore the trailing backquote.
This is useful on some keyboards where the return key is
too small, and the backquote key lies annoyingly close to it.
)
pindex(UNSET)
cindex(parameters, substituting unset)
cindex(unset parameters, substituting)
item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)))(
Treat unset parameters as if they were empty when substituting.
Otherwise they are treated as an error.
)
pindex(VERBOSE)
cindex(tracing, of input lines)
cindex(input, tracing)
item(tt(VERBOSE) (tt(-v), ksh: tt(-v)))(
Print shell input lines as they are read.
)
pindex(XTRACE)
cindex(tracing, of commands)
cindex(commands, tracing)
item(tt(XTRACE) (tt(-x), ksh: tt(-x)))(
Print commands and their arguments as they are executed.
)
pindex(ZLE)
cindex(editor, enabling)
cindex(enabling the editor)
item(tt(ZLE) (tt(-Z)))(
Use the zsh line editor.
)
enditem()
texinode(Option Aliases)(Single Letter Options)(Description of Options)(Options)
sect(Option Aliases)
cindex(options, aliases)
Some options have alternative names. These aliases are never used for
output, but can be used just like normal option names when specifying
options to the shell.
startitem()
pindex(BRACE_EXPAND)
item(tt(BRACE_EXPAND))(
em(NO_)tt(IGNORE_BRACES)
(ksh and bash compatibility)
)
pindex(DOT_GLOB)
item(tt(DOT_GLOB))(
tt(GLOB_DOTS)
(bash compatibility)
)
pindex(HASH_ALL)
item(tt(HASH_ALL))(
tt(HASH_CMDS)
(bash compatibility)
)
pindex(HIST_APPEND)
item(tt(HIST_APPEND))(
tt(APPEND_HISTORY)
(bash compatibility)
)
pindex(HIST_EXPAND)
item(tt(HIST_EXPAND))(
tt(BANG_HIST)
(bash compatibility)
)
pindex(LOG)
item(tt(LOG))(
em(NO_)tt(HIST_NO_FUNCTIONS)
(ksh compatibility)
)
pindex(MAIL_WARN)
item(tt(MAIL_WARN))(
tt(MAIL_WARNING)
(bash compatibility)
)
pindex(ONE_CMD)
item(tt(ONE_CMD))(
tt(SINGLE_COMMAND)
(bash compatibility)
)
pindex(PHYSICAL)
item(tt(PHYSICAL))(
tt(CHASE_LINKS)
(ksh and bash compatibility)
)
pindex(PROMPT_VARS)
item(tt(PROMPT_VARS))(
tt(PROMPT_SUBST)
(bash compatibility)
)
pindex(STDIN)
item(tt(STDIN))(
tt(SHIN_STDIN)
(ksh compatibility)
)
pindex(TRACK_ALL)
item(tt(TRACK_ALL))(
tt(HASH_CMDS)
(ksh compatibility)
)
enditem()
texinode(Single Letter Options)()(Option Aliases)(Options)
sect(Single Letter Options)
cindex(options, single letter)
cindex(single letter options)
subsect(Default set)
startsitem()
sitem(tt(-0))(CORRECT)
sitem(tt(-1))(PRINT_EXIT_VALUE)
sitem(tt(-2))(em(NO_)BAD_PATTERN)
sitem(tt(-3))(em(NO_)NOMATCH)
sitem(tt(-4))(GLOB_DOTS)
sitem(tt(-5))(NOTIFY)
sitem(tt(-6))(BG_NICE)
sitem(tt(-7))(IGNORE_EOF)
sitem(tt(-8))(MARK_DIRS)
sitem(tt(-9))(AUTO_LIST)
sitem(tt(-B))(em(NO_)BEEP)
sitem(tt(-C))(em(NO_)CLOBBER)
sitem(tt(-D))(PUSHD_TO_HOME)
sitem(tt(-E))(PUSHD_SILENT)
sitem(tt(-F))(em(NO_)GLOB)
sitem(tt(-G))(NULL_GLOB)
sitem(tt(-H))(RM_STAR_SILENT)
sitem(tt(-I))(IGNORE_BRACES)
sitem(tt(-J))(AUTO_CD)
sitem(tt(-K))(em(NO_)BANG_HIST)
sitem(tt(-L))(SUN_KEYBOARD_HACK)
sitem(tt(-M))(SINGLE_LINE_ZLE)
sitem(tt(-N))(AUTO_PUSHD)
sitem(tt(-O))(CORRECT_ALL)
sitem(tt(-P))(RC_EXPAND_PARAM)
sitem(tt(-Q))(PATH_DIRS)
sitem(tt(-R))(LONG_LIST_JOBS)
sitem(tt(-S))(REC_EXACT)
sitem(tt(-T))(CDABLE_VARS)
sitem(tt(-U))(MAIL_WARNING)
sitem(tt(-V))(em(NO_)PROMPT_CR)
sitem(tt(-W))(AUTO_RESUME)
sitem(tt(-X))(LIST_TYPES)
sitem(tt(-Y))(MENU_COMPLETE)
sitem(tt(-Z))(ZLE)
sitem(tt(-a))(ALL_EXPORT)
sitem(tt(-e))(ERR_EXIT)
sitem(tt(-f))(em(NO_)RCS)
sitem(tt(-g))(HIST_IGNORE_SPACE)
sitem(tt(-h))(HIST_IGNORE_DUPS)
sitem(tt(-i))(INTERACTIVE)
sitem(tt(-k))(INTERACTIVE_COMMENTS)
sitem(tt(-l))(LOGIN)
sitem(tt(-m))(MONITOR)
sitem(tt(-n))(em(NO_)EXEC)
sitem(tt(-p))(PRIVILEGED)
sitem(tt(-r))(RESTRICTED)
sitem(tt(-s))(SHIN_STDIN)
sitem(tt(-t))(SINGLE_COMMAND)
sitem(tt(-u))(em(NO_)UNSET)
sitem(tt(-v))(VERBOSE)
sitem(tt(-w))(CHASE_LINKS)
sitem(tt(-x))(XTRACE)
sitem(tt(-y))(SH_WORD_SPLIT)
endsitem()
subsect(sh/ksh emulation set)
startsitem()
sitem(tt(-C))(em(NO_)CLOBBER)
sitem(tt(-X))(MARK_DIRS)
sitem(tt(-a))(ALL_EXPORT)
sitem(tt(-b))(NOTIFY)
sitem(tt(-e))(ERR_EXIT)
sitem(tt(-f))(em(NO_)GLOB)
sitem(tt(-i))(INTERACTIVE)
sitem(tt(-l))(LOGIN)
sitem(tt(-m))(MONITOR)
sitem(tt(-n))(em(NO_)EXEC)
sitem(tt(-p))(PRIVILEGED)
sitem(tt(-r))(RESTRICTED)
sitem(tt(-s))(SHIN_STDIN)
sitem(tt(-t))(SINGLE_COMMAND)
sitem(tt(-u))(em(NO_)UNSET)
sitem(tt(-v))(VERBOSE)
sitem(tt(-x))(XTRACE)
endsitem()
subsect(Also note)
startsitem()
sitem(tt(-A))(Used by tt(set) for setting arrays)
sitem(tt(-c))(Used on the command line to specify a single command)
sitem(tt(-m))(Used by tt(setopt) for pattern-matching option setting)
sitem(tt(-o))(Used in all places to allow use of long option names)
sitem(tt(-s))(Used by tt(set) to sort positional parameters)
endsitem()

812
Doc/Zsh/params.yo Normal file
View File

@ -0,0 +1,812 @@
texinode(Parameters)(Options)(Expansion)(Top)
chapter(Parameters)
cindex(parameters)
sect(Description)
A parameter has a name, a value, and a number of attributes.
A name may be any sequence of alphanumeric
characters and underscores, or the single characters
`tt(*)', `tt(@)', `tt(#)', `tt(?)', `tt(-)', `tt($)', or `tt(!)'.
The value may be a em(scalar) (a string),
an integer, or an array.
To assign a scalar or integer value to a parameter,
use the tt(typeset) builtin.
findex(typeset, use of)
To assign an array value, use `tt(set -A) var(name) var(value) ...'.
findex(set, use of)
The value of a parameter may also be assigned by writing:
nofill(var(name)tt(=)var(value))
If the integer attribute, tt(-i), is set for var(name),
the var(value) is subject to arithmetic evaluation.
In the parameter lists, the mark `<S>' indicates that the parameter is special.
Special parameters cannot have their type changed, and they stay special even
if unset. `<Z>' indicates that the parameter does not exist when the shell
initialises in tt(sh) or tt(ksh) emulation mode.
startmenu()
menu(Local Parameters)
menu(Array Parameters)
menu(Positional Parameters)
menu(Parameters Set By The Shell)
menu(Parameters Used By The Shell)
endmenu()
texinode(Local Parameters)(Array Parameters)()(Parameters)
sect(Local Parameters)
Shell function executions delimit scopes for shell parameters.
(Parameters are dynamically scoped.) The tt(typeset) builtin, and its
alternative forms tt(declare), tt(integer), tt(local) and tt(readonly)
(but not tt(export)), can be used to declare a parameter as being local
to the innermost scope.
When a parameter is read or assigned to, the
innermost existing parameter of that name is used. (That is, the
local parameter hides any less-local parameter.) However, assigning
to a non-existent parameter, or declaring a new parameter with tt(export),
causes it to be created in the em(outer)most scope.
Local parameters disappear when their scope ends.
tt(unset) can be used to delete a parameter while it is still in scope; this
will reveal the next outer parameter of the same name. However, em(special)
parameters are still special when unset.
texinode(Array Parameters)(Positional Parameters)(Local Parameters)(Parameters)
sect(Array Parameters)
The value of an array parameter may be assigned by writing:
nofill(var(name)tt(=LPAR())var(value) ...tt(RPAR()))
Individual elements of an array may be selected using a
subscript. A subscript of the form `tt([)var(exp)tt(])'
selects the single element var(exp), where var(exp) is
an arithmetic expression which will be subject to arithmetic
expansion as if it were surrounded by `tt($LPAR()LPAR())...tt(RPAR()RPAR())'.
The elements are numbered beginning with 1 unless the
tt(KSH_ARRAYS) option is set when they are numbered from zero.
pindex(KSH_ARRAYS, use of)
A subscript of the form `tt([*])' or `tt([@])' evaluates to all
elements of an array; there is no difference between the two
except when they appear within double quotes.
`tt("$foo[*]")' evaluates to `tt("$foo[1] $foo[2] )...tt(")', while
`tt("$foo[@]")' evaluates to `tt("$foo[1]" "$foo[2]")', etc.
A subscript of the form `tt([)var(exp1)tt(,)var(exp2)tt(])'
selects all elements in the range var(exp1) to var(exp2),
inclusive.
If one of the subscripts evaluates to a negative number,
say tt(-)var(n), then the var(n)th element from the end
of the array is used. Thus `tt($foo[-3])' is the third element
from the end of the array tt(foo), and
`tt($foo[1,-1])' is the same as `tt($foo[*])'.
Subscripting may also be performed on non-array values, in which
case the subscripts specify a substring to be extracted.
For example, if tt(FOO) is set to `tt(foobar)', then
`tt(echo $FOO[2,5])' prints `tt(ooba)'.
Subscripts may be used inside braces used to delimit a parameter name, thus
`tt(${foo[2]})' is equivalent to `tt($foo[2])'. If the tt(KSH_ARRAYS)
option is set, the braced form is the only one that will
work, the subscript otherwise not being treated specially.
If a subscript is used on the left side of an assignment the selected
range is replaced by the expression on the right side.
If the opening bracket or the comma is directly followed by an opening
parentheses the string up to the matching closing one is considered to
be a list of flags. The flags currently understood are:
startitem()
item(tt(e))(
this option has no effect and retained for backward compatibility only.
)
item(tt(w))(
if the parameter subscripted is a scalar than this flag makes
subscription work on a per-word basis instead of characters.
)
item(tt(s:)var(string)tt(:))(
this gives the var(string) that separates words (for use with the
tt(w) flag).
)
item(tt(p))(
Recognize the same escape sequences as the tt(print) builtin in
the string argument of a subsequent `tt(s)' flag.
)
item(tt(f))(
if the parameter subscripted is a scalar than this flag makes
subscription work on a per-line basis instead of characters.
This is a shorthand for `tt(pws:\n:)'.
)
item(tt(r))(
if this flag is given the var(exp) is taken as a pattern and the
result is the first matching array element, substring or word (if the
parameter is an array, if it is a scalar, or if it is a scalar and the
`tt(w)' flag is given, respectively); note that this is like giving a
number: `tt($foo[(r))var(??)tt(,3])' and `tt($foo[(r))var(??)tt(,(r)f*])' work.
)
item(tt(R))(
like `tt(r)', but gives the last match.
)
item(tt(i))(
like `tt(r)', but gives the index of the match instead; this may not
be combined with a second argument.
)
item(tt(I))(
like `tt(i), but gives the index of the last match.
)
item(tt(n:)var(expr)tt(:))(
if combined with `tt(r)', `tt(R)', `tt(i)' or `tt(I)', makes them give
the var(n)th or var(n)th last match (if var(expr) evaluates to
var(n)).
)
enditem()
texinode(Positional Parameters)(Parameters Set By The Shell)(Array Parameters)(Parameters)
sect(Positional Parameters)
Positional parameters are set by the shell on invocation,
by the tt(set) builtin, or by direct assignment.
The parameter var(n), where var(n) is a number,
is the var(n)th positional parameter.
The parameters tt(*), tt(@) and tt(argv) are
arrays containing all the positional parameters;
thus `tt($argv[)var(n)tt(])', etc., is equivalent to simply `tt($)var(n)'.
texinode(Parameters Set By The Shell)(Parameters Used By The Shell)(Positional Parameters)(Parameters)
sect(Parameters Set By The Shell)
The following parameters are automatically set by the shell:
startitem()
vindex(!)
item(tt(!) <S>)(
The process ID of the last background command invoked.
)
vindex(#)
item(tt(#) <S>)(
The number of positional parameters in decimal.
)
vindex(ARGC)
item(tt(ARGC) <S> <Z>)(
Same as tt(#).
)
vindex($)
item(tt($) <S>)(
The process ID of this shell.
)
vindex(-)
item(tt(-) <S>)(
Flags supplied to the shell on invocation or by the tt(set)
or tt(setopt) commands.
)
vindex(*)
item(tt(*) <S>)(
An array containing the positional parameters.
)
vindex(argv)
item(tt(argv) <S> <Z>)(
Same as tt(*).
)
vindex(@)
item(tt(@) <S>)(
Same as tt(argv[@]).
)
vindex(?)
item(tt(?) <S>)(
The exit value returned by the last command.
)
vindex(0)
item(tt(0) <S>)(
The name used to invoke the current shell. If the tt(FUNCTION_ARGZERO) option
is set, this is set temporarily within a shell function to the name of the
function, and within a sourced script to the name of the script.
)
vindex(status)
item(tt(status) <S> <Z>)(
Same as tt(?).
)
vindex(_)
item(tt(_) <S>)(
The last argument of the previous command.
Also, this parameter is set in the environment of every command
executed to the full pathname of the command.
)
vindex(EGID)
item(tt(EGID) <S>)(
The effective group ID of the shell process. If you have sufficient
privileges, you may change the effective group ID of the shell
process by assigning to this parameter. Also (assuming sufficient
privileges), you may start a single command with a different
effective group ID by `tt(LPAR()EGID=)var(gid)tt(; command+RPAR())'
)
vindex(EUID)
item(tt(EUID) <S>)(
The effective user ID of the shell process. If you have sufficient
privileges, you may change the effective user ID of the shell process
by assigning to this parameter. Also (assuming sufficient privileges),
you may start a single command with a different
effective user ID by `tt(LPAR()EUID=)var(uid)tt(; command+RPAR())'
)
vindex(ERRNO)
item(tt(ERRNO) <S>)(
The value of errno (see manref(errno)(3))
as set by the most recently failed system call.
This value is system dependent and is intended for debugging
purposes.
)
vindex(GID)
item(tt(GID) <S>)(
The real group ID of the shell process. If you have sufficient privileges,
you may change the group ID of the shell process by assigning to this
parameter. Also (assuming sufficient privileges), you may start a single
command under a different
group ID by `tt(LPAR()GID=)var(gid)tt(; command+RPAR())'
)
vindex(HOST)
item(tt(HOST))(
The current hostname.
)
vindex(LINENO)
item(tt(LINENO) <S>)(
The line number of the current line within the current script
being executed.
)
vindex(LOGNAME)
item(tt(LOGNAME))(
If the corresponding variable is not set in the environment of the
shell, it is initialized to the login name corresponding to the
current login session. This parameter is exported by default but
this can be disabled using the tt(typeset) builtin.
)
vindex(MACHTYPE)
item(tt(MACHTYPE))(
The machine type (microprocessor class or machine model),
as determined at compile time.
)
vindex(OLDPWD)
item(tt(OLDPWD))(
The previous working directory. This is set when the shell initialises
and whenever the directory changes.
)
vindex(OPTARG)
item(tt(OPTARG) <S>)(
The value of the last option argument processed by the tt(getopts)
command.
)
vindex(OPTIND)
item(tt(OPTIND) <S>)(
The index of the last option argument processed by the tt(getopts)
command.
)
vindex(OSTYPE)
item(tt(OSTYPE))(
The operating system, as determined at compile time.
)
vindex(PPID)
item(tt(PPID) <S>)(
The process ID of the parent of the shell.
)
vindex(PWD)
item(tt(PWD))(
The present working directory. This is set when the shell initialises
and whenever the directory changes.
)
vindex(RANDOM)
item(tt(RANDOM) <S>)(
A random integer from 0 to 32767, newly generated each time
this parameter is referenced. The random number generator
can be seeded by assigning a numeric value to tt(RANDOM).
)
vindex(SECONDS)
item(tt(SECONDS) <S>)(
The number of seconds since shell invocation. If this parameter
is assigned a value, then the value returned upon reference
will be the value that was assigned plus the number of seconds
since the assignment.
)
vindex(SHLVL)
item(tt(SHLVL) <S>)(
Incremented by one each time a new shell is started.
)
vindex(signals)
item(tt(signals))(
An array containing the names of the signals.
)
vindex(TTY)
item(tt(TTY))(
The name of the tty associated with the shell, if any.
)
vindex(TTYIDLE)
item(tt(TTYIDLE) <S>)(
The idle time of the tty associated with the shell in seconds or -1 if there
is no such tty.
)
vindex(UID)
item(tt(UID) <S>)(
The real user ID of the shell process. If you have sufficient privileges,
you may change the user ID of the shell by assigning to this parameter.
Also (assuming sufficient privileges), you may start a single command
under a different
user ID by `tt(LPAR()UID=)var(uid)tt(; command+RPAR())'
)
vindex(USERNAME)
item(tt(USERNAME) <S>)(
The username corresponding to the real user ID of the shell process. If you
have sufficient privileges, you may change the username (and also the
user ID and group ID) of the shell by assigning to this parameter.
Also (assuming sufficient privileges), you may start a single command
under a different username (and user ID and group ID)
by `tt(LPAR()USERNAME=)var(username)tt(; command+RPAR())'
)
vindex(VENDOR)
item(tt(VENDOR))(
The vendor, as determined at compile time.
)
vindex(ZSH_NAME)
item(tt(ZSH_NAME))(
Expands to the basename of the command used to invoke this instance
of zsh.
)
vindex(ZSH_VERSION)
item(tt(ZSH_VERSION))(
The version number of this zsh.
)
enditem()
texinode(Parameters Used By The Shell)()(Parameters Set By The Shell)(Parameters)
sect(Parameters Used By The Shell)
The following parameters are used by the shell:
startitem()
vindex(ARGV0)
item(tt(ARGV0))(
If exported, its value is used as tt(argv[0]) of external commands.
Usually used in constructs like `tt(ARGV0=emacs nethack)'.
)
vindex(BAUD)
item(tt(BAUD))(
The baud rate of the current connection. Used by the line editor
update mechanism to compensate for a slow terminal by delaying
updates until necessary. This may be profitably set to a lower value
in some circumstances, e.g.
for slow modems dialing into a communications server which is connected
to a host via a fast link; in this case, this variable
would be set by default to the speed of the fast link, and not
the modem.
This parameter should be set to the baud
rate of the slowest part of the link for best performance. The compensation
mechanism can be turned off by setting the variable to zero.
)
vindex(cdpath)
vindex(CDPATH)
item(tt(cdpath) <S> <Z> (tt(CDPATH) <S>))(
An array (colon-separated list)
of directories specifying the search path for the tt(cd) command.
)
vindex(COLUMNS)
item(tt(COLUMNS) <S>)(
The number of columns for this terminal session.
Used for printing select lists and for the line editor.
)
vindex(DIRSTACKSIZE)
item(tt(DIRSTACKSIZE))(
The maximum size of the directory stack. If the
stack gets larger than this, it will be truncated automatically.
This is useful with the tt(AUTO_PUSHD) option.
pindex(AUTO_PUSHD, use of)
)
vindex(FCEDIT)
item(tt(FCEDIT))(
The default editor for the tt(fc) builtin.
)
vindex(fignore)
vindex(FIGNORE)
item(tt(fignore) <S> <Z> (tt(FIGNORE) <S>))(
An array (colon separated list)
containing the suffixes of files to be ignored
during filename completion. However, if the completion generates only files
which would match if this variable would be ignored, than these files are
completed anyway.
)
vindex(fpath)
vindex(FPATH)
item(tt(fpath) <S> <Z> (tt(FPATH) <S>))(
An array (colon separated list)
of directories specifying the search path for
function definitions. This path is searched when a function
with the tt(-u) attribute is referenced. If an executable
file is found, then it is read and executed in the current environment.
)
vindex(histchars)
item(tt(histchars) <S>)(
Three characters used by the shell's history and lexical analysis
mechanism. The first character signals the start of a history
substitution (default `tt(!)'). The second character signals the
start of a quick history substitution (default `tt(^)'). The third
character is the comment character (default `tt(#)').
)
vindex(HISTCHARS)
item(tt(HISTCHARS) <S> <Z>)(
Same as tt(histchars). (Deprecated.)
)
vindex(HISTFILE)
item(tt(HISTFILE))(
The file to save the history in when an interactive shell exits.
If unset, the history is not saved.
)
vindex(HISTSIZE)
item(tt(HISTSIZE) <S>)(
The maximum size of the history list.
)
vindex(HOME)
item(tt(HOME) <S>)(
The default argument for the tt(cd) command.
)
vindex(IFS)
item(tt(IFS) <S>)(
Internal field separators (by default space, tab, newline and NUL), that
are used to separate words which result from
command or parameter substitution and words read by
the tt(read) builtin. Any characters from the set space, tab and
newline that appear in the IFS are called em(IFS white space).
One or more IFS white space characters or one non-IFS white space
character together with any adjacent IFS white space character delimit
a field. If an IFS white space character appears twice consecutively
in the IFS, this character is treated as if it were not an IFS white
space character.
)
vindex(KEYTIMEOUT)
item(tt(KEYTIMEOUT))(
The time the shell waits, in hundredths of seconds, for another key to
be pressed when reading bound multi-character sequences.
)
vindex(LANG)
item(tt(LANG) <S>)(
This variable determines the locale category for any category not
specifically selected via a variable starting with `tt(LC_)'.
)
vindex(LC_ALL)
item(tt(LC_ALL) <S>)(
This variable overrides the value of the `tt(LANG)' variable and the value
of any of the other variables starting with `tt(LC_)'.
)
vindex(LC_COLLATE)
item(tt(LC_COLLATE) <S>)(
This variable determines the locale category for character collation
information within ranges in glob brackets and for sorting.
)
vindex(LC_CTYPE)
item(tt(LC_CTYPE) <S>)(
This variable determines the locale category for character handling
functions.
)
vindex(LC_MESSAGES)
item(tt(LC_MESSAGES) <S>)(
This variable determines the language in which messages should be
written. Note that zsh does not use message catalogs.
)
vindex(LC_TIME)
item(tt(LC_TIME) <S>)(
This variable determines the locale category for date and time
formatting in prompt escape sequences.
)
vindex(LINES)
item(tt(LINES) <S>)(
The number of lines for this terminal session.
Used for printing select lists and for the line editor.
)
vindex(LISTMAX)
item(tt(LISTMAX))(
In the line editor, the number of filenames to list without asking first.
If set to zero, the shell asks only if the top of the listing would scroll
off the screen.
)
vindex(LOGCHECK)
item(tt(LOGCHECK))(
The interval in seconds between checks for login/logout activity
using the tt(watch) parameter.
)
vindex(MAIL)
item(tt(MAIL))(
If this parameter is set and tt(mailpath) is not set,
the shell looks for mail in the specified file.
)
vindex(MAILCHECK)
item(tt(MAILCHECK))(
The interval in seconds between checks for new mail.
)
vindex(mailpath)
vindex(MAILPATH)
item(tt(mailpath) <S> <Z> (tt(MAILPATH) <S>))(
An array (colon-separated list) of filenames to check for
new mail. Each filename can be followed by a `tt(?)' and a
message that will be printed. The message will undergo
parameter expansion, command substitution and arithmetic
substitution with the variable tt($_) defined as the name
of the file that has changed. The default message is
`tt(You have new mail)'. If an element is a directory
instead of a file the shell will recursively check every
file in every subdirectory of the element.
)
vindex(manpath)
vindex(MANPATH)
item(tt(manpath) <S> <Z> (tt(MANPATH) <S> <Z>))(
An array (colon-separated list)
whose value is not used by the shell. The tt(manpath)
array can be useful, however, since setting it also sets
tt(MANPATH), and vice versa.
)
vindex(module_path)
vindex(MODULE_PATH)
item(tt(module_path) <S> <Z> (tt(MODULE_PATH) <S>))(
An array (colon-separated list)
of directories that tt(zmodload)
searches for dynamically loadable modules.
This is initialised to a standard pathname,
usually `tt(/usr/local/lib/zsh/$ZSH_VERSION)'.
(The `tt(/usr/local/lib)' part varies from installation to installation.)
For security reasons, any value set in the environment when the shell
is started will be ignored.
These parameters only exist if the installation supports dynamic
module loading.
)
vindex(NULLCMD)
cindex(null command style)
cindex(csh, null command style)
cindex(ksh, null command style)
item(tt(NULLCMD) <S>)(
The command name to assume if a redirection is specified
with no command. Defaults to tt(cat). For bf(sh)/bf(ksh)
behavior, change this to tt(:). For bf(csh)-like
behavior, unset this parameter; the shell will print an
error message if null commands are entered.
)
vindex(path)
vindex(PATH)
item(tt(path) <S> <Z> (tt(PATH) <S>))(
An array (colon-separated list)
of directories to search for commands.
When this parameter is set, each directory is scanned
and all files found are put in a hash table.
)
vindex(POSTEDIT)
item(tt(POSTEDIT) <S>)(
This string is output whenever the line editor exits.
It usually contains termcap strings to reset the terminal.
)
vindex(PS1)
item(tt(PS1) <S>)(
The primary prompt string, printed before a command is read.
the default is `tt(%m%# )'. It undergoes a special form of expansion
before being displayed; see noderef(Prompt Expansion).
)
vindex(PS2)
item(tt(PS2) <S>)(
The secondary prompt, printed when the shell needs more information
to complete a command.
It is expanded in the same way as tt(PS1).
The default is `tt(%_> )', which displays any shell constructs or quotation
marks which are currently being processed.
)
vindex(PS3)
item(tt(PS3) <S>)(
Selection prompt used within a tt(select) loop.
It is expanded in the same way as tt(PS1).
The default is `tt(?# )'.
)
vindex(PS4)
item(tt(PS4) <S>)(
The execution trace prompt. Default is `tt(PLUS() )'.
)
vindex(PROMPT)
xitem(tt(PROMPT) <S> <Z>)
vindex(PROMPT2)
xitem(tt(PROMPT2) <S> <Z>)
vindex(PROMPT3)
xitem(tt(PROMPT3) <S> <Z>)
vindex(PROMPT4)
item(tt(PROMPT4) <S> <Z>)(
Same as tt(PS1), tt(PS2), tt(PS3) and tt(PS4),
respectively.
)
vindex(psvar)
vindex(PSVAR)
item(tt(psvar) <S> <Z> (tt(PSVAR) <S>))(
An array (colon-separated list) whose first nine values can be used in
tt(PROMPT) strings. Setting tt(psvar) also sets tt(PSVAR), and
vice versa.
)
vindex(prompt)
item(tt(prompt) <S> <Z>)(
Same as tt(PS1).
)
vindex(READNULLCMD)
item(tt(READNULLCMD) <S>)(
The command name to assume if a single input redirection
is specified with no command. Defaults to tt(more).
)
vindex(REPORTTIME)
item(tt(REPORTTIME))(
If nonnegative, commands whose combined user and system execution times
(measured in seconds) are greater than this value have timing
statistics printed for them.
)
vindex(RPROMPT)
xitem(tt(RPROMPT) <S>)
vindex(RPS1)
item(tt(RPS1) <S>)(
This prompt is displayed on the right-hand side of the screen
when the primary prompt is being displayed on the left.
This does not work if the tt(SINGLELINEZLE) option is set.
It is expanded in the same way as tt(PS1).
)
vindex(SAVEHIST)
item(tt(SAVEHIST))(
The maximum number of history events to save in the history file.
)
vindex(SPROMPT)
item(tt(SPROMPT) <S>)(
The prompt used for spelling correction. The sequence
`tt(%R)' expands to the string which presumably needs spelling
correction, and `tt(%r)' expands to the proposed correction.
All other prompt escapes are also allowed.
)
vindex(STTY)
item(tt(STTY))(
If this parameter is set in a command's environment, the shell runs the
tt(stty) command with the value of this parameter as arguments in order to
set up the terminal before executing the command. The modes apply only to the
command, and are reset when it finishes or is suspended. If the command is
suspended and continued later with the tt(fg) or tt(wait) builtins it will
see the modes specified by tt(STTY), as if it were not suspended. This
(intentionally) does not apply if the command is continued via `tt(kill -CONT)'.
tt(STTY) is ignored if the command is run in the background, or if it is in the
environment of the shell but not explicitly assigned to in the input line. This
avoids running stty at every external command by accidentally exporting it.
Also note that tt(STTY) should not be used for window size specifications; these
will not be local to the command.
)
vindex(TERM)
item(tt(TERM) <S>)(
The type of terminal in use. This is used when looking up termcap sequences.
)
vindex(TIMEFMT)
item(tt(TIMEFMT))(
The format of process time reports with the tt(time) keyword.
The default is `tt(%E real %U user %S system %P %J)'.
Recognizes the following escape sequences:
startsitem()
sitem(tt(%%))(A `tt(%)'.)
sitem(tt(%U))(CPU seconds spent in user mode.)
sitem(tt(%S))(CPU seconds spent in kernel mode.)
sitem(tt(%E))(Elapsed time in seconds.)
sitem(tt(%P))(The CPU percentage, computed as (tt(%U)PLUS()tt(%S))/tt(%E).)
sitem(tt(%J))(The name of this job.)
endsitem()
A star may be inserted between the percent sign and flags printing time.
This cause the time to be printed in
`var(hh)tt(:)var(mm)tt(:)var(ss)tt(.)var(ttt)'
format (hours and minutes are only printed if they are not zero).
)
vindex(TMOUT)
item(tt(TMOUT))(
If this parameter is nonzero, the shell will receive an tt(ALRM)
signal if a command is not entered within the specified number of
seconds after issuing a prompt. If there is a trap on tt(SIGALRM), it
will be executed and a new alarm is scheduled using the value of the
tt(TMOUT) parameter after executing the trap. If no trap is set, and
the idle time of the terminal is not less than the value of the
tt(TMOUT) parameter, zsh terminates. Otherwise a new alarm is
scheduled to tt(TMOUT) seconds after the last keypress.
)
vindex(TMPPREFIX)
item(tt(TMPPREFIX))(
A pathname prefix which the shell will use for all temporary files.
Note that this should include an initial part for the file name as
well as any directory names. The default is `tt(/tmp/zsh)'.
)
vindex(watch)
vindex(WATCH)
item(tt(watch) <S> <Z> (tt(WATCH) <S>))(
An array (colon-separated list) of login/logout events to report.
If it contains the single word `tt(all)', then all login/logout events
are reported. If it contains the single word `tt(notme)', then all
events are reported as with `tt(all)' except tt($USERNAME).
An entry in this list may consist of a username,
an `tt(@)' followed by a remote hostname,
and a `tt(%)' followed by a line (tty).
Any or all of these components may be present in an entry;
if a login/logout event matches all of them,
it is reported.
)
vindex(WATCHFMT)
item(tt(WATCHFMT))(
The format of login/logout reports if the tt(watch) parameter is set.
Default is `tt(%n has %a %l from %m)'.
Recognizes the following escape sequences:
startitem()
item(tt(%n))(
The name of the user that logged in/out.
)
item(tt(%a))(
The observed action, i.e. "logged on" or "logged off".
)
item(tt(%l))(
The line (tty) the user is logged in on.
)
item(tt(%M))(
The full hostname of the remote host.
)
item(tt(%m))(
The hostname up to the first `tt(.)'. If only the
IP address is available or the utmp field contains
the name of an X-windows display, the whole name is printed.
em(NOTE:)
The `tt(%m)' and `tt(%M)' escapes will work only if there is a host name
field in the utmp on your machine. Otherwise they are
treated as ordinary strings.
)
item(tt(%S) LPAR()tt(%s)RPAR())(
Start (stop) standout mode.
)
item(tt(%U) LPAR()tt(%u)RPAR())(
Start (stop) underline mode.
)
item(tt(%B) LPAR()tt(%b)RPAR())(
Start (stop) boldface mode.
)
xitem(tt(%t))
item(tt(%@))(
The time, in 12-hour, am/pm format.
)
item(tt(%T))(
The time, in 24-hour format.
)
item(tt(%w))(
The date in `var(day)tt(-)var(dd)' format.
)
item(tt(%W))(
The date in `var(mm)tt(/)var(dd)tt(/)var(yy)' format.
)
item(tt(%D))(
The date in `var(yy)tt(-)var(mm)tt(-)var(dd)' format.
)
item(tt(%LPAR())var(x)tt(:)var(true-text)tt(:)var(false-text)tt(RPAR()))(
Specifies a ternary expression.
The character following the var(x) is
arbitrary; the same character is used to separate the text
for the "true" result from that for the "false" result.
Both the separator and the right parenthesis may be escaped
with a backslash.
Ternary expressions may be nested.
The test character var(x) may be any one of `tt(l)', `tt(n)', `tt(m)'
or `tt(M)', which indicate a `true' result if the corresponding
escape sequence would return a non-empty value; or it may be `tt(a)',
which indicates a `true' result if the watched user has logged in,
or `false' if he has logged out.
Other characters evaluate to neither true nor false; the entire
expression is omitted in this case.
If the result is `true', then the var(true-text)
is formatted according to the rules above and printed,
and the var(false-text) is skipped.
If `false', the var(true-text) is skipped and the var(false-text)
is formatted and printed.
Either or both of the branches may be empty, but
both separators must be present in any case.
)
enditem()
)
vindex(WORDCHARS)
item(tt(WORDCHARS) <S>)(
A list of non-alphanumeric characters considered part of a word
by the line editor.
)
vindex(ZDOTDIR)
item(tt(ZDOTDIR))(
The directory to search for shell startup files (.zshrc, etc),
if not tt($HOME).
)
enditem()

209
Doc/Zsh/prompt.yo Normal file
View File

@ -0,0 +1,209 @@
texinode(Prompt Expansion)(Restricted Shell)(Compatibility)(Top)
chapter(Prompt Expansion)
ifzman(\
sect(Prompt Expansion)
)\
Prompt sequences undergo a special form of expansion. This type of expansion
is also available using the tt(-P) option to the tt(print) builtin.
pindex(PROMPT_SUBST, use of)
If the tt(PROMPT_SUBST) option is set, the prompt string is first subjected to
em(parameter expansion),
em(command substitution) and
em(arithmetic expansion).
See
ifzman(\
zmanref(zshexpn).
)\
ifnzman(\
noderef(Expansion).
)\
Certain escape sequences may be recognised in the prompt string.
pindex(PROMPT_BANG, use of)
If the tt(PROMPT_BANG) option is set, a `tt(!)' in the prompt is replaced
by the current history event number. A literal `tt(!)' may then be
represented as `tt(!!)'.
pindex(PROMPT_PERCENT, use of)
If the tt(PROMPT_PERCENT) option is set, certain escape sequences that
start with `tt(%)' are expanded.
Some escapes take an optional integer argument, which
should appear between the `tt(%)' and the next character of the
sequence. The following escape sequences are recognized:
startitem()
item(tt(%%))(
A `tt(%)'.
)
item(tt(%RPAR()))(
A `tt(RPAR())'.
)
xitem(tt(%d))
item(tt(%/))(
Present working directory (tt($PWD)).
)
item(tt(%~))(
tt($PWD).
If it has a named directory as its prefix, that part is replaced
by a `tt(~)' followed by the name of the directory.
If it starts with tt($HOME), that part is
replaced by a `tt(~)'.
)
xitem(tt(%c))
xitem(tt(%.))
item(tt(%C))(
Trailing component of tt($PWD).
An integer may follow the `tt(%)' to get more than one component.
Unless `tt(%C)' is used, tilde contraction is performed first.
)
xitem(tt(%h))
item(tt(%!))(
Current history event number.
)
item(tt(%L))(
The current value of tt($SHLVL).
)
item(tt(%M))(
The full machine hostname.
)
item(tt(%m))(
The hostname up to the first `tt(.)'.
An integer may follow the `tt(%)' to specify
how many components of the hostname are desired.
)
item(tt(%S) LPAR()tt(%s)RPAR())(
Start (stop) standout mode.
)
item(tt(%U) LPAR()tt(%u)RPAR())(
Start (stop) underline mode.
)
item(tt(%B) LPAR()tt(%b)RPAR())(
Start (stop) boldface mode.
)
xitem(tt(%t))
item(tt(%@))(
Current time of day, in 12-hour, am/pm format.
)
item(tt(%T))(
Current time of day, in 24-hour format.
)
item(tt(%*))(
Current time of day in 24-hour format, with seconds.
)
item(tt(%n))(
tt($USERNAME).
)
item(tt(%w))(
The date in var(day)tt(-)var(dd) format.
)
item(tt(%W))(
The date in var(mm)tt(/)var(dd)tt(/)var(yy) format.
)
item(tt(%D))(
The date in var(yy)tt(-)var(mm)tt(-)var(dd) format.
)
item(tt(%D{)var(string)tt(}))(
var(string) is formatted using the tt(strftime) function.
See manref(strftime)(3) for more details. Three additional codes are
available: tt(%f) prints the day of the month, like tt(%e) but
without any preceding space if the day is a single digit, and
tt(%K)/tt(%L) correspond to tt(%k)/tt(%l) for the hour of the day
(24/12 hour clock) in the same way.
)
item(tt(%l))(
The line (tty) the user is logged in on.
)
item(tt(%?))(
The return code of the last command executed just before the prompt.
)
item(tt(%_))(
The status of the parser, i.e. the shell constructs (like `tt(if)' and
`tt(for)') that have been started on the command line. If given an integer
number that many strings will be printed; zero or no integer means
print as many as there are.
)
item(tt(%E))(
Clears to end of line.
)
item(tt(%#))(
A `tt(#)' if the shell is running with privileges, a `tt(%)' if not.
Equivalent to `tt(%(!.#.%%))'.
The definition of `privileged', for these purposes, is that either the
effective user ID is zero, or, if POSIX.1e capabilities are supported, that
at least one capability is raised in either the Effective or Inheritable
capability vectors.
)
item(tt(%v))(
vindex(psvar, use of)
The value of the first element of the tt(psvar) array parameter. Following
the `tt(%)' with an integer gives that element of the array.
)
item(tt(%{)...tt(%}))(
Include a string as a literal escape sequence.
The string within the braces should not change the cursor
position. Brace pairs can nest.
)
item(tt(%LPAR())var(x.true-text.false-text)tt(RPAR()))(
Specifies a ternary expression. The character following the var(x) is
arbitrary; the same character is used to separate the text for the
`true' result from that for the `false' result.
This separator may not appear in the var(true-text), except as part of a
%-escape
sequence. A `tt(RPAR())' may appear in the var(false-text) as `tt(%RPAR())'.
var(true-text)
and var(false-text) may both contain arbitrarily-nested escape
sequences, including further ternary expressions.
The left
parenthesis may be preceded or followed by a positive integer var(n),
which defaults to zero. The test character var(x) may be any of the
following:
startsitem()
sxitem(tt(c))
sxitem(tt(.))
sitem(tt(~))(True if the current path, with prefix replacement, has at least var(n) elements.)
sxitem(tt(/))
sitem(tt(C))(True if the current absolute path has at least var(n) elements.)
sitem(tt(t))(True if the time in minutes is equal to var(n).)
sitem(tt(T))(True if the time in hours is equal to var(n).)
sitem(tt(d))(True if the day of the month is equal to var(n).)
sitem(tt(D))(True if the month is equal to var(n) (January = 0).)
sitem(tt(w))(True if the day of the week is equal to var(n) (Sunday = 0).)
sitem(tt(?))(True if the exit status of the last command was var(n).)
sitem(tt(#))(True if the effective uid of the current process is var(n).)
sitem(tt(g))(True if the effective gid of the current process is var(n).)
sitem(tt(L))(True if the tt(SHLVL) parameter is at least var(n).)
sitem(tt(S))(True if the tt(SECONDS) parameter is at least var(n).)
sitem(tt(v))(True if the array tt(psvar) has at least var(n) elements.)
sitem(tt(_))(True if at least var(n) shell constructs were started.)
sitem(tt(!))(True if the shell is running with privileges.)
endsitem()
)
xitem(tt(%<)var(string)tt(<))
xitem(tt(%>)var(string)tt(>))
item(tt(%[)var(xstring)tt(]))(
Specifies truncation behaviour.
The third, deprecated, form is equivalent to `tt(%)var(xstringx)',
i.e. var(x) may be `tt(<)' or `tt(>)'.
The numeric argument, which in the third form may appear immediately
after the `tt([)', specifies the maximum permitted length of
the various strings that can be displayed in the prompt. If this
integer is zero, or missing, truncation is disabled. Truncation is
initially disabled.
The var(string) will be displayed in
place of the truncated portion of any string.
The forms with `tt(<)' truncate at the left of the string,
and the forms with `tt(>)' truncate at the right of the string.
For example, if the current directory is `tt(/home/pike)',
the prompt `tt(%8<..<%/)' will expand to `tt(..e/pike)'.
In this string, the terminating character (`tt(<)', `tt(>)' or `tt(])'),
or in fact any character, may be quoted by a preceding `tt(\)'.
% escapes are em(not) recognised.
If the var(string) is longer than the specified truncation length,
it will appear in full, completely replacing the truncated string.
)
enditem()

183
Doc/Zsh/redirect.yo Normal file
View File

@ -0,0 +1,183 @@
texinode(Redirection)(Command Execution)(Shell Grammar)(Top)
chapter(Redirection)
cindex(redirection)
ifzman(\
sect(Redirection)
)\
cindex(file descriptors)
cindex(descriptors, file)
If a command is followed by tt(&)
and job control is not active,
then the default standard input
for the command is the empty file tt(/dev/null).
Otherwise, the environment for the execution of a command contains the
file descriptors of the invoking shell as modified by
input/output specifications.
The following may appear anywhere in a simple command
or may precede or follow a complex command.
Substitution occurs before var(word) or var(digit)
is used except as noted below.
If the result of substitution on var(word)
produces more than one filename,
redirection occurs for each
separate filename in turn.
startitem()
item(tt(<) var(word))(
Open file var(word) for reading as standard input.
)
item(tt(<>) var(word))(
Open file var(word) for reading and writing as standard input.
If the file does not exist then it is created.
)
item(tt(>) var(word))(
Open file var(word) for writing as standard output.
If the file does not exist then it is created.
If the file exists, and the tt(CLOBBER) option is unset,
this causes an error;
otherwise, it is truncated to zero length.
)
xitem(tt(>|) var(word))
item(tt(>!) var(word))(
Same as tt(>), except that the file is truncated to zero length
if it exists, even if tt(CLOBBER) is unset.
)
item(tt(>>) var(word))(
Open file var(word) for writing in append mode as standard output.
If the file does not exist, and the tt(CLOBBER)
option is unset, this causes an error;
otherwise, the file is created.
)
xitem(tt(>>|) var(word))
item(tt(>>!) var(word))(
Same as tt(>>), except that the file is created if it does not
exist, even if tt(CLOBBER) is unset.
)
item(tt(<<)[tt(-)] var(word))(
The shell input is read up to a line that is the same as
var(word), or to an end-of-file.
No parameter substitution, command substitution or
filename generation is performed on var(word).
The resulting document, called a
em(here-document), becomes the standard input.
If any character of var(word) is quoted with
single or double quotes or a `tt(\)',
no interpretation is placed upon the characters of the document.
Otherwise, parameter and command substitution
occurs, `tt(\)' followed by a newline is removed,
and `tt(\)' must be used to quote the characters
`tt(\)', `tt($)', `tt(`)' and the first character of var(word).
If tt(<<-) is used, then all leading
tabs are stripped from var(word) and from the document.
)
item(tt(<<<) var(word))(
Perform shell expansion on var(word) and pass the result
to standard input. This is known as a em(here-string).
)
xitem(tt(<&) var(digit))
item(tt(>&) var(digit))(
The standard input/output is duplicated from file descriptor
var(digit) (see manref(dup)(2)).
)
xitem(tt(<& -))
item(tt(>& -))(
Close the standard input/output.
)
xitem(tt(<& p))
item(tt(>& p))(
The input/output from/to the coprocess is moved to the standard input/output.
)
item(tt(>&) var(word))(
Same as `tt(>) var(word) tt(2>&1)'.
)
item(tt(>>&) var(word))(
Same as `tt(>>) var(word) tt(2>&1)'.
)
enditem()
If one of the above is preceded by a digit, then the file
descriptor referred to is that specified by the digit
instead of the default 0 or 1.
The order in which redirections are specified is significant.
The shell evaluates each redirection in terms of the
(em(file descriptor), em(file))
association at the time of evaluation.
For example:
nofill(... tt(1>)var(fname) tt(2>&1))
first associates file descriptor 1 with file var(fname).
It then associates file descriptor 2 with the file associated with file
descriptor 1 (that is, var(fname)).
If the order of redirections were reversed,
file descriptor 2 would be associated
with the terminal (assuming file descriptor 1 had been)
and then file descriptor 1 would be associated with file var(fname).
sect(Multios)
pindex(MULTIOS, use of)
If the user tries to open a file descriptor for writing more than once,
the shell opens the file descriptor as a pipe to a process that copies
its input to all the specified outputs, similar to bf(tee),
provided the tt(MULTIOS) option is set. Thus:
nofill(tt(date >foo >bar))
writes the date to two files, named `tt(foo)' and `tt(bar)'.
Note that a pipe is an implicit redirection; thus
nofill(tt(date >foo | cat))
writes the date to the file `tt(foo)', and also pipes it to cat.
If the tt(MULTIOS)
option is set, the word after a redirection operator is also subjected
to filename generation (globbing). Thus
nofill(tt(: > *))
will truncate all files in the current directory,
assuming there's at least one. (Without the tt(MULTIOS)
option, it would create an empty file called `tt(*)'.)
Similarly, you can do
nofill(tt(echo exit 0 >> *.sh))
If the user tries to open a file descriptor for reading more than once,
the shell opens the file descriptor as a pipe to a process that copies
all the specified inputs to its output in the order
specified, similar to bf(cat),
provided the tt(MULTIOS) option is set. Thus
nofill(tt(sort <foo <fubar))
or even
nofill(tt(sort <f{oo,ubar}))
is equivalent to `tt(cat foo fubar | sort)'.
Note that a pipe is an implicit redirection; thus
nofill(tt(cat bar | sort <foo))
is equivalent to `tt(cat bar foo | sort)' (note the order of the inputs).
If the tt(MULTIOS) option is em(un)set,
each redirection replaces the previous redirection for that file descriptor.
However, all files redirected to are actually opened, so
nofill(tt(echo foo > bar > baz))
when tt(MULTIOS) is unset will truncate bar, and write `tt(foo)' into baz.
If a simple command consists of one or more redirection operators
and zero or more parameter assignments, but no command name,
the command named in the shell variable tt(READNULLCMD) is assumed.
(If tt(READNULLCMD) is empty or not set, `tt(cat)' is used.) Thus
nofill(tt(< file))
prints the contents of tt(file).

44
Doc/Zsh/restricted.yo Normal file
View File

@ -0,0 +1,44 @@
texinode(Restricted Shell)(Expansion)(Prompt Expansion)(Top)
chapter(Restricted Shell)
ifzman(\
sect(Restricted Shell)
)\
cindex(restricted shell)
pindex(RESTRICTED)
When the basename of the command used to invoke zsh starts with the letter
`tt(r)' or the `tt(-r)' command line option is supplied at invocation, the
shell becomes restricted. Emulation mode is determined after stripping the
letter `tt(r)' from the invocation name. The following are disabled in
restricted mode:
startitemize()
itemiz(changing directories with the tt(cd) builtin)
itemiz(changing or unsetting the tt(PATH), tt(path), tt(MODULE_PATH),
tt(module_path), tt(SHELL), tt(HISTFILE), tt(HISTSIZE), tt(GID), tt(EGID),
tt(UID), tt(EUID), tt(USERNAME), tt(LD_LIBRARY_PATH),
tt(LD_AOUT_LIBRARY_PATH), tt(LD_PRELOAD) and tt(LD_AOUT_PRELOAD)
parameters)
itemiz(specifying command names containing tt(/))
itemiz(specifying command pathnames using tt(hash))
itemiz(redirecting output to files)
itemiz(using the tt(exec) builtin command to replace the shell with another
command)
itemiz(using tt(jobs -Z) to overwrite the shell process' argument and
environment space)
itemiz(using the tt(ARGV0) parameter to override tt(argv[0]) for external
commands)
itemiz(turning off restricted mode with tt(set +r) or tt(unsetopt
RESTRICTED))
itemiz(specifying modules to be loaded with an explicitly given
pathname containing slashes)
enditemize()
These restrictions are enforced after processing the startup files. The
startup files should set up tt(PATH) to point to a directory of commands
which can be safely invoked in the restricted environment. They may also
add further restrictions by disabling selected builtins.
Restricted mode can also be activated any time by setting the
tt(RESTRICTED) option. This immediately enables all the restrictions
described above even if the shell still have not processed all startup
files.

25
Doc/Zsh/seealso.yo Normal file
View File

@ -0,0 +1,25 @@
texinode(See Also)()(The Zsh Web Page)(Introduction)
sect(See Also)
manref(sh)(1),
manref(csh)(1),
manref(tcsh)(1),
manref(rc)(1),
manref(bash)(1),
manref(ksh)(1)\
ifzshone(\
,
zmanref(zshbuiltins),
zmanref(zshcompctl),
zmanref(zshexpn),
zmanref(zshmisc),
zmanref(zshmodules),
zmanref(zshoptions),
zmanref(zshparam),
zmanref(zshzle)\
)\
bf(IEEE Standard for information Technology -
Portable Operating System Interface (POSIX) -
Part 2: Shell and Utilities),
IEEE Inc, 1993, ISBN 1-55937-255-9.

1076
Doc/Zsh/zle.yo Normal file
View File

@ -0,0 +1,1076 @@
texinode(Zsh Line Editor)(Programmable Completion)(Shell Builtin Commands)(Top)
chapter(Zsh Line Editor)
cindex(line editor)
cindex(editor, line)
sect(Description)
pindex(ZLE, use of)
If the tt(ZLE) option is set (it is by default)
and the shell input is attached to the terminal, the user
is allowed to edit command lines.
There are two display modes. The first, multiline mode, is the
default. It only works if the tt(TERM) parameter is set to a valid
terminal type that can move the cursor up. The second, single line
mode, is used if tt(TERM) is invalid or incapable of moving the
cursor up, or if the tt(SINGLE_LINE_ZLE) option is set.
pindex(SINGLE_LINE_ZLE, use of)
cindex(ksh, editor mode)
cindex(editor ksh style)
This mode
is similar to bf(ksh), and uses no termcap sequences. If tt(TERM) is
"emacs", the tt(ZLE) option will be unset by default.
sect(Keymaps)
cindex(keymaps)
cindex(key bindings)
cindex(bindings, key)
A keymap in ZLE contains a set of bindings between key sequences
and ZLE commands. The empty key sequence cannot be bound.
There can be any number of keymaps at any time, and each keymap has one
or more names. If all of a keymap's names are deleted, it disappears.
findex(bindkey, use of)
tt(bindkey) can be used to manipulate keymap names.
Initially, there are four keymaps:
startsitem()
sitem(tt(emacs))(EMACS emulation)
sitem(tt(viins))(vi emulation - insert mode)
sitem(tt(vicmd))(vi emulation - command mode)
sitem(tt(.safe))(fallback keymap)
endsitem()
The `tt(.safe)' keymap is special. It can never be altered, and the name
can never be removed. However, it can be linked to other names, which can
be removed. In the future other special keymaps may be added; users should
avoid using names beginning with `tt(.)' for their own keymaps.
vindex(VISUAL)
vindex(EDITOR)
In addition to these four names, either `tt(emacs)' or `tt(viins)' is
also linked to the name `tt(main)'. If one of the tt(VISUAL) or
tt(EDITOR) environment variables contain the string `tt(vi)' when the shell
starts up then it will be `tt(viins)', otherwise it will be `tt(emacs)'.
tt(bindkey)'s tt(-e) and tt(-v)
options provide a convenient way to override this default choice.
When the editor starts up, it will select the `tt(main)' keymap.
If that keymap doesn't exist, it will use `tt(.safe)' instead.
In the `tt(.safe)' keymap, each single key is bound to tt(self-insert),
except for ^J (line feed) and ^M (return) which are bound to tt(accept-line).
This is deliberately not pleasant to use; if you are using it, it
means you deleted the main keymap, and you should put it back.
subsect(Reading Commands)
When ZLE is reading a command from the terminal, it may read a sequence
that is bound to some command and is also a prefix of a longer bound string.
In this case ZLE will wait a certain time to see if more characters
are typed, and if not (or they don't match any longer string) it will
execute the binding. This timeout is defined by the tt(KEYTIMEOUT) parameter;
its default is 0.4 sec. No timeout is done if the prefix string is not bound.
As well as ZLE commands, key sequences can be bound to other strings, by using
`tt(bindkey -s)'.
When such a sequence is read, the replacement string is pushed back as input,
and the command reading process starts again using these fake keystrokes.
This input can itself invoke further replacement strings, but in order to
detect loops the process will be stopped if there are twenty such replacements
without a real command being read.
sect(Widgets)
cindex(widgets)
All actions in the editor are performed by `widgets'. A widget's job is
simply to perform some small action. The ZLE commands that key sequences
in keymaps are bound to are in fact widgets. Widgets can be user-defined
or built in.
There are 162 standard widgets built in to ZLE (see sectref(Standard Widgets)).
Other built-in widgets can be defined by other modules (see
ifzman(zmanref(zshmodules))\
ifnzman(noderef(Zsh Modules))\
). Each built-in widget has two names: its normal canonical name, and the
same name preceded by a `tt(.)'. The `tt(.)' name is special: it can't be
rebound to a different widget. This makes the widget available even when
its usual name has been redefined.
User-defined widgets are defined using `tt(zle -N)', and implemented
as shell functions. When the widget is executed, the corresponding
shell function is executed, and can perform editing (or other) actions.
It is recommended that user-defined widgets should not have names
starting with `tt(.)'.
sect(User-Defined Widgets)
cindex(widgets, user-defined)
User-defined widgets, being implemented as shell functions,
can execute any normal shell command. They can also run other widgets
(whether built-in or user-defined) using the tt(zle) builtin command.
Finally, they can examine and edit the ZLE buffer being edited by
reading and setting the special parameters described below.
cindex(parameters, editor)
cindex(parameters, zle)
These special parameters are always available in widget functions, but
are not in any way special outside ZLE. If they have some normal value
outside ZLE, that value is temporarily inaccessible, but will return
when the widget function exits. These special parameters in fact have
local scope, like parameters created in a function using tt(local).
startitem()
vindex(BUFFER)
item(tt(BUFFER) (scalar))(
The entire contents of the edit buffer. If it is written to, the
cursor remains at the same offset, unless that would put it outside the
buffer.
)
vindex(CURSOR)
item(tt(CURSOR) (integer))(
The offset of the cursor, within the edit buffer. This is in the range
0 to tt($#BUFFER), and is by definition equal to tt($#LBUFFER).
Attempts to move the cursor outside the buffer will result in the
cursor being moved to the appropriate end of the buffer.
)
vindex(LBUFFER)
item(tt(LBUFFER) (scalar))(
The part of the buffer that lies to the left of the cursor position.
If it is assigned to, only that part of the buffer is replaced, and the
cursor remains between the new tt($LBUFFER) and the old tt($RBUFFER).
)
vindex(RBUFFER)
item(tt(RBUFFER) (scalar))(
The part of the buffer that lies to the right of the cursor position.
If it is assigned to, only that part of the buffer is replaced, and the
cursor remains between the old tt($LBUFFER) and the new tt($RBUFFER).
)
enditem()
sect(Standard Widgets)
cindex(widgets, standard)
The following is a list of all the standard widgets,
and their default bindings in emacs mode,
vi command mode and vi insert mode
(the `tt(emacs)', `tt(vicmd)' and `tt(viins)' keymaps, respectively).
startmenu()
menu(Movement)
menu(History Control)
menu(Modifying Text)
menu(Arguments)
menu(Completion)
menu(Miscellaneous)
endmenu()
texinode(Movement)(History Control)()(Zsh Line Editor)
subsect(Movement)
startitem()
tindex(vi-backward-blank-word)
item(tt(vi-backward-blank-word) (unbound) (B) (unbound))(
Move backward one word, where a word is defined as a series of
non-blank characters.
)
tindex(backward-char)
item(tt(backward-char) (^B ESC-[D) (unbound) (unbound))(
Move backward one character.
)
tindex(vi-backward-char)
item(tt(vi-backward-char) (unbound) (^H h ^?) (unbound))(
Move backward one character, without changing lines.
)
tindex(backward-word)
item(tt(backward-word) (ESC-B ESC-b) (unbound) (unbound))(
Move to the beginning of the previous word.
)
tindex(emacs-backward-word)
item(tt(emacs-backward-word))(
Move to the beginning of the previous word.
)
tindex(vi-backward-word)
item(tt(vi-backward-word) (unbound) (b) (unbound))(
Move to the beginning of the previous word, vi-style.
)
tindex(beginning-of-line)
item(tt(beginning-of-line) (^A) (unbound) (unbound))(
Move to the beginning of the line. If already at the beginning
of the line, move to the beginning of the previous line, if any.
)
tindex(vi-beginning-of-line)
item(tt(vi-beginning-of-line))(
Move to the beginning of the line, without changing lines.
)
tindex(end-of-line)
item(tt(end-of-line) (^E) (unbound) (unbound))(
Move to the end of the line. If already at the end
of the line, move to the end of the next line, if any.
)
tindex(vi-end-of-line)
item(tt(vi-end-of-line) (unbound) ($) (unbound))(
Move to the end of the line.
If an argument is given to this command, the cursor will be moved to
the end of the line (argument - 1) lines down.
)
tindex(vi-forward-blank-word)
item(tt(vi-forward-blank-word) (unbound) (W) (unbound))(
Move forward one word, where a word is defined as a series of
non-blank characters.
)
tindex(vi-forward-blank-word-end)
item(tt(vi-forward-blank-word-end) (unbound) (E) (unbound))(
Move to the end of the current word, or, if at the end of the current word,
to the end of the next word,
where a word is defined as a series of non-blank characters.
)
tindex(forward-char)
item(tt(forward-char) (^F ESC-[C) (unbound) (unbound))(
Move forward one character.
)
tindex(vi-forward-char)
item(tt(vi-forward-char) (unbound) (space l) (unbound))(
Move forward one character.
)
tindex(vi-find-next-char)
item(tt(vi-find-next-char) (^X^F) (f) (unbound))(
Read a character from the keyboard, and move to
the next occurrence of it in the line.
)
tindex(vi-find-next-char-skip)
item(tt(vi-find-next-char-skip) (unbound) (t) (unbound))(
Read a character from the keyboard, and move to
the position just before the next occurrence of it in the line.
)
tindex(vi-find-prev-char)
item(tt(vi-find-prev-char) (unbound) (F) (unbound))(
Read a character from the keyboard, and move to
the previous occurrence of it in the line.
)
tindex(vi-find-prev-char-skip)
item(tt(vi-find-prev-char-skip) (unbound) (T) (unbound))(
Read a character from the keyboard, and move to
the position just after the previous occurrence of it in the line.
)
tindex(vi-first-non-blank)
item(tt(vi-first-non-blank) (unbound) (^) (unbound))(
Move to the first non-blank character in the line.
)
tindex(vi-forward-word)
item(tt(vi-forward-word) (unbound) (w) (unbound))(
Move forward one word, vi-style.
)
tindex(forward-word)
item(tt(forward-word) (ESC-F ESC-f) (unbound) (unbound))(
Move to the beginning of the next word.
The editor's idea of a word is specified with the tt(WORDCHARS)
parameter.
)
tindex(emacs-forward-word)
item(tt(emacs-forward-word))(
Move to the end of the next word.
)
tindex(vi-forward-word-end)
item(tt(vi-forward-word-end) (unbound) (e) (unbound))(
Move to the end of the next word.
)
tindex(vi-goto-column)
item(tt(vi-goto-column) (ESC-|) (|) (unbound))(
Move to the column specified by the numeric argument.
)
tindex(vi-goto-mark)
item(tt(vi-goto-mark) (unbound) (`) (unbound))(
Move to the specified mark.
)
tindex(vi-goto-mark-line)
item(tt(vi-goto-mark-line) (unbound) (') (unbound))(
Move to beginning of the line containing the specified mark.
)
tindex(vi-repeat-find)
item(tt(vi-repeat-find) (unbound) (;) (unbound))(
Repeat the last tt(vi-find) command.
)
tindex(vi-rev-repeat-find)
item(tt(vi-rev-repeat-find) (unbound) (,) (unbound))(
Repeat the last tt(vi-find) command in the opposite direction.
)
enditem()
texinode(History Control)(Modifying Text)(Movement)(Zsh Line Editor)
subsect(History Control)
startitem()
tindex(beginning-of-buffer-or-history)
item(tt(beginning-of-buffer-or-history) (ESC-<) (unbound) (unbound))(
Move to the beginning of the buffer, or if already there,
move to the first event in the history list.
)
tindex(beginning-of-line-hist)
item(tt(beginning-of-line-hist))(
Move to the beginning of the line. If already at the
beginning of the buffer, move to the previous history line.
)
tindex(beginning-of-history)
item(tt(beginning-of-history))(
Move to the first event in the history list.
)
tindex(down-line-or-history)
item(tt(down-line-or-history) (^N ESC-[B) (j) (unbound))(
Move down a line in the buffer, or if already at the bottom line,
move to the next event in the history list.
)
tindex(vi-down-line-or-history)
item(tt(vi-down-line-or-history) (unbound) (PLUS()) (unbound))(
Move down a line in the buffer, or if already at the bottom line,
move to the next event in the history list.
Then move to the first non-blank character on the line.
)
tindex(down-line-or-search)
item(tt(down-line-or-search))(
Move down a line in the buffer, or if already at the bottom line,
search forward in the history for a line beginning with the first
word in the buffer.
)
tindex(down-history)
item(tt(down-history) (unbound) (^N) (unbound))(
Move to the next event in the history list.
)
tindex(history-beginning-search-backward)
item(tt(history-beginning-search-backward))(
Search backward in the history for a line beginning with the current
line up to the cursor.
This leaves the cursor in its original position.
)
tindex(end-of-buffer-or-history)
item(tt(end-of-buffer-or-history) (ESC->) (unbound) (unbound))(
Move to the end of the buffer, or if already there,
move to the last event in the history list.
)
tindex(end-of-line-hist)
item(tt(end-of-line-hist))(
Move to the end of the line. If already at the end of
the buffer, move to the next history line.
)
tindex(end-of-history)
item(tt(end-of-history))(
Move to the last event in the history list.
)
tindex(vi-fetch-history)
item(tt(vi-fetch-history) (unbound) (G) (unbound))(
Fetch the history line specified by the numeric argument.
This defaults to the current history line
(i.e. the one that isn't history yet).
)
tindex(history-incremental-search-backward)
item(tt(history-incremental-search-backward) (^R ^Xr) (unbound) (unbound))(
Search backward incrementally for a specified string. The search is
case-insensitive if the search string does not have uppercase letters and no
numeric argument was given. The string may begin with `tt(^)' to anchor the
search to the beginning of the line.
A restricted set of editing functions
is available in the mini-buffer. An interrupt signal, as defined by the stty
setting, will stop the search and go back to the original line. An undefined
key will have the same effect. The supported functions are:
tt(backward-delete-char),
tt(vi-backward-delete-char),
tt(clear-screen),
tt(redisplay),
tt(quoted-insert),
tt(vi-quoted-insert),
tt(accept-and-hold),
tt(accept-and-infer-next-history),
tt(accept-line) and
tt(accept-line-and-down-history).
tt(magic-space) just inserts a space.
tt(vi-cmd-mode) toggles between the `tt(main)' and `tt(vicmd)' keymaps;
the `tt(main)' keymap (insert mode) will be selected initially.
tt(history-incremental-search-backward) will get the
next occurrence of the contents of the mini-buffer.
tt(history-incremental-search-forward) inverts the sense of the search.
tt(vi-repeat-search) and tt(vi-rev-repeat-search) are similarly supported.
The direction of the search is indicated in the mini-buffer.
Any multi-character string
that is not bound to one of the above functions will beep and interrupt the
search, leaving the last found line in the buffer. Any single character that
is not bound to one of the above functions, or tt(self-insert) or
tt(self-insert-unmeta), will have the same effect but the function will be
executed.
)
tindex(history-incremental-search-forward)
item(tt(history-incremental-search-forward) (^S ^Xs) (unbound) (unbound))(
Search forward incrementally for a specified string. The search is
case-insensitive if the search string does not have uppercase letters and no
numeric argument was given. The string may begin with `tt(^)' to anchor the
search to the beginning of the line. The functions available in the
mini-buffer are the same as for tt(history-incremental-search-backward).
)
tindex(history-search-backward)
item(tt(history-search-backward) (ESC-P ESC-p) (unbound) (unbound))(
Search backward in the history for a line beginning with the first
word in the buffer.
)
tindex(vi-history-search-backward)
item(tt(vi-history-search-backward) (unbound) (/) (unbound))(
Search backward in the history for a specified string.
The string may begin with `tt(^)' to anchor the search to the
beginning of the line.
A restricted set of editing functions is available in
the mini-buffer. An interrupt signal, as defined by the stty setting, will
stop the search.
The functions available in the mini-buffer are:
tt(accept-line),
tt(backward-delete-char),
tt(vi-backward-delete-char),
tt(backward-kill-word),
tt(vi-backward-kill-word),
tt(clear-screen),
tt(redisplay),
tt(quoted-insert)
and
tt(vi-quoted-insert).
tt(vi-cmd-mode) is treated the same as accept-line, and
tt(magic-space) is treated as a space.
Any other character that is not bound to self-insert or
self-insert-unmeta will beep and be ignored. If the function is called from vi
command mode, the bindings of the current insert mode will be used.
)
tindex(history-search-forward)
item(tt(history-search-forward) (ESC-N ESC-n) (unbound) (unbound))(
Search forward in the history for a line beginning with the first
word in the buffer.
)
tindex(vi-history-search-forward)
item(tt(vi-history-search-forward) (unbound) (?) (unbound))(
Search forward in the history for a specified string.
The string may begin with `tt(^)' to anchor the search to the
beginning of the line. The functions available in the mini-buffer are the same
as for tt(vi-history-search-backward).
)
tindex(infer-next-history)
item(tt(infer-next-history) (^X^N) (unbound) (unbound))(
Search in the history list for a line matching the current one and
fetch the event following it.
)
tindex(insert-last-word)
item(tt(insert-last-word) (ESC-_ ESC-.) (unbound) (unbound))(
Insert the last word from the previous history event at the
cursor position. If a positive numeric argument is given,
insert that word from the end of the previous history event.
If the argument is zero or negative insert that word from the
left (zero inserts the previous command word).
)
tindex(vi-repeat-search)
item(tt(vi-repeat-search) (unbound) (n) (unbound))(
Repeat the last vi history search.
)
tindex(vi-rev-repeat-search)
item(tt(vi-rev-repeat-search) (unbound) (N) (unbound))(
Repeat the last vi history search, but in reverse.
)
tindex(up-line-or-history)
item(tt(up-line-or-history) (^P ESC-[A) (k) (unbound))(
Move up a line in the buffer, or if already at the top line,
move to the previous event in the history list.
)
tindex(vi-up-line-or-history)
item(tt(vi-up-line-or-history) (unbound) (-) (unbound))(
Move up a line in the buffer, or if already at the top line,
move to the previous event in the history list.
Then move to the first non-blank character on the line.
)
tindex(up-line-or-search)
item(tt(up-line-or-search))(
Move up a line in the buffer, or if already at the top line,
search backward in the history for a line beginning with the
first word in the buffer.
)
tindex(up-history)
item(tt(up-history) (unbound) (^P) (unbound))(
Move to the previous event in the history list.
)
tindex(history-beginning-search-forward)
item(tt(history-beginning-search-forward))(
Search forward in the history for a line beginning with the current
line up to the cursor.
This leaves the cursor in its original position.
)
enditem()
texinode(Modifying Text)(Arguments)(History Control)(Zsh Line Editor)
subsect(Modifying Text)
startitem()
tindex(vi-add-eol)
item(tt(vi-add-eol) (unbound) (A) (unbound))(
Move to the end of the line and enter insert mode.
)
tindex(vi-add-next)
item(tt(vi-add-next) (unbound) (a) (unbound))(
Enter insert mode after the current cursor position, without changing lines.
)
tindex(backward-delete-char)
item(tt(backward-delete-char) (^H ^?) (unbound) (unbound))(
Delete the character behind the cursor.
)
tindex(vi-backward-delete-char)
item(tt(vi-backward-delete-char) (unbound) (X) (^H))(
Delete the character behind the cursor, without changing lines.
If in insert mode, this won't delete past the point where insert mode was
last entered.
)
tindex(backward-delete-word)
item(tt(backward-delete-word))(
Delete the word behind the cursor.
)
tindex(backward-kill-line)
item(tt(backward-kill-line))(
Kill from the beginning of the line to the cursor position.
)
tindex(backward-kill-word)
item(tt(backward-kill-word) (^W ESC-^H ESC-^?) (unbound) (unbound))(
Kill the word behind the cursor.
)
tindex(vi-backward-kill-word)
item(tt(vi-backward-kill-word) (unbound) (unbound) (^W))(
Kill the word behind the cursor, without going past the point where insert
mode was last entered.
)
tindex(capitalize-word)
item(tt(capitalize-word) (ESC-C ESC-c) (unbound) (unbound))(
Capitalize the current word and move past it.
)
tindex(vi-change)
item(tt(vi-change) (unbound) (c) (unbound))(
Read a movement command from the keyboard, and kill
from the cursor position to the endpoint of the movement.
Then enter insert mode.
If the command is tt(vi-change), change the current line.
)
tindex(vi-change-eol)
item(tt(vi-change-eol) (unbound) (C) (unbound))(
Kill to the end of the line and enter insert mode.
)
tindex(vi-change-whole-line)
item(tt(vi-change-whole-line) (unbound) (S) (unbound))(
Kill the current line and enter insert mode.
)
tindex(copy-region-as-kill)
item(tt(copy-region-as-kill) (ESC-W ESC-w) (unbound) (unbound))(
Copy the area from the cursor to the mark to the kill buffer.
)
tindex(copy-prev-word)
item(tt(copy-prev-word) (ESC-^_) (unbound) (unbound))(
Duplicate the word behind the cursor.
)
tindex(vi-delete)
item(tt(vi-delete) (unbound) (d) (unbound))(
Read a movement command from the keyboard, and kill
from the cursor position to the endpoint of the movement.
If the command is tt(vi-delete), kill the current line.
)
tindex(delete-char)
item(tt(delete-char))(
Delete the character under the cursor.
)
tindex(vi-delete-char)
item(tt(vi-delete-char) (unbound) (x) (unbound))(
Delete the character under the cursor,
without going past the end of the line.
)
tindex(delete-word)
item(tt(delete-word))(
Delete the current word.
)
tindex(down-case-word)
item(tt(down-case-word) (ESC-L ESC-l) (unbound) (unbound))(
Convert the current word to all lowercase and move past it.
)
tindex(kill-word)
item(tt(kill-word) (ESC-D ESC-d) (unbound) (unbound))(
Kill the current word.
)
tindex(gosmacs-transpose-chars)
item(tt(gosmacs-transpose-chars))(
Exchange the two characters behind the cursor.
)
tindex(vi-indent)
item(tt(vi-indent) (unbound) (>) (unbound))(
Indent a number of lines.
)
tindex(vi-insert)
item(tt(vi-insert) (unbound) (i) (unbound))(
Enter insert mode.
)
tindex(vi-insert-bol)
item(tt(vi-insert-bol) (unbound) (I) (unbound))(
Move to the first non-blank character on the line and enter insert mode.
)
tindex(vi-join)
item(tt(vi-join) (^X^J) (J) (unbound))(
Join the current line with the next one.
)
tindex(kill-line)
item(tt(kill-line) (^K) (unbound) (unbound))(
Kill from the cursor to the end of the line.
If already on the end of the line, kill the newline character.
)
tindex(vi-kill-line)
item(tt(vi-kill-line) (unbound) (unbound) (^U))(
Kill from the cursor back to wherever insert mode was last entered.
)
tindex(vi-kill-eol)
item(tt(vi-kill-eol) (unbound) (D) (unbound))(
Kill from the cursor to the end of the line.
)
tindex(kill-region)
item(tt(kill-region))(
Kill from the cursor to the mark.
)
tindex(kill-buffer)
item(tt(kill-buffer) (^X^K) (unbound) (unbound))(
Kill the entire buffer.
)
tindex(kill-whole-line)
item(tt(kill-whole-line) (^U) (unbound) (unbound))(
Kill the current line.
)
tindex(vi-match-bracket)
item(tt(vi-match-bracket) (^X^B) (%) (unbound))(
Move to the bracket character (one of tt({}), tt(()) or tt([])) that
matches the one under the cursor.
If the cursor is not on a bracket character, move forward without going
past the end of the line to find one, and then go to the matching bracket.
)
tindex(vi-open-line-above)
item(tt(vi-open-line-above) (unbound) (O) (unbound))(
Open a line above the cursor and enter insert mode.
)
tindex(vi-open-line-below)
item(tt(vi-open-line-below) (unbound) (o) (unbound))(
Open a line below the cursor and enter insert mode.
)
tindex(vi-oper-swap-case)
item(tt(vi-oper-swap-case))(
Read a movement command from the keyboard, and swap
the case of all characters
from the cursor position to the endpoint of the movement.
If the movement command is tt(vi-oper-swap-case),
swap the case of all characters on the current line.
)
tindex(overwrite-mode)
item(tt(overwrite-mode) (^X^O) (unbound) (unbound))(
Toggle between overwrite mode and insert mode.
)
tindex(vi-put-before)
item(tt(vi-put-before) (unbound) (P) (unbound))(
Insert the contents of the kill buffer before the cursor.
If the kill buffer contains a sequence of lines (as opposed to characters),
paste it above the current line.
)
tindex(vi-put-after)
item(tt(vi-put-after) (unbound) (p) (unbound))(
Insert the contents of the kill buffer after the cursor.
If the kill buffer contains a sequence of lines (as opposed to characters),
paste it below the current line.
)
tindex(quoted-insert)
item(tt(quoted-insert) (^V) (unbound) (unbound))(
Insert the next character typed into the buffer literally.
An interrupt character will not be inserted.
)
tindex(vi-quoted-insert)
item(tt(vi-quoted-insert) (unbound) (unbound) (^Q ^V))(
Display a `tt(^)' at the cursor position, and
insert the next character typed into the buffer literally.
An interrupt character will not be inserted.
)
tindex(quote-line)
item(tt(quote-line) (ESC-') (unbound) (unbound))(
Quote the current line; that is, put a `tt(')' character at the
beginning and the end, and convert all `tt(')' characters
to `tt('\'')'.
)
tindex(quote-region)
item(tt(quote-region) (ESC-") (unbound) (unbound))(
Quote the region from the cursor to the mark.
)
tindex(vi-replace)
item(tt(vi-replace) (unbound) (R) (unbound))(
Enter overwrite mode.
)
tindex(vi-repeat-change)
item(tt(vi-repeat-change) (unbound) (.) (unbound))(
Repeat the last vi mode text modification.
If a count was used with the modification, it is remembered.
If a count is given to this command, it overrides the remembered count,
and is remembered for future uses of this command.
The cut buffer specification is similarly remembered.
)
tindex(vi-replace-chars)
item(tt(vi-replace-chars) (unbound) (r) (unbound))(
Replace the character under the cursor with a character
read from the keyboard.
)
tindex(self-insert)
item(tt(self-insert) (printable characters) (unbound) (printable characters and some control characters))(
Insert a character into the buffer at the cursor position.
)
tindex(self-insert-unmeta)
item(tt(self-insert-unmeta) (ESC-^I ESC-^J ESC-^M) (unbound) (unbound))(
Insert a character into the buffer after stripping the meta bit
and converting ^M to ^J.
)
tindex(vi-substitute)
item(tt(vi-substitute) (unbound) (s) (unbound))(
Substitute the next characte+CHAR(r)(s).
)
tindex(vi-swap-case)
item(tt(vi-swap-case) (unbound) (~) (unbound))(
Swap the case of the character under the cursor and move past it.
)
tindex(transpose-chars)
item(tt(transpose-chars) (^T) (unbound) (unbound))(
Exchange the two characters to the left of the
cursor if at end of line, else exchange the
character under the cursor with the character
to the left.
)
tindex(transpose-words)
item(tt(transpose-words) (ESC-T ESC-t) (unbound) (unbound))(
Exchange the current word with the one before it.
)
tindex(vi-unindent)
item(tt(vi-unindent) (unbound) (<) (unbound))(
Unindent a number of lines.
)
tindex(up-case-word)
item(tt(up-case-word) (ESC-U ESC-u) (unbound) (unbound))(
Convert the current word to all caps and move past it.
)
tindex(yank)
item(tt(yank) (^Y) (unbound) (unbound))(
Insert the contents of the kill buffer at the cursor position.
)
tindex(yank-pop)
item(tt(yank-pop) (ESC-y) (unbound) (unbound))(
Remove the text just yanked, rotate the kill-ring,
and yank the new top. Only works following
tt(yank) or tt(yank-pop).
)
tindex(vi-yank)
item(tt(vi-yank) (unbound) (y) (unbound))(
Read a movement command from the keyboard, and copy the region
from the cursor position to the endpoint of the movement
into the kill buffer.
If the command is tt(vi-yank), copy the current line.
)
tindex(vi-yank-whole-line)
item(tt(vi-yank-whole-line) (unbound) (Y) (unbound))(
Copy the current line into the kill buffer.
)
tindex(vi-yank-eol)
item(tt(vi-yank-eol))(
Copy the region from the cursor position to the end of the line
into the kill buffer.
Arguably, this is what Y should do in vi, but it isn't what it actually does.
)
enditem()
texinode(Arguments)(Completion)(Modifying Text)(Zsh Line Editor)
subsect(Arguments)
startitem()
tindex(digit-argument)
item(tt(digit-argument) (ESC-0..ESC-9) (1-9) (unbound))(
Start a new numeric argument, or add to the current one.
See also tt(vi-digit-or-beginning-of-line).
)
tindex(neg-argument)
item(tt(neg-argument) (ESC--) (unbound) (unbound))(
Changes the sign of the following argument.
)
tindex(universal-argument)
item(tt(universal-argument))(
Multiply the argument of the next command by 4. Alternatively, if
this command is followed by an integer (positive or negative), use
that as the argument for the next command. Thus digits cannot be
repeated using this command. For example, if this command occurs
twice, followed immediately by tt(forward-char), move forward sixteen
spaces; if instead it is followed by tt(-2), then tt(forward-char),
move backward two spaces.
)
enditem()
texinode(Completion)(Miscellaneous)(Arguments)(Zsh Line Editor)
subsect(Completion)
startitem()
tindex(accept-and-menu-complete)
item(tt(accept-and-menu-complete))(
In a menu completion, insert the current completion into the buffer,
and advance to the next possible completion.
)
tindex(complete-word)
item(tt(complete-word))(
Attempt completion on the current word.
)
tindex(delete-char-or-list)
item(tt(delete-char-or-list) (^D) (unbound) (unbound))(
Delete the character under the cursor. If the cursor
is at the end of the line, list possible completions for the
current word.
)
tindex(expand-cmd-path)
item(tt(expand-cmd-path))(
Expand the current command to its full pathname.
)
tindex(expand-or-complete)
item(tt(expand-or-complete) (TAB) (unbound) (TAB))(
Attempt shell expansion on the current word.
If that fails,
attempt completion.
)
tindex(expand-or-complete-prefix)
item(tt(expand-or-complete-prefix))(
Attempt shell expansion on the current word up to cursor.
)
tindex(expand-history)
item(tt(expand-history) (ESC-space ESC-!) (unbound) (unbound))(
Perform history expansion on the edit buffer.
)
tindex(expand-word)
item(tt(expand-word) (^X*) (unbound) (unbound))(
Attempt shell expansion on the current word.
)
tindex(list-choices)
item(tt(list-choices) (ESC-^D) (^D =) (^D))(
List possible completions for the current word.
)
tindex(list-expand)
item(tt(list-expand) (^Xg ^XG) (^G) (^G))(
List the expansion of the current word.
)
tindex(magic-space)
item(tt(magic-space))(
Perform history expansion and insert a space into the
buffer. This is intended to be bound to space.
)
tindex(menu-complete)
pindex(MENU_COMPLETE, use of)
item(tt(menu-complete))(
Like tt(complete-word), except that menu completion is used.
See the tt(MENU_COMPLETE) option.
)
tindex(menu-expand-or-complete)
item(tt(menu-expand-or-complete))(
Like tt(expand-or-complete), except that menu completion is used.
)
tindex(reverse-menu-complete)
item(tt(reverse-menu-complete))(
Perform menu completion, like tt(menu-complete), except that if
a menu completion is already in progress, move to the em(previous)
completion rather than the next.
)
enditem()
texinode(Miscellaneous)()(Completion)(Zsh Line Editor)
subsect(Miscellaneous)
startitem()
tindex(accept-and-hold)
item(tt(accept-and-hold) (ESC-A ESC-a) (unbound) (unbound))(
Push the contents of the buffer on the buffer stack
and execute it.
)
tindex(accept-and-infer-next-history)
item(tt(accept-and-infer-next-history))(
Execute the contents of the buffer.
Then search the history list for a line matching the current one
and push the event following onto the buffer stack.
)
tindex(accept-line)
item(tt(accept-line) (^J ^M) (^J ^M) (^J ^M))(
Finish editing the buffer. Normally this causes the buffer to be
executed as a shell command.
)
tindex(accept-line-and-down-history)
item(tt(accept-line-and-down-history) (^O) (unbound) (unbound))(
Execute the current line, and push the next history
event on the the buffer stack.
)
tindex(vi-cmd-mode)
item(tt(vi-cmd-mode) (^X^V) (unbound) (^[))(
Enter command mode; that is, select the `tt(vicmd)' keymap.
Yes, this is bound by default in emacs mode.
)
tindex(vi-caps-lock-panic)
item(tt(vi-caps-lock-panic))(
Hang until any lowercase key is pressed.
This is for vi users without the mental capacity to keep
track of their caps lock key (like the author).
)
tindex(clear-screen)
item(tt(clear-screen) (^L ESC-^L) (^L) (^L))(
Clear the screen and redraw the prompt.
)
tindex(describe-key-briefly)
item(tt(describe-key-briefly))(
Reads a key sequence, then prints the function bound to that sequence.
)
tindex(exchange-point-and-mark)
item(tt(exchange-point-and-mark) (^X^X) (unbound) (unbound))(
Exchange the cursor position with the position of the mark.
)
tindex(execute-named-cmd)
item(tt(execute-named-cmd) (ESC-x) (unbound) (unbound))(
Read the name of an editor command and
execute it. A restricted set of editing functions is available in the
mini-buffer. An interrupt signal, as defined by the stty setting, will
abort the function. The allowed functions are:
tt(backward-delete-char),
tt(vi-backward-delete-char),
tt(clear-screen),
tt(redisplay),
tt(quoted-insert),
tt(vi-quoted-insert),
tt(backward-kill-word),
tt(vi-backward-kill-word),
tt(kill-whole-line),
tt(vi-kill-line),
tt(backward-kill-line),
tt(list-choices),
tt(delete-char-or-list),
tt(complete-word),
tt(accept-line),
tt(expand-or-complete) and
tt(expand-or-complete-prefix).
tt(kill-region) kills the last word,
and vi-cmd-mode is treated the same as accept-line.
The space and tab characters, if not bound to one of
these functions, will complete the name and then list the
possibilities if the tt(AUTO_LIST) option is set.
Any other character that is not bound to tt(self-insert) or
tt(self-insert-unmeta) will beep and be ignored.
The bindings of the current insert mode will be used.
)
tindex(execute-last-named-cmd)
item(tt(execute-last-named-cmd) (ESC-z) (unbound) (unbound))(
Redo the last function executed with tt(execute-named-cmd).
)
tindex(get-line)
item(tt(get-line) (ESC-G ESC-g) (unbound) (unbound))(
Pop the top line off the buffer stack and insert it at the
cursor position.
)
tindex(pound-insert)
item(tt(pound-insert) (unbound) (#) (unbound))(
If there is no # character at the beginning of the buffer,
add one to the beginning of each line.
If there is one, remove a # from each line that has one.
In either case, accept the current line.
The tt(INTERACTIVE_COMMENTS) option must be set
for this to have any usefulness.
)
tindex(vi-pound-insert)
item(tt(vi-pound-insert))(
If there is no # character at the beginning of the current line,
add one. If there is one, remove it.
The tt(INTERACTIVE_COMMENTS) option must be set
for this to have any usefulness.
)
tindex(push-input)
item(tt(push-input))(
Push the entire current multiline construct onto the buffer stack and
return to the top-level (tt(PS1)) prompt.
If the current parser construct is only a single line, this is exactly
like tt(push-line).
Next time the editor starts up or is popped with tt(get-line), the
construct will be popped off the top of the buffer stack and loaded
into the editing buffer.
)
tindex(push-line)
item(tt(push-line) (^Q ESC-Q ESC-q) (unbound) (unbound))(
Push the current buffer onto the buffer stack and clear
the buffer.
Next time the editor starts up, the buffer will be popped
off the top of the buffer stack and loaded into the editing
buffer.
)
tindex(push-line-or-edit)
item(tt(push-line-or-edit))(
At the top-level (tt(PS1)) prompt, equivalent to tt(push-line).
At a secondary (tt(PS2)) prompt, move the entire current multiline
construct into the editor buffer.
The latter is equivalent to tt(push-input) followed by tt(get-line).
)
tindex(redisplay)
item(tt(redisplay) (unbound) (^R) (^R))(
Redisplays the edit buffer.
)
tindex(send-break)
item(tt(send-break) (^G ESC-^G) (unbound) (unbound))(
Abort the current editor function, e.g. tt(execute-named-command), or the
editor itself, e.g. if you are in tt(vared). Otherwise abort the parsing of
the current line.
)
tindex(run-help)
item(tt(run-help) (ESC-H ESC-h) (unbound) (unbound))(
Push the buffer onto the buffer stack, and execute the
command `tt(run-help) var(cmd)', where var(cmd) is the current
command. tt(run-help) is normally aliased to var(man).
)
tindex(vi-set-buffer)
item(tt(vi-set-buffer) (unbound) (") (unbound))(
Specify a buffer to be used in the following command.
There are 35 buffers that can be specified:
the 26 `named' buffers tt("a) to tt("z)
and the nine `queued' buffers tt("1) to tt("9). The named buffers can also
be specified as tt("A) to tt("Z).
When a buffer is specified for a cut command, the text being cut replaces
the previous contents of the specified buffer. If a named buffer
is specified using a capital, the newly cut text is appended to the buffer
instead of overwriting it.
If no buffer is specified for a cut command, tt("1) is used, and the
contents of tt("1) to tt("8) are each shifted along one buffer; the contents of
tt("9) is lost.
)
tindex(vi-set-mark)
item(tt(vi-set-mark) (unbound) (m) (unbound))(
Set the specified mark at the cursor position.
)
tindex(set-mark-command)
item(tt(set-mark-command) (^@) (unbound) (unbound))(
Set the mark at the cursor position.
)
tindex(spell-word)
item(tt(spell-word) (ESC-$ ESC-S ESC-s) (unbound) (unbound))(
Attempt spelling correction on the current word.
)
tindex(undefined-key)
item(tt(undefined-key))(
This command is executed when a key sequence that is not bound to any
command is typed. By default it beeps.
)
tindex(undo)
item(tt(undo) (^_ ^Xu ^X^U) (unbound) (unbound))(
Incrementally undo the last text modification.
)
tindex(redo)
item(tt(redo))(
Incrementally redo undone text modifications.
)
tindex(vi-undo-change)
item(tt(vi-undo-change) (unbound) (u) (unbound))(
Undo the last text modification.
If repeated, redo the modification.
)
tindex(what-cursor-position)
item(tt(what-cursor-position) (^X=) (unbound) (unbound))(
Print the character under the cursor, its code as an octal, decimal and
hexadecimal number, the current cursor position within the buffer and the
column of the cursor in the current line.
)
tindex(where-is)
item(tt(where-is))(
Read the name of an editor command and and print the listing of key
sequences that invoke the specified command.
)
tindex(which-command)
item(tt(which-command) (ESC-?) (unbound) (unbound))(
Push the buffer onto the buffer stack, and execute the
command `tt(which-command) var(cmd)'. where var(cmd) is the current
command. tt(which-command) is normally aliased to var(whence).
)
tindex(vi-digit-or-beginning-of-line)
item(tt(vi-digit-or-beginning-of-line) (unbound) (0) (unbound))(
If the last command executed was a digit as part of an argument,
continue the argument. Otherwise, execute vi-beginning-of-line.
)
enditem()

2701
Doc/intro.ms Normal file
View File

@ -0,0 +1,2701 @@
.nr PI 0
.nr LL 6.5i
.de Ds
.DS I .5i
.ft C
.ps 9
.vs 11
.ss 11
..
.de De
.DE
.ft R
.ps
.vs
.ss
..
.de Sh
.SH
\\$1
.XS
\\$1
.XE
..
.nr HM 4i
.ce 99
.ps 18
.vs 20
.ss 20
\f3An Introduction to the Z Shell\fP
.ps 14
.vs 16
.ss 16
\f2Paul Falstad
pf@software.com
Bas de Bakker
bas@phys.uva.nl\fP
.ce 0
.nr HM 1i
.pn 1
.bp
.\" This blank page on the reverse of the cover.
.sv |1i
.pn 1
.bp
.TL
An Introduction to the Z Shell
.AU
Paul Falstad
pf@software.com
.AU
Bas de Bakker
bas@phys.uva.nl
.PP
.Sh "Introduction"
.PP
\fBzsh\fP is a shell designed for interactive use, although it is also
a powerful scripting language. Many of the useful features of bash,
ksh, and tcsh were incorporated into \fBzsh\fP; many original features were
added. This document details some of the unique features of \fBzsh\fP. It
assumes basic knowledge of the standard UNIX shells; the intent is to
show a reader already familiar with one of the other major shells what
makes \fBzsh\fP more useful or more powerful. This document is not at all
comprehensive; read the manual entry for a description of the shell
that is complete and concise, although somewhat overwhelming and
devoid of examples.
.PP
The text will frequently mention options that you can set to change
the behaviour of \fBzsh\fP. You can set these options with the
command
.Ds
%\0setopt\0\fIoptionname\fC
.De
and unset them again with
.Ds
%\0unsetopt\0\fIoptionname\fC
.De
Case is ignored in option names, as are embedded underscores.
.Sh "Filename Generation"
.PP
Otherwise known as \fIglobbing\fP, filename generation
is quite extensive in \fBzsh\fP. Of course, it has all the
basics:
.Ds
%\0ls
Makefile\0\0\0file.pro\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0q.c\0\0\0\0\0\0\0\0run234\0\0\0\0\0stuff
bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub
file.h\0\0\0\0\0foo.c\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run303
%\0ls\0*.c
foo.c\0\0q.c
%\0ls\0*.[co]
bar.o\0\0\0foo.c\0\0\0foo.o\0\0\0main.o\0\0q.c
%\0ls\0foo.?
foo.c\0\0foo.o
%\0ls\0*.[^c]
bar.o\0\0\0file.h\0\0foo.o\0\0\0main.h\0\0main.o
%\0ls\0*.[^oh]
foo.c\0\0q.c
.De
Also, if the \fIEXTENDEDGLOB\fP option is set,
some new features are activated.
For example, the \fC^\fP character negates the pattern following it:
.Ds
%\0setopt\0extendedglob
%\0ls\0-d\0^*.c
Makefile\0\0\0file.pro\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run2\0\0\0\0\0\0\0run303
bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run234\0\0\0\0\0stuff
file.h\0\0\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub
%\0ls\0-d\0^*.*
Makefile\0\0\0link\0\0\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run240\0\0\0\0\0stuff
foo\0\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run234\0\0\0\0\0run303\0\0\0\0\0sub
%\0ls\0-d\0^Makefile
bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub
file.h\0\0\0\0\0foo.c\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run303
file.pro\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0q.c\0\0\0\0\0\0\0\0run234\0\0\0\0\0stuff
%\0ls\0-d\0*.^c
\&.rhosts\0\0\0bar.o\0\0\0\0\0file.h\0\0\0\0file.pro\0\0foo.o\0\0\0\0\0main.h\0\0\0\0main.o
.De
An expression of the form
\fC<\fIx\fR\-\fIy\fC>\fR
matches a range of integers:
.Ds
%\0ls\0run<200-300>
run234\0\0run240
%\0ls\0run<300-400>
run303
%\0ls\0run<-200>
run123\0\0run2
%\0ls\0run<300->
run303
%\0ls\0run<>
run123\0\0run2\0\0\0\0run234\0\0run240\0\0run303
.De
The \fINUMERICGLOBSORT\fP option will sort files with numbers
according to the number. This will not work with \fCls\fP as it
resorts its arguments:
.Ds
%\0setopt\0numericglobsort
%\0echo\0run<>
run2\0run123\0run234\0run240\0run303
.De
Grouping is possible:
.Ds
%\0ls\0(foo|bar).*
bar.o\0\0foo.c\0\0foo.o
%\0ls\0*.(c|o|pro)
bar.o\0\0\0\0\0file.pro\0\0foo.c\0\0\0\0\0foo.o\0\0\0\0\0main.o\0\0\0\0q.c
.De
Also, the string \fC**/\fP forces a recursive search of
subdirectories:
.Ds
%\0ls\0-R
Makefile\0\0\0file.pro\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0q.c\0\0\0\0\0\0\0\0run234\0\0\0\0\0stuff
bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub
file.h\0\0\0\0\0foo.c\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run303
morestuff:
stuff:
file\0\0xxx\0\0\0yyy
stuff/xxx:
foobar
stuff/yyy:
frobar
%\0ls\0**/*bar
stuff/xxx/foobar\0\0stuff/yyy/frobar
%\0ls\0**/f*
file.h\0\0\0\0\0\0\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0foo.o\0\0\0\0\0\0\0\0\0\0\0\0\0stuff/xxx/foobar
file.pro\0\0\0\0\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0\0\0\0\0\0\0stuff/file\0\0\0\0\0\0\0\0stuff/yyy/frobar
%\0ls\0*bar*
bar.o
%\0ls\0**/*bar*
bar.o\0\0\0\0\0\0\0\0\0\0\0\0\0stuff/xxx/foobar\0\0stuff/yyy/frobar
%\0ls\0stuff/**/*bar*
stuff/xxx/foobar\0\0stuff/yyy/frobar
.De
.PP
It is possible to exclude certain files from the patterns using
the ~ character. A pattern of the form \fC*.c~bar.c\fP lists all
files matching \fC*.c\fP, except for the file \fCbar.c\fP.
.Ds
%\0ls\0*.c
foo.c\0\0\0\0foob.c\0\0\0\0bar.c
%\0ls\0*.c~bar.c
foo.c\0\0\0\0foob.c
%\0ls\0*.c~f*
bar.c
.De
.PP
One can add a number of \fIqualifiers\fP to the end of
any of these patterns, to restrict matches to certain
file types. A qualified pattern is of the form
.DS
\fIpattern\fC(\fR...\fC)\fR
.De
with single-character qualifiers inside the parentheses.
.Ds
%\0alias\0l='ls\0-dF'
%\0l\0*
Makefile\0\0\0\0foo*\0\0\0\0\0\0\0\0main.h\0\0\0\0\0\0q.c\0\0\0\0\0\0\0\0\0run240
bar.o\0\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0main.o\0\0\0\0\0\0run123\0\0\0\0\0\0run303
file.h\0\0\0\0\0\0foo.o\0\0\0\0\0\0\0morestuff/\0\0run2\0\0\0\0\0\0\0\0stuff/
file.pro\0\0\0\0link@\0\0\0\0\0\0\0pipe\0\0\0\0\0\0\0\0run234\0\0\0\0\0\0sub
%\0l\0*(/)
morestuff/\0\0stuff/
%\0l\0*(@)
link@
%\0l\0*(*)
foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/
%\0l\0*(x)
foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/
%\0l\0*(X)
foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/
%\0l\0*(R)
bar.o\0\0\0\0\0\0\0foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0run123\0\0\0\0\0\0run240
file.h\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0main.h\0\0\0\0\0\0pipe\0\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0\0run303
file.pro\0\0\0\0foo.o\0\0\0\0\0\0\0main.o\0\0\0\0\0\0q.c\0\0\0\0\0\0\0\0\0run234\0\0\0\0\0\0stuff/
.De
Note that \fC*(x)\fP and \fC*(*)\fP both match executables.
\fC*(X)\fP matches files executable by others, as opposed to
\fC*(x)\fP, which matches files executable by the owner.
\fC*(R)\fP and \fC*(r)\fP match readable files;
\fC*(W)\fP and \fC*(w)\fP, which checks for writable files.
\fC*(W)\fP is especially important, since it checks for world-writable
files:
.Ds
%\0l\0*(w)
bar.o\0\0\0\0\0\0\0foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0run123\0\0\0\0\0\0run240
file.h\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0main.h\0\0\0\0\0\0pipe\0\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0\0run303
file.pro\0\0\0\0foo.o\0\0\0\0\0\0\0main.o\0\0\0\0\0\0q.c\0\0\0\0\0\0\0\0\0run234\0\0\0\0\0\0stuff/
%\0l\0*(W)
link@\0\0\0run240
%\0l\0-l\0link\0run240
lrwxrwxrwx\0\01\0pfalstad\0\0\0\0\0\0\010\0May\023\018:12\0link\0->\0/usr/bin/
-rw-rw-rw-\0\01\0pfalstad\0\0\0\0\0\0\0\00\0May\023\018:12\0run240
.De
If you want to have all the files of a certain type as well as all
symbolic links pointing to files of that type, prefix the qualifier
with a \fC-\fP:
.Ds
%\0l\0*(-/)
link@\0\0\0\0\0\0\0morestuff/\0\0stuff/
.De
You can filter out the symbolic links with the \fC^\fP character:
.Ds
%\0l\0*(W^@)
run240
%\0l\0*(x)
foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/
%\0l\0*(x^@/)
foo*
.De
To find all plain files, you can use \fC.\fP:
.Ds
%\0l\0*(.)
Makefile\0\0file.h\0\0\0\0foo*\0\0\0\0\0\0foo.o\0\0\0\0\0main.o\0\0\0\0run123\0\0\0\0run234\0\0\0\0run303
bar.o\0\0\0\0\0file.pro\0\0foo.c\0\0\0\0\0main.h\0\0\0\0q.c\0\0\0\0\0\0\0run2\0\0\0\0\0\0run240\0\0\0\0sub
%\0l\0*(^.)
link@\0\0\0\0\0\0\0morestuff/\0\0pipe\0\0\0\0\0\0\0\0stuff/
%\0l\0s*(.)
stuff/\0\0\0sub
%\0l\0*(p)
pipe
%\0l\0-l\0*(p)
prw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\0\00\0May\023\018:12\0pipe
.De
\fC*(U)\fP matches all files owned by you.
To search for all files not owned by you, use \fC*(^U)\fP:
.Ds
%\0l\0-l\0*(^U)
-rw-------\0\01\0subbarao\0\0\0\0\0\0\029\0May\023\018:13\0sub
.De
This searches for setuid files:
.Ds
%\0l\0-l\0*(s)
-rwsr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\016\0May\023\018:12\0foo*
.De
This checks for a certain user's files:
.Ds
%\0l\0-l\0*(u[subbarao])
-rw-------\0\01\0subbarao\0\0\0\0\0\0\029\0May\023\018:13\0sub
.De
.Sh "Startup Files"
.PP
There are five startup files that \fBzsh\fP will read commands from:
.Ds
$ZDOTDIR/.zshenv
$ZDOTDIR/.zprofile
$ZDOTDIR/.zshrc
$ZDOTDIR/.zlogin
$ZDOTDIR/.zlogout
.De
If \fBZDOTDIR\fP is not set, then the value of \fBHOME\fP is used;
this is the usual case.
.\".KE <--- missing .KS or .KF above
.PP
\&\fC.zshenv\fP is sourced on all invocations of the shell,
unless the \fC-f\fP option is set. It should contain commands to set
the command search path, plus other important environment
variables.
\&\fC.zshenv\fP should not contain commands that produce output
or assume the shell is attached to a tty.
.PP
\&\fC.zshrc\fP is sourced in interactive shells. It should contain
commands to set up aliases, functions, options, key bindings, etc.
.PP
\&\fC.zlogin\fP is sourced in login shells. It should contain
commands that should be executed only in login shells.
\&\fC.zlogout\fP is sourced when login shells exit.
\&\fC.zprofile\fP is similar to \fC.zlogin\fP, except that it is sourced before
\&\fC.zshrc\fP.
\&\fC.zprofile\fP is meant as an alternative to \fC.zlogin\fP for
ksh fans;
the two are not intended to be used together, although this
could certainly be done if desired.
\&\fC.zlogin\fP is not the place for alias definitions, options, environment
variable settings, etc.;
as a general rule, it should not change the shell environment
at all. Rather, it should be used to set the terminal type
and run a series of external commands (\fCfortune\fP, \fCmsgs\fP, etc).
.Sh "Shell Functions"
.PP
\fBzsh\fP also allows you to create your own commands by defining shell
functions. For example:
.Ds
%\0yp\0()\0{
>\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname
>\0}
%\0yp\0pfalstad
pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh
.De
This function looks up a user in the NIS password map.
The \fC$1\fP expands to the first argument to \fCyp\fP.
The function could have been equivalently defined in one of the following
ways:
.Ds
%\0function\0yp\0{
>\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname
>\0}
%\0function\0yp\0()\0{
>\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname
>\0}
%\0function\0yp\0()\0ypmatch\0$1\0passwd.byname
.De
Note that aliases are expanded when the function definition is
parsed, not when the function is executed. For example:
.Ds
%\0alias\0ypmatch=echo
%\0yp\0pfalstad
pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh
.De
Since the alias was defined after the function was parsed, it has
no effect on the function's execution.
However, if we define the function again with the alias in place:
.Ds
%\0function\0yp\0()\0{\0ypmatch\0$1\0passwd.byname\0}
%\0yp\0pfalstad
pfalstad\0passwd.byname
.De
it is parsed with the new alias definition in place.
Therefore, in general you must define aliases before functions.
.\".KE <--- missing .KS or .KF above
.PP
We can make the function take multiple arguments:
.Ds
%\0unalias\0ypmatch
%\0yp\0()\0{
>\0\0\0\0\0\0\0for\0i
>\0\0\0\0\0\0\0do\0ypmatch\0$i\0passwd.byname
>\0\0\0\0\0\0\0done
>\0}
%\0yp\0pfalstad\0subbarao\0sukthnkr
pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh
subbarao:*:3338:35:Kartik\0Subbarao:/u/subbarao:/usr/princeton/bin/zsh
sukthnkr:*:1267:35:Rahul\0Sukthankar:/u/sukthnkr:/usr/princeton/bin/tcsh
.De
The \fCfor i\fP loops through each of the function's arguments,
setting \fCi\fP equal to each of them in turn.
We can also make the function do something sensible
if no arguments are given:
.Ds
%\0yp\0()\0{
>\0\0\0\0\0\0\0if\0((\0$#\0==\00\0))
>\0\0\0\0\0\0\0then\0echo\0usage:\0yp\0name\0...;\0fi
>\0\0\0\0\0\0\0for\0i;\0do\0ypmatch\0$i\0passwd.byname;\0done
>\0}
%\0yp
usage:\0yp\0name\0...
%\0yp\0pfalstad\0sukthnkr
pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh
sukthnkr:*:1267:35:Rahul\0Sukthankar:/u/sukthnkr:/usr/princeton/bin/tcsh
.De
\fC$#\fP is the number of arguments supplied to the function.
If it is equal to zero, we print a usage message; otherwise,
we loop through the arguments, and \fCypmatch\fP all of them.
.\".KE <--- missing .KS or .KF above
.PP
Here's a function that selects a random line from a file:
.Ds
%\0randline\0()\0{
>\0\0\0\0\0\0\0integer\0z=$(wc\0-l\0<$1)
>\0\0\0\0\0\0\0sed\0-n\0$[RANDOM\0%\0z\0+\01]p\0$1
>\0}
%\0randline\0/etc/motd
PHOENIX\0WILL\0BE\0DOWN\0briefly\0Friday\0morning,\05/24/91\0from\08\0AM\0to
%\0randline\0/etc/motd
SunOS\0Release\04.1.1\0(PHOENIX)\0#19:\0Tue\0May\014\019:03:15\0EDT\01991
%\0randline\0/etc/motd
|\0Please\0use\0the\0"msgs"\0command\0to\0read\0announcements.\0\0Refer\0to\0the\0\0\0|
%\0echo\0$z
%
.De
\fCrandline\fP has a local variable, \fCz\fP, that holds the number of
lines in the file. \fC$[RANDOM % z + 1]\fP expands to a random number
between 1 and \fCz\fP. An expression of the form \fC$[\fR...\fC]\fR
expands to the value of the arithmetic expression within the brackets,
and the \fBRANDOM\fP variable returns a random number each time it
is referenced. \fC%\fP is the modulus operator, as in C.
Therefore, \fCsed -n $[RANDOM%z+1]p\fP picks a random line from its
input, from 1 to \fCz\fP.
.PP
Function definitions can be viewed with the \fCfunctions\fP builtin:
.Ds
%\0functions\0randline
randline\0()\0{
\0\0\0\0\0\0\0\0integer\0z=$(wc\0-l\0<$1)
\0\0\0\0\0\0\0\0sed\0-n\0$[RANDOM\0%\0z\0+\01]p\0$1
}
%\0functions
yp\0()\0{
\0\0\0\0\0\0\0\0if\0let\0$#\0==\00\0
\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0then
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0echo\0usage:\0yp\0name\0...
\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0fi
\0\0\0\0\0\0\0\0for\0i
\0\0\0\0\0\0\0\0do
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ypmatch\0$i\0passwd.byname
\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0done
}
randline\0()\0{
\0\0\0\0\0\0\0\0integer\0z=$(wc\0-l\0<$1)
\0\0\0\0\0\0\0\0sed\0-n\0$[RANDOM\0%\0z\0+\01]p\0$1
}
.De
Here's another one:
.Ds
%\0cx\0()\0{\0chmod\0+x\0$*\0}
%\0ls\0-l\0foo\0bar
-rw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0bar
-rw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0foo
%\0cx\0foo\0bar
%\0ls\0-l\0foo\0bar
-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0bar
-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0foo
.De
Note that this could also have been implemented as an alias:
.Ds
%\0chmod\0644\0foo\0bar
%\0alias\0cx='chmod\0+x'
%\0cx\0foo\0bar
%\0ls\0-l\0foo\0bar
-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0bar
-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0foo
.De
.PP
Instead of defining a lot of functions in your \fC.zshrc\fP,
all of which you may not use,
it is often better to use the \fCautoload\fP builtin.
The idea is, you create a directory where function
definitions are stored, declare the names in
your \fC.zshrc\fP, and tell the shell where to look for them.
Whenever you reference a function, the shell
will automatically load it into memory.
.Ds
%\0mkdir\0/tmp/funs
%\0cat\0>/tmp/funs/yp
ypmatch\0$1\0passwd.byname
^D
%\0cat\0>/tmp/funs/cx
chmod\0+x\0$*
^D
%\0FPATH=/tmp/funs
%\0autoload\0cx\0yp
%\0functions\0cx\0yp
undefined\0cx\0()
undefined\0yp\0()
%\0chmod\0755\0/tmp/funs/{cx,yp}
%\0yp\0egsirer
egsirer:*:3214:35:Emin\0Gun\0Sirer:/u/egsirer:/bin/sh
%\0functions\0yp
yp\0()\0{
\0\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname
}
.De
This idea has other benefits. By adding a \fC#!\fP header
to the files, you can make them double as shell scripts.
(Although it is faster to use them as functions, since a
separate process is not created.)
.Ds
%\0ed\0/tmp/funs/yp
25
i
#!\0/usr/local/bin/zsh
.
w
42
q
%\0</tmp/funs/yp
#!\0/usr/local/bin/zsh
ypmatch\0$1\0passwd.byname
%\0/tmp/funs/yp\0sukthnkr
sukthnkr:*:1267:35:Rahul\0Sukthankar:/u/sukthnkr:/usr/princeton/bin/tcsh
.De
Now other people, who may not use \fBzsh\fP, or who don't want to
copy all of your \fC.zshrc\fP, may use these functions as shell
scripts.
.Sh "Directories"
.PP
One nice feature of \fBzsh\fP is the way it prints directories.
For example, if we set the prompt like this:
.Ds
phoenix%\0PROMPT='%~>\0'
~>\0cd\0src
~/src>
.De
the shell will print the current directory in the prompt,
using the \fC~\fP character.
However, \fBzsh\fP is smarter than most other shells in this respect:
.Ds
~/src>\0cd\0~subbarao
~subbarao>\0cd\0~maruchck
~maruchck>\0cd\0lib
~maruchck/lib>\0cd\0fun
~maruchck/lib/fun>\0foo=/usr/princeton/common/src
~maruchck/lib/fun>\0cd\0~foo
~foo>\0cd\0..
/usr/princeton/common>\0cd\0src
~foo>\0cd\0news/nntp
~foo/news/nntp>\0cd\0inews
~foo/news/nntp/inews>
.De
Note that \fBzsh\fP prints \fIother\fP users' directories
in the form \fC~user\fP. Also note that you can
set a parameter and use it as a directory name;
\fBzsh\fP will act as if \fCfoo\fP is a user
with the login directory \fC/usr/princeton/common/src\fP.
This is convenient, especially if you're sick of seeing
prompts like this:
.Ds
phoenix:/usr/princeton/common/src/X.V11R4/contrib/clients/xv/docs>
.De
If you get stuck in this position, you can give the current
directory a short name, like this:
.Ds
/usr/princeton/common/src/news/nntp/inews>\0inews=$PWD
/usr/princeton/common/src/news/nntp/inews>\0echo\0~inews
/usr/princeton/common/src/news/nntp/inews
~inews>
.De
When you reference a directory in the form \fC~inews\fP,
the shell assumes that you want the directory displayed
in this form; thus simply typing \fCecho ~inews\fP or
\fCcd ~inews\fP causes the prompt to be shortened.
You can define a shell function for this purpose:
.Ds
~inews>\0namedir\0()\0{\0$1=$PWD\0;\0\0:\0~$1\0}
~inews>\0cd\0/usr/princeton/bin
/usr/princeton/bin>\0namedir\0pbin
~pbin>\0cd\0/var/spool/mail
/var/spool/mail>\0namedir\0spool
~spool>\0cd\0.msgs
~spool/.msgs>
.De
You may want to add this one-line function to your \fC.zshrc\fP.
\fBzsh\fP can also put the current directory in your title bar,
if you are using a windowing system.
One way to do this is with the \fCchpwd\fP function, which is
automatically executed by the shell whenever you change
directory. If you are using xterm, this will work:
.Ds
chpwd\0()\0{\0print\0-Pn\0'^[]2;%~^G'\0}
.De
The \fC-P\fP option tells \fCprint\fP to treat its arguments like a prompt
string; otherwise the \fC%~\fP would not be expanded.
The \fC-n\fP option suppresses the terminating newline, as with \fCecho\fP.
.PP
If you are using an IRIS \fCwsh\fP, do this:
.Ds
chpwd\0()\0{\0print\0-Pn\0'\e2201.y%~\e234'\0}
.De
The \fCprint -D\fP command has other uses. For example, to
print the current directory to standard output in short form,
you can do this:
.Ds
%\0print\0-D\0$PWD
~subbarao/src
.De
and to print each component of the path in short form:
.Ds
%\0print\0-D\0$path
/bin\0/usr/bin\0~locbin\0~locbin/X11\0~/bin
.De
.Sh "Directory Stacks"
.PP
If you use csh, you may know about directory stacks.
The \fCpushd\fP command puts the current directory on the
stack, and changes to a new directory; the \fCpopd\fP command
pops a directory off the stack and changes to it.
.Ds
phoenix%\0cd\0
phoenix%\0PROMPT='Z\0%~>\0'
Z\0~>\0pushd\0/tmp
/tmp\0~
Z\0/tmp>\0pushd\0/usr/etc
/usr/etc\0/tmp\0~
Z\0/usr/etc>\0pushd\0/usr/bin
/usr/bin\0/usr/etc\0/tmp\0~
Z\0/usr/bin>\0popd
/usr/etc\0/tmp\0~
Z\0/usr/etc>\0popd
/tmp\0~
Z\0/tmp>\0pushd\0/etc
/etc\0/tmp\0~
Z\0/etc>\0popd\0
/tmp\0~
.De
\fBzsh\fP's directory stack commands work similarly. One
difference is the way \fCpushd\fP is handled if no arguments
are given. As in csh, this exchanges the top two elements
of the directory stack:
.Ds
Z\0/tmp>\0dirs
/tmp\0~
Z\0/tmp>\0pushd
~\0/tmp
.De
unless the stack only has one entry:
.Ds
Z\0~>\0popd
/tmp
Z\0/tmp>\0dirs
/tmp
Z\0/tmp>\0pushd
~\0/tmp
Z\0~>
.De
or unless the \fIPUSHDTOHOME\fP option is set:
.Ds
Z\0~>\0setopt\0pushdtohome
Z\0~>\0pushd
~\0~\0/tmp
.De
.PP
As an alternative to using directory stacks in this manner,
we can get something like a \fIdirectory history\fP
by setting a few more options and parameters:
.Ds
~>\0DIRSTACKSIZE=8
~>\0setopt\0autopushd\0pushdminus\0pushdsilent\0pushdtohome
~>\0alias\0dh='dirs\0-v'
~>\0cd\0/tmp
/tmp>\0cd\0/usr
/usr>\0cd\0bin
/usr/bin>\0cd\0../pub
/usr/pub>\0dh
0\0\0\0\0\0\0\0/usr/pub
1\0\0\0\0\0\0\0/usr/bin
2\0\0\0\0\0\0\0/usr
3\0\0\0\0\0\0\0/tmp
4\0\0\0\0\0\0\0~
/usr/pub>\0cd\0-3
/tmp>\0dh
0\0\0\0\0\0\0\0/tmp
1\0\0\0\0\0\0\0/usr/pub
2\0\0\0\0\0\0\0/usr/bin
3\0\0\0\0\0\0\0/usr
4\0\0\0\0\0\0\0~
/tmp>\0ls\0=2/df
/usr/bin/df
/tmp>\0cd\0-4
~>
.De
Note that \fC=2\fP expanded to the second directory in the
history list, and that \fCcd -3\fP recalled the third
directory in the list.
.PP
You may be wondering what all those options do.
\fIAUTOPUSHD\fP made \fCcd\fP act like \fCpushd\fP.
(\fCalias cd=pushd\fP is not sufficient, for various reasons.)
\fIPUSHDMINUS\fP swapped the meaning of \fCcd +1\fP and
\fCcd -1\fP; we want them to mean the opposite of what they mean in csh,
because it makes more sense in this scheme, and it's easier to type:
.Ds
~>\0dh
0\0\0\0\0\0\0\0~
1\0\0\0\0\0\0\0/tmp
2\0\0\0\0\0\0\0/usr/pub
3\0\0\0\0\0\0\0/usr/bin
4\0\0\0\0\0\0\0/usr
~>\0unsetopt\0pushdminus
~>\0cd\0+1
/tmp>\0dh
0\0\0\0\0\0\0\0/tmp
1\0\0\0\0\0\0\0~
2\0\0\0\0\0\0\0/usr/pub
3\0\0\0\0\0\0\0/usr/bin
4\0\0\0\0\0\0\0/usr
/tmp>\0cd\0+2
/usr/pub>
.De
\fIPUSHDSILENT\fP keeps the shell from printing
the directory stack each time we do a \fCcd\fP,
and \fIPUSHDTOHOME\fP we mentioned earlier:
.Ds
/usr/pub>\0unsetopt\0pushdsilent
/usr/pub>\0cd\0/etc
/etc\0/usr/pub\0/tmp\0~\0/usr/bin\0/usr
/etc>\0cd
~\0/etc\0/usr/pub\0/tmp\0~\0/usr/bin\0/usr
~>\0unsetopt\0pushdtohome
~>\0cd
/etc\0~\0/usr/pub\0/tmp\0~\0/usr/bin\0/usr
/etc>
.De
\fBDIRSTACKSIZE\fP keeps the directory stack
from getting too large, much like \fIHISTSIZE\fP:
.Ds
/etc>\0setopt\0pushdsilent
/etc>\0cd\0/
/>\0cd\0/
/>\0cd\0/
/>\0cd\0/
/>\0cd\0/
/>\0cd\0/
/>\0cd\0/
/>\0cd\0/
/>\0dh
0\0\0\0\0\0\0\0/
1\0\0\0\0\0\0\0/
2\0\0\0\0\0\0\0/
3\0\0\0\0\0\0\0/
4\0\0\0\0\0\0\0/
5\0\0\0\0\0\0\0/
6\0\0\0\0\0\0\0/
7\0\0\0\0\0\0\0/
.De
.Sh "Command/Process Substitution"
.PP
Command substitution in \fBzsh\fP can take two forms.
In the traditional form, a command enclosed in
backquotes (\fC`\fP...\fC`\fP) is replaced on the command line with its output.
This is the form used by the older shells.
Newer shells (like \fBzsh\fP) also provide another form,
\fC$(\fR...\fC)\fR. This form is much easier to nest.
.Ds
%\0ls\0-l\0`echo\0/vmunix`
-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209702\0May\014\019:04\0/vmunix
%\0ls\0-l\0$(echo\0/vmunix)
-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209702\0May\014\019:04\0/vmunix
%\0who\0|\0grep\0mad
subbarao\0ttyt7\0\0\0May\023\015:02\0\0\0(mad55sx15.Prince)
pfalstad\0ttyu1\0\0\0May\023\016:25\0\0\0(mad55sx14.Prince)
subbarao\0ttyu6\0\0\0May\023\015:04\0\0\0(mad55sx15.Prince)
pfalstad\0ttyv3\0\0\0May\023\016:25\0\0\0(mad55sx14.Prince)
%\0who\0|\0grep\0mad\0|\0awk\0'{print\0$2}'
ttyt7
ttyu1
ttyu6
ttyv3
%\0cd\0/dev;\0ls\0-l\0$(who\0|
>\0grep\0$(echo\0mad)\0|
>\0awk\0'{\0print\0$2\0}')
crwx-w----\0\01\0subbarao\0\020,\0\071\0May\023\018:35\0ttyt7
crw--w----\0\01\0pfalstad\0\020,\0\081\0May\023\018:42\0ttyu1
crwx-w----\0\01\0subbarao\0\020,\0\086\0May\023\018:38\0ttyu6
crw--w----\0\01\0pfalstad\0\020,\0\099\0May\023\018:41\0ttyv3
.De
Many common uses of command substitution, however, are
superseded by other mechanisms of \fBzsh\fP:
.Ds
%\0ls\0-l\0`tty`
crw-rw-rw-\0\01\0root\0\0\0\0\0\020,\0\028\0May\023\018:35\0/dev/ttyqc
%\0ls\0-l\0$TTY
crw-rw-rw-\0\01\0root\0\0\0\0\0\020,\0\028\0May\023\018:35\0/dev/ttyqc
%\0ls\0-l\0`which\0rn`
-rwxr-xr-x\0\01\0root\0\0\0\0\0\0\0172032\0Mar\0\06\018:40\0/usr/princeton/bin/rn
%\0ls\0-l\0=rn
-rwxr-xr-x\0\01\0root\0\0\0\0\0\0\0172032\0Mar\0\06\018:40\0/usr/princeton/bin/rn
.De
A command name with a \fC=\fP prepended is replaced with its full
pathname. This can be very convenient. If it's not convenient
for you, you can turn it off:
.Ds
%\0ls
=foo\0\0\0\0=bar
%\0ls\0=foo\0=bar
zsh:\0foo\0not\0found
%\0setopt\0noequals
%\0ls\0=foo\0=bar
=foo\0\0\0\0=bar
.De
.PP
Another nice feature is process substitution:
.Ds
%\0who\0|\0fgrep\0-f\0=(print\0-l\0root\0lemke\0shgchan\0subbarao)
root\0\0\0\0\0console\0May\019\010:41
lemke\0\0\0\0ttyq0\0\0\0May\022\010:05\0\0\0(narnia:0.0)
lemke\0\0\0\0ttyr7\0\0\0May\022\010:05\0\0\0(narnia:0.0)
lemke\0\0\0\0ttyrd\0\0\0May\022\010:05\0\0\0(narnia:0.0)
shgchan\0\0ttys1\0\0\0May\023\016:52\0\0\0(gaudi.Princeton.)
subbarao\0ttyt7\0\0\0May\023\015:02\0\0\0(mad55sx15.Prince)
subbarao\0ttyu6\0\0\0May\023\015:04\0\0\0(mad55sx15.Prince)
shgchan\0\0ttyvb\0\0\0May\023\016:51\0\0\0(gaudi.Princeton.)
.De
A command of the form \fC=(\fR...\fC)\fR is replaced with the name of a \fIfile\fP
containing its output. (A command substitution, on the other
hand, is replaced with the output itself.)
\fCprint -l\fP is like \fCecho\fP, excepts that it prints its arguments
one per line, the way \fCfgrep\fP expects them:
.Ds
%\0print\0-l\0foo\0bar
foo
bar
.De
We could also have written:
.Ds
%\0who\0|\0fgrep\0-f\0=(echo\0'root
>\0lemke
>\0shgchan
>\0subbarao')
.De
Using\0process\0substitution,
you\0can\0edit\0the\0output\0of\0a\0command:
.Ds
%\0ed\0=(who\0|\0fgrep\0-f\0~/.friends)
355
g/lemke/d
w\0/tmp/filbar
226
q
%\0cat\0/tmp/filbar
root\0\0\0\0\0console\0May\019\010:41
shgchan\0\0ttys1\0\0\0May\023\016:52\0\0\0(gaudi.Princeton.)
subbarao\0ttyt7\0\0\0May\023\015:02\0\0\0(mad55sx15.Prince)
subbarao\0ttyu6\0\0\0May\023\015:04\0\0\0(mad55sx15.Prince)
shgchan\0\0ttyvb\0\0\0May\023\016:51\0\0\0(gaudi.Princeton.)
.De
or easily read archived mail:
.Ds
%\0mail\0-f\0=(zcat\0~/mail/oldzshmail.Z)
"/tmp/zsha06024":\084\0messages,\00\0new,\043\0unread
>\0\01\0\0U\0\0TO:\0pfalstad,\0zsh\0(10)
\0\0\02\0\0U\0\0nytim!tim@uunet.uu.net,\0Re:\0Zsh\0on\0Sparc1\0/SunOS\04.0.3
\0\0\03\0\0U\0\0JAM%TPN@utrcgw.utc.com,\0zsh\0fix\0(15)
\0\0\04\0\0U\0\0djm@eng.umd.edu,\0way\0to\0find\0out\0if\0running\0zsh?\0(25)
\0\0\05\0\0U\0\0djm@eng.umd.edu,\0Re:\0way\0to\0find\0out\0if\0running\0zsh?\0(17)
\0\0\06\0\0\0r\0djm@eng.umd.edu,\0Meta\0.\0(18)
\0\0\07\0\0U\0\0jack@cs.glasgow.ac.uk,\0Re:\0problem\0building\0zsh\0(147)
\0\0\08\0\0U\0\0nytim!tim@uunet.uu.net,\0Re:\0Zsh\0on\0Sparc1\0/SunOS\04.0.3
\0\0\09\0\0\0\0\0ursa!jmd,\0Another\0fix...\0(61)
\0\010\0\0U\0\0pplacewa@bbn.com,\0Re:\0v18i084:\0Zsh\02.00\0-\0A\0small\0complaint\0(36)
\0\011\0\0U\0\0lubkin@cs.rochester.edu,\0POSIX\0job\0control\0(34)
\0\012\0\0U\0\0yale!bronson!tan@uunet.UU.NET
\0\013\0\0U\0\0brett@rpi.edu,\0zsh\0(36)
\0\014\0\0S\0\0subbarao,\0zsh\0sucks!!!!\0(286)
\0\015\0\0U\0\0snibru!d241s008!d241s013!ala@relay.EU.net,\0zsh\0(165)
\0\016\0\0U\0\0nytim!tim@uunet.UU.NET,\0Re:\0Zsh\0on\0Sparc1\0/SunOS\04.0.3
\0\017\0\0U\0\0subbarao,\0zsh\0is\0a\0junk\0shell\0(43)
\0\018\0\0U\0\0amaranth@vela.acs.oakland.edu,\0zsh\0(33)
43u/84\01:\0x
%\0ls\0-l\0/tmp/zsha06024
/tmp/zsha06024\0not\0found
.De
Note that the shell creates a temporary file, and deletes it
when the command is finished.
.Ds
%\0diff\0=(ls)\0=(ls\0-F)
3c3
<\0fortune
---
>\0fortune*
10c10
<\0strfile
---
>\0strfile*
.De
If you read \fBzsh\fP's man page, you may notice that \fC<(\fR...\fC)\fR
is another form of process substitution which is similar to
\fC=(\fR...\fC)\fR.
There is an important difference between the two.
In the \fC<(\fR...\fC)\fR case, the shell creates a named pipe (FIFO)
instead of a file. This is better, since it does not
fill up the file system; but it does not work in all cases.
In fact, if we had replaced \fC=(\fR...\fC)\fR with \fC<(\fR...\fC)\fR in
the examples above, all of them would have stopped working
except for \fCfgrep -f <(\fR...\fC)\fR.
You can not edit a pipe, or open it as a mail folder;
\fCfgrep\fP, however, has no problem with reading
a list of words from a pipe.
You may wonder why \fCdiff <(foo) bar\fP doesn't work, since
\fCfoo | diff - bar\fP works; this is because \fCdiff\fP creates
a temporary file if it notices that one of its arguments
is \fC-\fP, and then copies its standard input to the temporary
file.
.PP
\fC>(\fR...\fC)\fR is just like \fC<(\fR...\fC)\fR except that the
command between the parentheses will get its input from the named
pipe.
.Ds
%\0dvips\0-o\0>(lpr)\0zsh.dvi
.De
.Sh "Redirection"
.PP
Apart from all the regular redirections like the Bourne shell has,
\fBzsh\fP can do more. You can send the output of a command to more
than one file, by specifying more redirections like
.Ds
%\0echo\0Hello\0World\0>file1\0>file2
.De
and the text will end up in both files. Similarly, you can send the
output to a file and into a pipe:
.Ds
%\0make\0>\0make.log\0|\0grep\0Error
.De
The same goes for input. You can make the input of a command come
from more than one file.
.Ds
%\0sort\0<file1\0<file2\0<file3
.De
The command will first get the contents of file1 as its standard
input, then those of file2 and finally the contents of file3. This,
too, works with pipes.
.Ds
%\0cut\0-d:\0-f1\0/etc/passwd\0|\0sort\0<newnames
.De
The sort will get as its standard input first the output of \fCcut\fP
and then the contents of \fCnewnames\fP.
.PP
Suppose you would like to watch the standard output of a command on
your terminal, but want to pipe the standard error to another command.
An easy way to do this in \fBzsh\fP is by redirecting the standard
error using \fC2> >(\fR...\fC)\fR.
.Ds
%\0find\0/\0-name\0games\02>\0>(grep\0-v\0'Permission'\0>\0realerrors)
.De
The above redirection will actually be implemented with a regular
pipe, not a temporary named pipe.
.Sh "Aliasing"
.PP
Often-used commands can be abbreviated with an alias:
.Ds
%\0alias\0uc=uncompress
%\0ls
hanoi.Z
%\0uc\0hanoi
%\0ls
hanoi
.De
or commands with certain desired options:
.Ds
%\0alias\0fm='finger\0-m'
%\0fm\0root
Login\0name:\0root\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0In\0real\0life:\0Operator
Directory:\0/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Shell:\0/bin/csh
On\0since\0May\019\010:41:15\0on\0console\0\0\0\0\03\0days\05\0hours\0Idle\0Time
No\0unread\0mail
No\0Plan.
%\0alias\0lock='lock\0-p\0-60000'
%\0lock
lock:\0/dev/ttyr4\0on\0phoenix.\0timeout\0in\060000\0minutes
time\0now\0is\0Fri\0May\024\004:23:18\0EDT\01991
Key:\0
%\0alias\0l='ls\0-AF'
%\0l\0/
\&.bash_history\0\0\0\0\0\0\0\0\0\0\0\0\0\0kadb*
\&.bashrc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0lib@
\&.cshrc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0licensed/
\&.exrc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0lost+found/
\&.login\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0macsyma
\&\fR...
.De
Aliases can also be used to replace old commands:
.Ds
%\0alias\0grep=egrep\0ps=sps\0make=gmake
%\0alias\0whoami='echo\0root'
%\0whoami
root
.De
or to define new ones:
.Ds
%\0cd\0/
%\0alias\0sz='ls\0-l\0|\0sort\0-n\0+3\0|\0tail\0-10'
%\0sz
drwxr-sr-x\0\07\0bin\0\0\0\0\0\0\0\0\0\03072\0May\023\011:59\0etc
drwxrwxrwx\026\0root\0\0\0\0\0\0\0\0\05120\0May\024\004:20\0tmp
drwxr-xr-x\0\02\0root\0\0\0\0\0\0\0\0\08192\0Dec\026\019:34\0lost+found
drwxr-sr-x\0\02\0bin\0\0\0\0\0\0\0\0\014848\0May\023\018:48\0dev
-r--r--r--\0\01\0root\0\0\0\0\0\0\0140520\0Dec\026\020:08\0boot
-rwxr-xr-x\0\01\0root\0\0\0\0\0\0\0311172\0Dec\026\020:08\0kadb
-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209695\0Apr\016\015:33\0vmunix.old
-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209702\0May\014\019:04\0vmunix
-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209758\0May\021\012:23\0vmunix.new.kernelmap.old
-rwxr-xr-x\0\01\0root\0\0\0\0\0\01711848\0Dec\026\020:08\0vmunix.org
%\0cd
%\0alias\0rable='ls\0-AFtrd\0*(R)'\0nrable='ls\0-AFtrd\0*(^R)'
%\0rable
README\0\0\0\0\0\0func/\0\0\0\0\0\0\0bin/\0\0\0\0\0\0\0\0pub/\0\0\0\0\0\0\0\0News/\0\0\0\0\0\0\0src/
nicecolors\0\0etc/\0\0\0\0\0\0\0\0scr/\0\0\0\0\0\0\0\0tmp/\0\0\0\0\0\0\0\0iris/\0\0\0\0\0\0\0zsh*
%\0nrable
Mailboxes/\0\0mail/\0\0\0\0\0\0\0notes
.De
(The pattern \fC*(R)\fP matches all readable files in the current
directory, and \fC*(^R)\fP matches all unreadable files.)
.PP
Most other shells have aliases of this kind (\fIcommand\fP aliases).
However, \fBzsh\fP also has \fIglobal\fP aliases, which are substituted
anywhere on a line.
Global aliases can be used to abbreviate frequently-typed
usernames, hostnames, etc.
.Ds
%\0alias\0-g\0me=pfalstad\0gun=egsirer\0mjm=maruchck
%\0who\0|\0grep\0me
pfalstad\0ttyp0\0\0\0May\024\003:39\0\0\0(mickey.Princeton)
pfalstad\0ttyp5\0\0\0May\024\003:42\0\0\0(mickey.Princeton)
%\0fm\0gun
Login\0name:\0egsirer\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0In\0real\0life:\0Emin\0Gun\0Sirer
Directory:\0/u/egsirer\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Shell:\0/bin/sh
Last\0login\0Thu\0May\023\019:05\0on\0ttyq3\0from\0bow.Princeton.ED
New\0mail\0received\0Fri\0May\024\002:30:28\01991;
\0\0unread\0since\0Fri\0May\024\002:30:27\01991
%\0alias\0-g\0phx=phoenix.princeton.edu\0warc=wuarchive.wustl.edu
%\0ftp\0warc
Connected\0to\0wuarchive.wustl.edu.
.De
Here are some more interesting uses.
.Ds
%\0alias\0-g\0M='|\0more'\0GF='|\0fgrep\0-f\0~/.friends'
%\0who\0M\0\0\0#\0\fIpipes\0the\0output\0of\0\fCwho\fI\0through\0\fCmore
%\0who\0GF\0\0#\0\fIsee\0if\0your\0friends\0are\0on\fC
%\0w\0GF\0\0\0\0#\0\fIsee\0what\0your\0friends\0are\0doing
.De
Another example makes use of \fBzsh\fP's process substitution.
If you run NIS, and you miss being able to do this:
.Ds
%\0grep\0pfalstad\0/etc/passwd
.De
you can define an alias that will seem more natural
than \fCypmatch pfalstad passwd\fP:
.Ds
%\0alias\0-g\0PASS='<(ypcat\0passwd)'
%\0grep\0pfalstad\0PASS
pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh
.De
If you're really crazy, you can even call it \fC/etc/passwd\fP:
.Ds
%\0alias\0-g\0/etc/passwd='<(ypcat\0passwd)'
%\0grep\0pfalstad\0/etc/passwd
pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh
.De
The last example shows one of the perils of global aliases;
they have a lot of potential to cause confusion.
For example, if you defined a global alias called \fC|\fP (which is
possible), \fBzsh\fP would begin to act very strangely; every pipe
symbol would be replaced with the text of your alias.
To some extent, global aliases are like macros in C;
discretion is advised in using them and in choosing names for them.
Using names in all caps is not a bad idea, especially
for aliases which introduce shell metasyntax (like \fCM\fP and \fCGF\fP
above).
.PP
Note that \fBzsh\fP aliases are not like csh aliases. The syntax for
defining them is different, and they do not have arguments.
All your favorite csh aliases will probably not work under \fBzsh\fP.
For example, if you try:
.Ds
alias\0rm\0mv\0'\e!*\0/tmp/wastebasket'
.De
no aliases will be defined, but \fBzsh\fP will not report an error.
In csh, this line defines an alias that makes \fCrm\fP safe---files
that are \fCrm\fP'd will be moved to a temporary directory instead of
instantly destroyed. In \fBzsh\fP's syntax, however, this line asks
the shell to print any existing alias definitions for \fCrm\fP,
\fCmv\fP, or \fC!*\ /tmp/wastebasket\fP. Since there are none, most
likely, the shell will not print anything, although \fCalias\fP will
return a nonzero exit code. The proper syntax is this:
.Ds
alias\0rm='mv\0\e!*\0/tmp/wastebasket'
.De
However, this won't work either:
.Ds
%\0rm\0foo.dvi
zsh:\0no\0matches\0found:\0!*
.De
While this makes \fCrm\fP safe, it is certainly not what the user
intended. In \fBzsh\fP, you must use a shell function for this:
.Ds
%\0unalias\0rm
%\0rm\0()\0{\0mv\0$*\0/tmp/wastebasket\0}
%\0rm\0foo.dvi
%\0ls\0/tmp/wastebasket
foo.dvi
.De
While this is much cleaner and easier to read (I hope you will
agree), it is not csh-compatible. Therefore, a script to convert
csh aliases and variables has been provided. You should only need to use it
once, to convert all your csh aliases and parameters to \fBzsh\fP format:
.Ds
%\0csh
csh>\0alias
l\0\0\0\0\0\0\0ls\0-AF
more\0\0\0\0less
on\0\0\0\0\0\0last\0-2\0!:1\0;\0who\0|\0grep\0!:1
csh>\0exit
%\0c2z\0>neat_zsh_aliases
%\0cat\0neat_zsh_aliases
alias\0l='ls\0-AF'
alias\0more='less'
on\0()\0{\0last\0-2\0$1\0;\0who\0|\0grep\0$1\0}
\&...
.De
The first two aliases were converted to regular \fBzsh\fP aliases, while
the third, since it needed to handle arguments, was converted to
a function. \fCc2z\fP can convert most aliases to \fBzsh\fP format without
any problems. However, if you're using some really arcane csh tricks,
or if you have an alias with a name like \fCdo\fP (which is reserved
in \fBzsh\fP), you may have to fix some of the aliases by hand.
.PP
The \fCc2z\fP script checks your csh setup, and produces a list
of \fBzsh\fP commands which replicate your aliases and parameter settings
as closely as possible. You could include its output in your
startup file, \fC.zshrc\fP.
.Sh "History"
.PP
There are several ways to manipulate history in \fBzsh\fP.
One way is to use csh-style \fC!\fP history:
.Ds
%\0/usr/local/bin/!:0\0!-2*:s/foo/bar/\0>>!$
.De
If you don't want to use this, you can turn it off
by typing \fCsetopt nobanghist\fP. If you are afraid of accidentally
executing the wrong command you can set the \fIHISTVERIFY\fP option.
If this option is set, commands that result from history expansion
will not be executed immediately, but will be put back into the editor
buffer for further consideration.
.PP
If you're not familiar with \fC!\fP history, here follows some
explanation. History substitutions always start with a \fC!\fP,
commonly called \*Qbang\*U. After the \fC!\fP comes an (optional)
designation of which \*Qevent\*U (command) to use, then a colon, and
then a designation of what word of that command to use. For example,
\fC!-\fIn\fR refers to the command \fIn\fP commands ago.
.Ds
%\0ls
foo\0\0bar
%\0cd\0foo
%\0!-2
ls
baz\0\0bam
.De
No word designator was used, which means that the whole command
referred to was repeated. Note that the shell will echo the result of
the history substitution. The word designator can, among other
things, be a number indicating the argument to use, where \fC0\fP is
the command.
.Ds
%\0/usr/bin/ls\0foo
foo
%\0!:0\0bar
/usr/bin/ls\0bar
bar
.De
In this example, no event designator was used, which tells \fBzsh\fP
to use the previous command. A \fC$\fP specifies the last argument
.Ds
%\0mkdir\0/usr/local/lib/emacs/site-lisp/calc
%\0cd\0!:$
cd\0/usr/local/lib/emacs/site-lisp/calc
.De
If you use more words of the same command, only the first \fC!\fP
needs an event designator.
.Ds
%\0make\0prig\0>>\0make.log
make:\0***\0No\0rule\0to\0make\0target\0`prig'.\0\0Stop.
%\0cd\0src
%\0!-2:0\0prog\0>>\0!:$
make\0prog\0>>\0make.log
.De
This is different from csh, where a bang with no event designator
always refers to the previous command. If you actually like this
behaviour, set the \fICSHJUNKIEHISTORY\fP option.
.Ds
%\0setopt\0cshjunkiehistory
%\0!-2:0\0prog2\0>>\0!:$
make\0prog2\0>>\0cshjunkiehistory
.De
Another way to use history is to use the \fCfc\fP command. For
example, if you type an erroneous command:
.Ds
%\0for\0i\0in\0`cat\0/etc/clients`\0
\0do\0
\0rpu\0$i\0
\0done
zsh:\0command\0not\0found:\0rpu
zsh:\0command\0not\0found:\0rpu
zsh:\0command\0not\0found:\0rpu
\&\fR...
.De
typing \fCfc\fP will execute an editor on this command, allowing
you to fix it. (The default editor is \fCvi\fP, by the way,
not \fCed\fP).
.Ds
%\0fc
49
/rpu/s//rup/p
\0rup\0$i\0
w
49
q
for\0i\0in\0`cat\0/etc/clients`\0
\0do\0
\0rup\0$i\0
\0done
\0\0\0\0\0\0\0\0beam\0\0\0\0up\0\02\0days,\010:17,\0\0\0\0load\0average:\00.86,\00.80,\00.50
\0\0\0\0\0\0\0\0\0bow\0\0\0\0up\0\04\0days,\0\08:41,\0\0\0\0load\0average:\00.91,\00.80,\00.50
\0\0\0\0\0\0\0\0burn\0\0\0\0up\0\0\0\0\0\0\0\0\0\017:18,\0\0\0\0load\0average:\00.91,\00.80,\00.50
\0\0\0\0\0\0\0burst\0\0\0\0up\0\09\0days,\0\01:49,\0\0\0\0load\0average:\00.95,\00.80,\00.50
\0\0\0\0\0\0\0\0\0tan\0\0\0\0up\0\0\0\0\0\0\0\0\0\011:14,\0\0\0\0load\0average:\00.91,\00.80,\00.50
\0\0\0\0\0\0\0bathe\0\0\0\0up\0\03\0days,\017:49,\0\0\0\0load\0average:\01.84,\01.79,\01.50
\0\0\0\0\0\0\0\0bird\0\0\0\0up\0\01\0day,\0\0\09:13,\0\0\0\0load\0average:\01.95,\01.82,\01.51
\0\0\0\0\0\0bonnet\0\0\0\0up\0\02\0days,\021:18,\0\0\0\0load\0average:\00.93,\00.80,\00.50
\&\fR...
.De
A variant of the \fCfc\fP command is \fCr\fP, which redoes the last
command, with optional changes:
.Ds
%\0echo\0foo
foo
%\0r
echo\0foo
foo
%\0echo\0foo
foo
%\0r\0foo=bar
echo\0bar
bar
.De
.Sh "Command Line Editing"
.PP
\fBzsh\fP's command line editor, \fBZLE\fP, is quite powerful.
It is designed to emulate either emacs or vi; the default
is emacs. To set the bindings for vi mode, type \fCbindkey -v\fP. If
your \fBEDITOR\fP or \fBVISUAL\fP environment variable is vi,
\fBzsh\fP will use vi emulation by default. You can then switch to
emacs mode with \fCbindkey -e\fP.
.PP
In addition to basic editing, the shell allows you to
recall previous lines in the history. In emacs mode,
this is done with \fI^P\fP (control-P) or (on many terminals) with the
cursor-up key:
.Ds
%\0ls\0~
-\0\0\0\0\0\0\0\0\0\0\0README\0\0\0\0\0\0file\0\0\0\0\0\0\0\0mail\0\0\0\0\0\0\0\0pub\0\0\0\0\0\0\0\0\0tmp
Mailboxes\0\0\0bin\0\0\0\0\0\0\0\0\0func\0\0\0\0\0\0\0\0nicecolors\0\0scr\0\0\0\0\0\0\0\0\0zsh
News\0\0\0\0\0\0\0\0etc\0\0\0\0\0\0\0\0\0iris\0\0\0\0\0\0\0\0notes\0\0\0\0\0\0\0src
%\0echo\0foobar
foobar
%\0\fI^P\fC
%\0echo\0foobar\fI^P\fC
%\0ls\0~_
.De
Pressing \fI^P\fP once brings up the previous line (\fCecho foobar\fP);
pressing it again brings up the line before that (\fCls ~\fP).
The cursor is left at the end of the line, allowing you to
edit the line if desired before executing it.
In many cases, \fBZLE\fP eliminates the need for the \fCfc\fP command,
since it is powerful enough to handle even multiline commands:
.Ds
%\0for\0i\0in\0a\0b\0c\0d\0e
>\0do
>\0echo\0$i
>\0done
a
b
c
d
e
%\0\fI^P\fC
%\0for\0i\0in\0a\0b\0c\0d\0e\0
\0do\0
\0echo\0$i\0
\0done_
.De
Now you can just move up to the part you want to change...
.Ds
%\0for\0i\0in\0\kxa\l'|\nxu\(ul'\0b\0c\0d\0e
\0do\0
\0echo\0$i\0
\0done
.De
change it, and execute the new command.
.Ds
%\0for\0i\0in\0f\0g\0h\0i\0j
\0do\0
\0echo\0$i\0
\0done
f
g
h
i
j
.De
Also, you can search the history for a certain command using
\fIESC-P\fP, this will look for the last command that started with the
(part of the) word at the beginning of the current line. Hitting
\fIESC-P\fP another time gets you the command before that, etc.
.Ds
%\0set\0\fIESC-P\fC
%\0setopt\0autolist\0\fIESC-P\fC
%\0setopt\0nocorrect_
.De
Another way is to do an incremental search, emacs-style:
.Ds
%\0\fI^R\fC
%\0_
i-search:
%\0l\kxs\l'|\nxu\(ul'\0/usr/bin
i-search:\0l
%\0date\0>\0foofile\kx.\l'|\nxu\(ul'c
i-search:\0le
.De
Suppose you have retrieved an old history event in one of these ways
and would like to execute several consecutive old commands starting
with this one. \fC^O\fP will execute the current command and then put
the next command from the history into the editor buffer. Typing
\fC^O\fP several times will therefore reexecute several consecutive
commands from the history. Of course, you can edit some of those
commands in between.
.PP
In addition to completion (see below), \fITAB\fP performs expansion if
possible.
.Ds
%\0ls\0*.c\fITAB\fC
%\0ls\0foofile.c\0fortune.c\0rnd.c\0strfile.c\0unstr.c_
.De
For example, suppose you have a bunch of weird files in an important
directory:
.Ds
%\0ls
\0\0*\0*\0*\0\0\0\0\0\0\0;\0&\0%\0$??foo\0\0dspfok\0\0\0\0\0\0\0\0foo.c
\0\0!"foo"!\0\0\0\0\0\0\0`\0\e\0`\0\0\0\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0\0\0\0rrr
.De
You want to remove them, but you don't want to damage \fCfoo.c\fP.
Here is one way to do this:
.Ds
%\0rm\0*\fITAB\fC
%\0rm\0\e\0\e\0\e*\e\0\e*\e\0\e*\e\0\e\0\e\0\0\e!\e"foo\e"\e!\0\e;\e\0\e&\e\0%\e\0\e$'
''
'foo\0\e`\e\0\e\e\e\0\e`\0dspfok\0foo\0foo.c\0rrr_
.De
When you expand \fC*\fP, \fBzsh\fP inserts the names of all the files
into the editing buffer, with proper shell quoting.
Now, just move back and remove \fCfoo.c\fP from the buffer:
.Ds
%\0rm\0\e\0\e\0\e*\e\0\e*\e\0\e*\e\0\e\0\e\0\0\e!\e"foo\e"\e!\0\e;\e\0\e&\e\0%\e\0\e$'
''
'foo\0\e`\e\0\e\e\e\0\e`\0dspfok\0foo\0\kxr\l'|\nxu\(ul'rr
.De
and press return.
Everything except \fCfoo.c\fP will be deleted from the directory. If
you do not want to actually expand the current word, but would like to
see what the matches are, type \fC^Xg\fP.
.Ds
%\0rm\0f*\fI^Xg\fP
foo\0\0\0\0foo.c
%\0rm\0f*_
.De
Here's another trick; let's say you have typed this command in:
.Ds
%\0gcc\0-o\0x.out\0foob.c\0-g\0-Wpointer-arith\0-Wtrigraphs_
.De
and you forget which library you want. You need to escape
out for a minute and check by typing
\fCls /usr/lib\fP, or some other such command;
but you don't want to retype the whole command again,
and you can't press return now because the current command
is incomplete.
In \fBzsh\fP, you can put the line on the \fIbuffer stack\fP, using
\fIESC-Q\fP, and type some other commands. The next time a prompt is printed,
the \fCgcc\fP line will be popped off the stack and put
in the editing buffer automatically; you can then enter the
proper library name and press return (or, \fIESC-Q\fP again and look
for some other libraries whose names you forgot).
.PP
A similar situation: what if you forget the option to gcc that
finds bugs using AI techniques? You could either use \fIESC-Q\fP
again, and type \fCman gcc\fP, or you could press \fIESC-H\fP, which
essentially does the same thing; it puts the current line on
the buffer stack, and executes the command \fCrun-help gcc\fP,
where \fCrun-help\fP is an alias for \fCman\fP.
.PP
Another interesting command is \fIESC-A\fP. This executes the
current line, but retains it in the buffer, so that it appears
again when the next prompt is printed.
Also, the cursor stays in the same place.
This is useful for executing a series of similar commands:
.Ds
%\0cc\0grok.c\0-g\0-lc\0-lgl\0-lsun\0-lmalloc\0-Bstatic\0-o\0b.out
%\0cc\0fubar.c\0-g\0-lc\0-lgl\0-lsun\0-lmalloc\0-Bstatic\0-o\0b.out
%\0cc\0fooble.c\0-g\0-lc\0-lgl\0-lsun\0-lmalloc\0-Bstatic\0-o\0b.out
.De
.PP
The \fIESC-'\fP command is useful for managing the shell's quoting
conventions. Let's say you want to print this string:
.Ds
don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*.
.De
All that is necessary is to type it into the editing buffer:
.Ds
%\0don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*.
.De
press \fIESC-'\fP (escape-quote):
.Ds
%\0'don'\e''t\0do\0that;\0type\0'\e''rm\0-rf\0\e*'\e'',\0with\0a\0\e\0before\0the\0*.'
.De
then move to the beginning and add the \fCecho\fP command.
.Ds
%\0echo\0'don'\e''t\0do\0that;\0type\0'\e''rm\0-rf\0\e*'\e'',\0with\0a\0\e\0before\0the\0*.'
don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*.
.De
Let's say you want to create an alias to do this \fCecho\fP command.
This can be done by recalling the line with \fI^P\fP and pressing
\fIESC-'\fP again:
.Ds
%\0'echo\0'\e''don'\e''\e'\e'''\e''t\0do\0that;\0type\0'\e''\e'\e'''\e''rm\0-rf
\e*'\e''\e'\e'''\e'',\0with\0a\0\e\0before\0the\0*.'\e'''
.De
and then move to the beginning and add the command to create
an alias.
.Ds
%\0alias\0zoof='echo\0'\e''don'\e''\e'\e'''\e''t\0do\0that;\0type\0'\e''\e'\e'''\e''rm
-rf\0\e*'\e''\e'\e'''\e'',\0with\0a\0\e\0before\0the\0*.'\e'''
%\0zoof
don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*.
.De
If one of these fancy editor commands changes your command line in a
way you did not intend, you can undo changes with \fC^_\fP, if you can
get it out of your keyboard, or \fC^X^U\fP, otherwise.
.PP
Another use of the editor is to edit the value of variables.
For example, an easy way to change your path is to use
the \fCvared\fP command:
.Ds
%\0vared\0PATH
>\0/u/pfalstad/scr:/u/pfalstad/bin/sun4:/u/maruchck/scr:/u/subbarao/bin:/u/maruc
hck/bin:/u/subbarao/scripts:/usr/princeton/bin:/usr/ucb:/usr/bin:/bin:/usr/host
s:/usr/princeton/bin/X11:/./usr/lang:/./usr/etc:/./etc
.De
You can now edit the path. When you press return, the contents
of the edit buffer will be assigned to \fBPATH\fP.
.Sh "Completion"
.PP
Another great \fBzsh\fP feature is completion. If you hit \fITAB\fP, \fBzsh\fP
will complete all kinds of stuff. Like commands or filenames:
.Ds
%\0comp\fITAB\fC
%\0compress\0_
%\0ls\0nic\fITAB\fC
%\0ls\0nicecolors\0_
%\0ls\0/usr/pr\fITAB\fC
%\0ls\0/usr/princeton/_
%\0ls\0-l\0=com\fITAB\fC
%\0ls\0-l\0=compress\0_
.De
If the completion is ambiguous, the editor will beep. If you find
this annoying, you can set the \fINOLISTBEEP\fP option. Completion
can even be done in the middle of words. To use this, you will have
to set the \fICOMPLETEINWORD\fP option:
.Ds
%\0setopt\0completeinword
%\0ls\0/usr/p\kxt\l'|\nxu\(ul'on\fITAB\fC
%\0ls\0/usr/prince\kxt\l'|\nxu\(ul'on/
%\0setopt\0alwaystoend
%\0ls\0/usr/p\kxt\l'|\nxu\(ul'on\fITAB\fC
%\0ls\0/usr/princeton/_
.De
You can list possible completions by pressing \fI^D\fP:
.Ds
%\0ls\0/vmu\fITAB\0\(embeep\(em\fC
%\0ls\0/vmunix_
%\0ls\0/vmunix\fI^D\fC
vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
vmunix.new.kernelmap.old\0\0vmunix.org
.De
Or, you could just set the \fIAUTOLIST\fP option:
.Ds
%\0setopt\0autolist
%\0ls\0/vmu\fITAB\0\(embeep\(em\fC
vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
vmunix.new.kernelmap.old\0\0vmunix.org
%\0ls\0/vmunix_
.De
If you like to see the types of the files in these lists, like in
\fCls\ -F\fP, you can set the \fILISTTYPES\fP option. Together with
\fIAUTOLIST\fP you can use \fILISTAMBIGUOUS\fP. This will only list
the possibilities if there is no unambiguous part to add:
.Ds
%\0setopt\0listambiguous
%\0ls\0/vmu\fITAB\0\(embeep\(em\fC
%\0ls\0/vmunix_\fITAB\0\(embeep\(em\fC
vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
vmunix.new.kernelmap.old\0\0vmunix.org
.De
If you don't want several of these listings to scroll the screen so
much, the \fIALWAYSLASTPROMPT\fP option is useful. If set, you can
continue to edit the line you were editing, with the completion
listing appearing beneath it.
.PP
Another interesting option is \fIMENUCOMPLETE\fP. This affects the
way \fITAB\fP works. Let's look at the \fC/vmunix\fP example again:
.Ds
%\0setopt\0menucomplete
%\0ls\0/vmu\fITAB\fC
%\0ls\0/vmunix\fITAB\fC
%\0ls\0/vmunix.new.kernelmap.old\fITAB\fC
%\0ls\0/vmunix.old_
.De
Each time you press \fITAB\fP, it displays the next possible completion.
In this way, you can cycle through the possible completions until
you find the one you want.
.PP
The \fIAUTOMENU\fP option makes a nice compromise between this method
of completion and the regular method. If you set this option,
pressing \fITAB\fP once completes the unambiguous part normally,
pressing the \fITAB\fP key repeatedly after an ambiguous completion
will cycle through the possible completions.
.PP
Another option you could set is \fIRECEXACT\fP, which causes
exact matches to be accepted, even if there are other possible
completions:
.Ds
%\0setopt\0recexact
%\0ls\0/vmu\fITAB\0\(embeep\(em\fC
vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
vmunix.new.kernelmap.old\0\0vmunix.org
%\0ls\0/vmunix_\fITAB\fC
%\0ls\0/vmunix\0_
.De
To facilitate the typing of pathnames, a slash will be added whenever
a directory is completed. Some computers don't like the spurious
slashes at the end of directory names. In that case, the
\fIAUTOREMOVESLASH\fP option comes to rescue. It will remove these
slashes when you type a space or return after them.
.PP
The \fIfignore\fP variable lists suffixes of files to ignore
during completion.
.Ds
%\0ls\0foo\fITAB\0\(embeep\(em\fC
foofile.c\0\0foofile.o
%\0fignore=(\0.o\0\e~\0.bak\0.junk\0)
%\0ls\0foo\fITAB\fP
%\0ls\0foofile.c\0_
.De
Since \fCfoofile.o\fP has a suffix that is in the \fCfignore\fP list,
it was not considered a possible completion of \fCfoo\fP.
.PP
Username completion is also supported:
.Ds
%\0ls\0~pfal\fITAB\fC
%\0ls\0~pfalstad/_
.De
and parameter name completion:
.Ds
%\0echo\0$ORG\fITAB\fC
%\0echo\0$ORGANIZATION\0_
%\0echo\0${ORG\fITAB\fC
%\0echo\0${ORGANIZATION\0_
.De
Note that in the last example a space is added after the completion as
usual. But if you want to add a colon or closing brace, you probably
don't want this extra space. Setting the \fIAUTOPARAMKEYS\fP option
will automatically remove this space if you type a colon or closing
brace after such a completion.
.PP
There is also option completion:
.Ds
%\0setopt\0nocl\fITAB\fC
%\0setopt\0noclobber\0_
.De
and binding completion:
.Ds
%\0bindkey\0'^X^X'\0pu\fITAB\fC
%\0bindkey\0'^X^X'\0push-line\0_
.De
The \fCcompctl\fP command is used to control completion of the
arguments of specific commands. For example, to specify that certain
commands take other commands as arguments, you use \fCcompctl -c\fP:
.Ds
%\0compctl\0-c\0man\0nohup
%\0man\0upt\fITAB\fC
%\0man\0uptime\0_
.De
To specify that a command should complete filenames, you should use
\fCcompctl -f\fP. This is the default. It can be combined with \fC-c\fP,
as well.
.Ds
%\0compctl\0-cf\0echo
%\0echo\0upt\fITAB\fC
%\0echo\0uptime\0_
%\0echo\0fo\fITAB\fC
%\0echo\0foo.c
.De
Similarly, use \fC-o\fP to specify options, \fC-v\fP to specify
variables, and \fC-b\fP to specify bindings.
.Ds
%\0compctl\0-o\0setopt\0unsetopt
%\0compctl\0-v\0typeset\0vared\0unset\0export
%\0compctl\0-b\0bindkey
.De
You can also use \fC-k\fP to specify a custom list of keywords to use
in completion. After the \fC-k\fP comes either the name of an array
or a literal array to take completions from.
.Ds
%\0ftphosts=(ftp.uu.net\0wuarchive.wustl.edu)
%\0compctl\0-k\0ftphosts\0ftp
%\0ftp\0wu\fITAB\fC
%\0ftp\0wuarchive.wustl.edu\0_
%\0compctl\0-k\0'(cpirazzi\0subbarao\0sukthnkr)'\0mail\0finger
%\0finger\0cp\fITAB\fC
%\0finger\0cpirazzi\0_
.De
To better specify the files to complete for a command, use the
\fC-g\fP option which takes any glob pattern as an argument. Be sure
to quote the glob patterns as otherwise they will be expanded when the
\fCcompctl\fP command is run.
.Ds
%\0ls
letter.tex\0\0letter.dvi\0\0letter.aux\0\0letter.log\0\0letter.toc
%\0compctl\0-g\0'*.tex'\0latex
%\0compctl\0-g\0'*.dvi'\0xdvi\0dvips
%\0latex\0l\fITAB\fC
%\0latex\0letter.tex\0_
%\0xdvi\0l\fITAB\fC
%\0xdvi\0letter.dvi\0_
.De
Glob patterns can include qualifiers within parentheses. To rmdir
only directories and cd to directories and symbolic links pointing to
them:
.Ds
%\0compctl\0-g\0'*(-/)'\0cd
%\0compctl\0-g\0'*(/)'\0rmdir
.De
RCS users like to run commands on files which are not in the current
directory, but in the RCS subdirectory where they all get \fC,v\fP
suffixes. They might like to use
.Ds
%\0compctl\0-g\0'RCS/*(:t:s/\e,v//)'\0co\0rlog\0rcs
%\0ls\0RCS
builtin.c,v\0\0lex.c,v\0\0\0\0\0\0zle_main.c,v
%\0rlog\0bu\fITAB\fC
%\0rlog\0builtin.c\0_
.De
The \fC:t\fP modifier keeps only the last part of the pathname and the
\fC:s/\e,v//\fP will replace any \fC,v\fP by nothing.
.PP
The \fC-s\fP flag is similar to \fC-g\fP, but it uses all expansions,
instead of just globbing, like brace expansion, parameter substitution
and command substitution.
.Ds
%\0compctl\0-s\0'$(setopt)'\0unsetopt
.De
will only complete options which are actually set to be arguments to
\fCunsetopt\fP.
.PP
Sometimes a command takes another command as its argument. You can
tell \fBzsh\fP to complete commands as the first argument to such a
command and then use the completion method of the second command. The
\fC-l\fP flag with a null-string argument is used for this.
.Ds
%\0compctl\0-l\0''\0nohup\0exec
%\0nohup\0comp\fITAB\fC
%\0nohup\0compress\0_
%\0nohup\0compress\0fil\fITAB\fC
%\0nohup\0compress\0filename\0_
.De
Sometimes you would like to run really complicated commands to find
out what the possible completions are. To do this, you can specify a
shell function to be called that will assign the possible completions
to a variable called reply. Note that this variable must be an array.
Here's another (much slower) way to get the completions for \fCco\fP
and friends:
.Ds
%\0function\0getrcs\0{
>\0reply=()
>\0for\0i\0in\0RCS/*
>\0\0\0do
>\0\0\0reply=($reply[*]\0$(basename\0$i\0,v))
>\0\0\0done
>\0}
%\0compctl\0-K\0getrcs\0co\0rlog\0rcs
.De
Some command arguments use a prefix that is not a part of the things
to complete. The kill builtin command takes a signal name after a
\fC-\fP. To make such a prefix be ignored in the completion process,
you can use the \fC-P\fP flag.
.Ds
%\0compctl\0-P\0-\0-k\0signals\0kill
%\0kill\0-H\fITAB\fP
%\0kill\0-HUP\0_
.De
TeX is usually run on files ending in \fC.tex\fP, but also sometimes
on other files. It is somewhat annoying to specify that the arguments
of TeX should end in \fC.tex\fP and then not be able to complete these
other files. Therefore you can specify things like \*QComplete to
files ending in \fC.tex\fP if available, otherwise complete to any
filename.\*U. This is done with \fIxor\fPed completion:
.Ds
%\0compctl\0-g\0'*.tex'\0+\0-f\0tex
.De
The \fC+\fP tells the editor to only take the next thing into account
if the current one doesn't generate any matches. If you have not
changed the default completion, the above example is in fact
equivalent to
.Ds
%\0compctl\0-g\0'*.tex'\0+\0tex
.De
as a lone \fC+\fP at the end is equivalent to specifying the default
completion after the \fC+\fP. This form of completion is also
frequently used if you want to run some command only on a certain type
of files, but not necessarily in the current directory. In this case
you will want to complete both files of this type and directories.
Depending on your preferences you can use either of
.Ds
%\0compctl\0-g\0'*.ps'\0+\0-g\0'*(-/)'\0ghostview
%\0compctl\0-g\0'*.ps\0*(-/)'\0ghostview
.De
where the first one will only complete directories (and symbolic links
pointing to directories) if no postscript file matches the already
typed part of the argument.
.Sh "Extended completion"
.PP
If you play with completion, you will soon notice that you would like
to specify what to complete, depending on what flags you give to the
command and where you are on the command line. For example, a command
could take any filename argument after a \fC-f\fP flag, a username
after a \fC-u\fP flag and an executable after a \fC-x\fP flag. This
section will introduce you to the ways to specify these things. To
many people it seems rather difficult at first, but taking the trouble
to understand it can save you lots of typing in the end. Even I keep
being surprised when \fBzsh\fP manages to complete a small or even
empty prefix to the right file in a large directory.
.PP
To tell \fBzsh\fP about these kinds of completion, you use \*Qextended
completion\*U by specifying the \fC-x\fP flag to compctl. The
\fC-x\fP flag takes a list of patterns/flags pairs. The patterns
specify when to complete and the flags specify what. The flags are
simply those mentioned above, like \fC-f\fP or \fC-g \fIglob
pattern\fR.
.PP
As an example, the \fCr[\fIstring1\fC,\fIstring2\fC]\fR pattern
matches if the cursor is after something that starts with
\fIstring1\fP and before something that starts with \fIstring2\fP.
The \fIstring2\fP is often something that you do not want to match
anything at all.
.Ds
%\0ls
foo1\0\0\0bar1\0\0\0foo.Z\0\0bar.Z
%\0compctl\0-g\0'^*.Z'\0-x\0'r[-d,---]'\0-g\0'*.Z'\0--\0compress
%\0compress\0f\fITAB\fP
%\0compress\0foo1\0_
%\0compress\0-d\0f\fITAB\fP
%\0compress\0-d\0foo.Z\0_
.De
In the above example, if the cursor is after the \fC-d\fP the pattern
will match and therefore \fBzsh\fP uses the \fC-g *.Z\fP flag that will only
complete files ending in \fC.Z\fP. Otherwise, if no pattern matches,
it will use the flags before the \fC-x\fP and in this case complete
every file that does not end in \fC.Z\fP.
.PP
The \fCs[\fIstring\fC]\fR pattern matches if the current word starts
with \fIstring\fP. The \fIstring\fP itself is not considered to be
part of the completion.
.Ds
%\0compctl\0-x\0's[-]'\0-k\0signals\0--\0kill
%\0kill\0-H\fITAB\fP
%\0kill\0-HUP\0_
.De
The \fCtar\fP command takes a tar file as an argument after the
\fC-f\fP option. The \fCc[\fIoffset\fC,\fIstring\fC]\fR pattern
matches if the word in position \fIoffset\fP relative to the current
word is \fIstring\fP. More in particular, if \fIoffset\fP is -1, it
matches if the previous word is \fIstring\fP. This suggests
.Ds
%\0compctl\0-f\0-x\0'c[-1,-f]'\0-g\0'*.tar'\0--\0tar
.De
But this is not enough. The \fC-f\fP option could be the last of a
longer string of options. \fCC[\fR...\fC,\fR...\fC]\fR is just like
\fCc[\fR...\fC,\fR...\fC]\fR, except that it uses glob-like pattern
matching for \fIstring\fP. So
.Ds
%\0compctl\0-f\0-x\0'C[-1,-*f]'\0-g\0'*.tar'\0--\0tar
.De
will complete tar files after any option string ending in an \fCf\fP.
But we'd like even more. Old versions of tar used all options as the
first argument, but without the minus sign. This might be
inconsistent with option usage in all other commands, but it is still
supported by newer versions of \fCtar\fP. So we would also like to
complete tar files if the first argument ends in an \fCf\fP and we're
right behind it.
.PP
We can `and' patterns by putting them next to each other with a space
between them. We can `or' these sets by putting comma's between them.
We will also need some new patterns. \fCp[\fInum\fC]\fR will match if
the current argument (the one to be completed) is the \fInum\fPth
argument. \fCW[\fIindex\fC,\fIpattern\fC]\fR will match if the
argument in place \fIindex\fP matches the \fIpattern\fP. This gives
us
.Ds
%\0compctl\0-f\0-x\0'C[-1,-*f]\0,\0W[1,*f]\0p[2]'\0-g\0'*.tar'\0--\0tar
.De
In words: If the previous argument is an option string that ends in an
\fCf\fP, or the first argument ended in an \fCf\fP and it is now the
second argument, then complete only filenames ending in \fC.tar\fP.
.PP
All the above examples used only one set of patterns with one
completion flag. You can use several of these pattern/flag pairs
separated by a \fC-\fP. The first matching pattern will be used.
Suppose you have a version of \fCtar\fP that supports compressed files
by using a \fC-Z\fP option. Leaving the old tar syntax aside for a
moment, we would like to complete files ending in \fC.tar.Z\fP if a
\fC-Z\fP option has been used and files ending in \fC.tar\fP
otherwise, all this only after a \fC-f\fP flag. Again, the \fC-Z\fP
can be alone or it can be part of a longer option string, perhaps the
same as that of the \fC-f\fP flag. Here's how to do it; note the
backslash and the secondary prompt which are not part of the
\fCcompctl\fP command.
.Ds
%\0compctl\0-f\0-x\0'C[-1,-*Z*f]\0,\0R[-*Z*,---]\0C[-1,-*f]'\0-g\0'*.tar.Z'\0-\0\e
>\0'C[-1,-*f]'\0-g\0'*.tar'\0--\0tar
.De
The first pattern set tells us to match if either the previous
argument was an option string including a \fCZ\fP and ending in an
\fCf\fP or there was an option string with a \fCZ\fP somewhere and the
previous word was any option string ending in an \fCf\fP. If this is
the case, we need a compressed tar file. Only if this is not the case
the second pattern set will be considered. By the way,
\fCR[\fIpattern1\fC,\fIpattern2\fC]\fR is just like
\fCr[\fR...\fC,\fR...\fC]\fR except that it uses pattern matching with
shell metacharacters instead of just strings.
.PP
You will have noticed the \fC--\fP before the command name. This ends
the list of pattern/flag pairs of \fC-x\fP. It is usually used just
before the command name, but you can also use an extended completion
as one part of a list of xored completions, in which case the \fC--\fP
appears just before one of the \fC+\fP signs.
.PP
Note the difference between using extended completion as part of a
list of xored completions as in
.Ds
%\0ls
foo\0\0bar
%\0compctl\0-x\0'r[-d,---]'\0-g\0'*.Z'\0--\0+\0-g\0'^*.Z'\0compress
%\0compress\0-d\0f\fITAB\fP
%\0compress\0-d\0foo\0_
.De
and specifying something before the \fC-x\fP as in
.Ds
%\0compctl\0-g\0'^*.Z'\0-x\0'r[-d,---]'\0-g\0'*.Z'\0--\0compress
%\0compress\0-d\0f\fITAB\fP
%\0compress\0-d\0f_
.De
In the first case, the alternative glob pattern (\fC^*.Z\fP) will be
used if the first part does not generate any possible completions,
while in the second case the alternative glob pattern will only be
used if the \fCr[\fR...\fC]\fR pattern doesn't match.
.Sh "Bindings"
.PP
Each of the editor commands we have seen was actually a function bound
by default to a certain key. The real names of the commands are:
.Ds
\fCexpand-or-complete\0\0\0\fITAB\fR
\fCpush-line\0\0\0\0\0\0\0\0\0\0\0\0\fIESC-Q\fR
\fCrun-help\0\0\0\0\0\0\0\0\0\0\0\0\0\fIESC-H\fR
\fCaccept-and-hold\0\0\0\0\0\0\fIESC-A\fR
\fCquote-line\0\0\0\0\0\0\0\0\0\0\0\fIESC-'\fR
.De
These bindings are arbitrary; you could change them if you want.
For example, to bind \fCaccept-line\fP to \fI^Z\fP:
.Ds
%\0bindkey\0'^Z'\0accept-line
.De
Another idea would be to bind the delete key to \fCdelete-char\fP;
this might be convenient if you use \fI^H\fP for backspace.
.Ds
%\0bindkey\0'^?'\0delete-char
.De
Or, you could bind \fI^X\fP\fI^H\fP to \fCrun-help\fP:
.Ds
%\0bindkey\0'^X^H'\0run-help
.De
Other examples:
.Ds
%\0bindkey\0'^X^Z'\0universal-argument
%\0bindkey\0'\0'\0magic-space
%\0bindkey\0-s\0'^T'\0'uptime
>\0'
%\0bindkey\0'^Q'\0push-line-or-edit
.De
\fCuniversal-argument\fP multiplies the next command by 4.
Thus \fI^X\fP\fI^Z\fP\fI^W\fP might delete the last four words on the line.
If you bind space to \fCmagic-space\fP, then csh-style history
expansion is done on the line whenever you press the space bar.
.PP
Something that often happens is that I am typing a multiline command
and discover an error in one of the previous lines. In this case,
\fCpush-line-or-edit\fP will put the entire multiline construct into
the editor buffer. If there is only a single line, it is equivalent
to \fCpush-line\fP.
.PP
The \fC-s\fP flag to \fCbindkey\fP specifies that you are binding the key
to a string, not a command. Thus \fCbindkey -s '^T' 'uptime\en'\fP
lets you VMS lovers get the load average whenever you press \fI^T\fP.
.PP
If you have a NeXT keyboard, the one with the \fC|\fP and \fC\e\fP keys
very inconveniently placed, the following
bindings may come in handy:
.Ds
%\0bindkey\0-s\0'\ee/'\0'\e\e'
%\0bindkey\0-s\0'\ee='\0'|'
.De
Now you can type \fIALT-/\fP to get a backslash, and \fIALT-=\fP to
get a vertical bar. This only works inside \fBzsh\fP, of course;
\fCbindkey\fP has no effect on the key mappings inside \fCtalk\fP
or \fCmail\fP, etc.
.PP
Some people like to bind \fC^S\fP and \fC^Q\fP to editor commands.
Just binding these has no effect, as the terminal will catch them and
use them for flow control. You could unset them as stop and start
characters, but most people like to use these for external commands.
The solution is to set the \fINOFLOWCONTROL\fP option. This will
allow you to bind the start and stop characters to editor commands,
while retaining their normal use for external commands.
.Sh "Parameter Substitution"
.PP
In \fBzsh\fP, parameters are set like this:
.Ds
%\0foo=bar
%\0echo\0$foo
bar
.De
Spaces before or after the \fC=\fP are frowned upon:
.Ds
%\0foo\0=\0bar
zsh:\0command\0not\0found:\0foo
.De
Also, \fCset\fP doesn't work for setting parameters:
.Ds
%\0set\0foo=bar
%\0set\0foo\0=\0bar
%\0echo\0$foo
%
.De
Note that no error message was printed. This is because both
of these commands were perfectly valid; the \fCset\fP builtin
assigns its arguments to the \fIpositional parameters\fP
(\fC$1\fP, \fC$2\fP, etc.).
.Ds
%\0set\0foo=bar
%\0echo\0$1
foo=bar
%\0set\0foo\0=\0bar
%\0echo\0$3\0$2
bar\0=
.De
If you're really intent on using the csh syntax, define a
function like this:
.Ds
%\0set\0()\0{
>\0\0\0\0eval\0"$1$2$3"
>\0}
%\0set\0foo\0=\0bar
%\0set\0fuu=brrr
%\0echo\0$foo\0$fuu
bar\0brrr
.De
But then, of course you can't use the form of \fCset\fP with
options, like \fCset -F\fP (which turns off filename generation).
Also, the \fCset\fP command by itself won't list all the parameters
like it should.
To get around that you need a \fCcase\fP statement:
.Ds
%\0set\0()\0{
>\0\0\0\0case\0$1\0in
>\0\0\0\0-*|+*|'')\0builtin\0set\0$*\0;;
>\0\0\0\0*)\0eval\0"$1$2$3"\0;;
>\0\0\0\0esac
>\0}
.De
For the most part, this should make csh users happy.
.PP
The following sh-style operators are supported in \fBzsh\fP:
.Ds
%\0unset\0null
%\0echo\0${foo-xxx}
bar
%\0echo\0${null-xxx}
xxx
%\0unset\0null
%\0echo\0${null=xxx}
xxx
%\0echo\0$null
xxx
%\0echo\0${foo=xxx}
bar
%\0echo\0$foo
bar
%\0unset\0null
%\0echo\0${null+set}
%\0echo\0${foo+set}
set
.De
Also, csh-style \fC:\fP modifiers may be appended to a parameter
substitution.
.Ds
%\0echo\0$PWD
/home/learning/pf/zsh/zsh2.00/src
%\0echo\0$PWD:h
/home/learning/pf/zsh/zsh2.00
%\0echo\0$PWD:h:h
/home/learning/pf/zsh
%\0echo\0$PWD:t
src
%\0name=foo.c
%\0echo\0$name
foo.c
%\0echo\0$name:r
foo
%\0echo\0$name:e
c
.De
The equivalent constructs in ksh (which are also supported in \fBzsh\fP)
are a bit more general and easier to remember.
When the shell expands \fC${foo#\fR\fIpat\fR\fC}\fR,
it checks to see if \fIpat\fP matches a substring at the beginning
of the value
of \fCfoo\fP. If so, it removes that portion of \fCfoo\fP, using the shortest
possible match.
With \fC${foo##\fR\fIpat\fR\fC}\fR, the longest possible match is removed.
\fC${foo%\fR\fIpat\fR\fC}\fR and \fC${foo%%\fR\fIpat\fR\fC}\fR remove the match
from the end.
Here are the ksh equivalents of the \fC:\fP modifiers:
.Ds
%\0echo\0${PWD%/*}
/home/learning/pf/zsh/zsh2.00
%\0echo\0${PWD%/*/*}
/home/learning/pf/zsh
%\0echo\0${PWD##*/}
src
%\0echo\0${name%.*}
foo
%\0echo\0${name#*.}
c
.De
\fBzsh\fP also has upper/lowercase modifiers:
.Ds
%\0xx=Test
%\0echo\0$xx:u
TEST
%\0echo\0$xx:l
test
.De
and a substitution modifier:
.Ds
%\0echo\0$name:s/foo/bar/
bar.c
%\0ls
foo.c\0\0\0\0foo.h\0\0\0\0foo.o\0\0\0\0foo.pro
%\0for\0i\0in\0foo.*;\0mv\0$i\0$i:s/foo/bar/
%\0ls
bar.c\0\0\0\0bar.h\0\0\0\0bar.o\0\0\0\0bar.pro
.De
There is yet another syntax to modify substituted parameters. You can
add certain modifiers in parentheses after the opening brace like:
.Ds
${(\fImodifiers\fC)\fIparameter\fC}
.De
For example, \fCo\fP sorts the words resulting from the expansion:
.Ds
%\0echo\0${path}
/usr/bin\0/usr/bin/X11\0/etc
%\0echo\0${(o)path}
/etc\0/usr/bin\0/usr/bin/X11
.De
One possible source of confusion is the fact that in \fBzsh\fP,
the result of parameter substitution is \fInot\fP split into
words. Thus, this will not work:
.Ds
%\0srcs='glob.c\0exec.c\0init.c'
%\0ls\0$srcs
glob.c\0exec.c\0init.c\0not\0found
.De
This is considered a feature, not a bug.
If splitting were done by default, as it is in most other shells,
functions like this would not work properly:
.Ds
$\0ll\0()\0{\0ls\0-F\0$*\0}
$\0ll\0'fuu\0bar'
fuu\0not\0found
bar\0not\0found
%\0ll\0'fuu\0bar'
fuu\0bar\0not\0found
.De
Of course, a hackish workaround is available in sh (and \fBzsh\fP):
.Ds
%\0setopt\0shwordsplit
%\0ll\0()\0{\0ls\0-F\0"$@"\0}
%\0ll\0'fuu\0bar'
fuu\0bar\0not\0found
.De
If you like the sh behaviour, \fBzsh\fP can accomodate you:
.Ds
%\0ls\0${=srcs}
exec.c\0\0glob.c\0\0init.c
%\0setopt\0shwordsplit
%\0ls\0$srcs
exec.c\0\0glob.c\0\0init.c
.De
Another way to get the \fC$srcs\fP trick to work is to use an array:
.Ds
%\0unset\0srcs
%\0srcs=(\0glob.c\0exec.c\0init.c\0)\0\0
%\0ls\0$srcs
exec.c\0\0glob.c\0\0init.c
.De
or an alias:
.Ds
%\0alias\0-g\0SRCS='exec.c\0glob.c\0init.c'
%\0ls\0SRCS
exec.c\0\0glob.c\0\0init.c
.De
Another option that modifies parameter expansion is
\fIRCEXPANDPARAM\fP:
.Ds
%\0echo\0foo/$srcs
foo/glob.c\0exec.c\0init.c
%\0setopt\0rcexpandparam
%\0echo\0foo/$srcs
foo/glob.c\0foo/exec.c\0foo/init.c
%\0echo\0foo/${^srcs}
foo/glob.c\0foo/exec.c\0foo/init.c
%\0echo\0foo/$^srcs
foo/glob.c\0foo/exec.c\0foo/init.c
.De
.Sh "Shell Parameters"
.PP
The shell has many predefined parameters that may be
accessed. Here are some examples:
.Ds
%\0sleep\010\0&
[1]\03820
%\0echo\0$!
3820
%\0set\0a\0b\0c
%\0echo\0$#
3
%\0echo\0$ARGC
3
%\0(\0exit\020\0)\0;\0echo\0$?
20
%\0false;\0echo\0$status
1
.De
(\fC$?\fP and \fC$status\fP are equivalent.)
.Ds
%\0echo\0$HOST\0$HOSTTYPE
dendrite\0sun4
%\0echo\0$UID\0$GID
701\060
%\0cd\0/tmp
%\0cd\0/home
%\0echo\0$PWD\0$OLDPWD
/home\0/tmp
%\0ls\0$OLDPWD/.getwd\0
/tmp/.getwd
.De
\fC~+\fP and \fC~-\fP are short for \fC$PWD\fP and \fC$OLDPWD\fP, respectively.
.Ds
%\0ls\0~-/.getwd
/tmp/.getwd
%\0ls\0-d\0~+/learning
/home/learning
%\0echo\0$RANDOM
4880
%\0echo\0$RANDOM
11785
%\0echo\0$RANDOM
2062
%\0echo\0$TTY
/dev/ttyp4
%\0echo\0$VERSION
zsh\0v2.00.03
%\0echo\0$USERNAME
pf
.De
.PP
The \fCcdpath\fP variable sets the search path for the \fCcd\fP command.
If you do not specify \fC.\fP somewhere in the path, it is assumed to
be the first component.
.Ds
%\0cdpath=(\0/usr\0~\0~/zsh\0)
%\0ls\0/usr
5bin\0\0\0\0\0\0\0\0\0dict\0\0\0\0\0\0\0\0\0lang\0\0\0\0\0\0\0\0\0net\0\0\0\0\0\0\0\0\0\0sccs\0\0\0\0\0\0\0\0\0sys
5include\0\0\0\0\0etc\0\0\0\0\0\0\0\0\0\0lector\0\0\0\0\0\0\0nserve\0\0\0\0\0\0\0services\0\0\0\0\0tmp
5lib\0\0\0\0\0\0\0\0\0export\0\0\0\0\0\0\0lib\0\0\0\0\0\0\0\0\0\0oed\0\0\0\0\0\0\0\0\0\0share\0\0\0\0\0\0\0\0ucb
adm\0\0\0\0\0\0\0\0\0\0games\0\0\0\0\0\0\0\0local\0\0\0\0\0\0\0\0old\0\0\0\0\0\0\0\0\0\0skel\0\0\0\0\0\0\0\0\0ucbinclude
bin\0\0\0\0\0\0\0\0\0\0geac\0\0\0\0\0\0\0\0\0lost+found\0\0\0openwin\0\0\0\0\0\0spool\0\0\0\0\0\0\0\0ucblib
boot\0\0\0\0\0\0\0\0\0hosts\0\0\0\0\0\0\0\0macsyma_417\0\0pat\0\0\0\0\0\0\0\0\0\0src\0\0\0\0\0\0\0\0\0\0xpg2bin
demo\0\0\0\0\0\0\0\0\0include\0\0\0\0\0\0man\0\0\0\0\0\0\0\0\0\0princeton\0\0\0\0stand\0\0\0\0\0\0\0\0xpg2include
diag\0\0\0\0\0\0\0\0\0kvm\0\0\0\0\0\0\0\0\0\0mdec\0\0\0\0\0\0\0\0\0pub\0\0\0\0\0\0\0\0\0\0swap\0\0\0\0\0\0\0\0\0xpg2lib
%\0cd\0spool
/usr/spool
%\0cd\0bin
/usr/bin
%\0cd\0func
~/func
%\0cd\0
%\0cd\0pub
%\0pwd
/u/pfalstad/pub
%\0ls\0-d\0/usr/pub
/usr/pub
.De
\fBPATH\fP and \fBpath\fP both set the search path for commands.
These two variables are equivalent, except that one is a string
and one is an array. If the user modifies \fBPATH\fP, the shell
changes \fBpath\fP as well, and vice versa.
.Ds
%\0PATH=/bin:/usr/bin:/tmp:.
%\0echo\0$path
/bin\0/usr/bin\0/tmp\0.
%\0path=(\0/usr/bin\0.\0/usr/local/bin\0/usr/ucb\0)
%\0echo\0$PATH
/usr/bin:.:/usr/local/bin:/usr/ucb
.De
The same is true of \fBCDPATH\fP and \fBcdpath\fP:
.Ds
%\0echo\0$CDPATH
/usr:/u/pfalstad:/u/pfalstad/zsh
%\0CDPATH=/u/subbarao:/usr/src:/tmp
%\0echo\0$cdpath
/u/subbarao\0/usr/src\0/tmp
.De
In general, predefined parameters with names in all lowercase are
arrays; assignments to them take the form:
.Ds
\fIname\fR\fC=(\fR\0\fIelem\fR\0...\\0\fC)\fR
.De
Predefined parameters with names in all uppercase are strings. If
there is both an array and a string version of the same parameter, the
string version is a colon-separated list, like \fBPATH\fP.
.PP
\fBHISTFILE\fP is the name of the history file, where the history
is saved when a shell exits.
.Ds
%\0zsh
phoenix%\0HISTFILE=/tmp/history
phoenix%\0SAVEHIST=20
phoenix%\0echo\0foo
foo
phoenix%\0date
Fri\0May\024\005:39:35\0EDT\01991
phoenix%\0uptime
\0\05:39am\0\0up\04\0days,\020:02,\0\040\0users,\0\0load\0average:\02.30,\02.20,\02.00
phoenix%\0exit
%\0cat\0/tmp/history
HISTFILE=/tmp/history
SAVEHIST=20
echo\0foo
date
uptime
exit
%\0HISTSIZE=3
%\0history
\0\0\028\0\0rm\0/tmp/history
\0\0\029\0\0HISTSIZE=3
\0\0\030\0\0history
.De
If you have several incantations of \fBzsh\fP running at the same
time, like when using the X window system, it might be preferable to
append the history of each shell to a file when a shell exits instead
of overwriting the old contents of the file. You can get this
behaviour by setting the \fIAPPENDHISTORY\fP option.
.PP
In \fBzsh\fP, if you say
.Ds
%\0>file
.De
the command \fCcat\fP is normally assumed:
.Ds
%\0>file
foo!\0\0\0\0
^D
%\0cat\0file
foo!
.De
Thus, you can view a file simply by typing:
.Ds
%\0<file
foo!
.De
However, this is not csh or sh compatible. To correct this,
change the value of the parameter \fBNULLCMD\fP,
which is \fCcat\fP by default.
.Ds
%\0NULLCMD=:
%\0>file
%\0ls\0-l\0file
-rw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\0\00\0May\024\005:41\0file
.De
If \fCNULLCMD\fP is unset, the shell reports an error if no
command is specified (like csh).
.Ds
%\0unset\0NULLCMD
%\0>file
zsh:\0redirection\0with\0no\0command
.De
Actually, \fBREADNULLCMD\fP is used whenever you have a null command
reading input from a single file. Thus, you can set \fBREADNULLCMD\fP
to \fCmore\fP or \fCless\fP rather than \fCcat\fP. Also, if you
set \fBNULLCMD\fP to \fC:\fP for sh compatibility, you can still read
files with \fC< file\fP if you leave \fBREADNULLCMD\fP set to \fCmore\fP.
.Sh "Prompting"
.PP
The default prompt for \fBzsh\fP is:
.Ds
phoenix%\0echo\0$PROMPT
%m%#\0
.De
The \fC%m\fP stands for the short form of the current hostname,
and the \fC%#\fP stands for a \fC%\fP or a \fC#\fP, depending on whether
the shell is running as root or not.
\fBzsh\fP supports many other control sequences
in the \fBPROMPT\fP variable.
.Ds
%\0PROMPT='%/>\0'
/u/pfalstad/etc/TeX/zsh>
%\0PROMPT='%~>\0'\0\0\0
~/etc/TeX/zsh>\0
%\0PROMPT='%h\0%~>\0'
6\0~/etc/TeX/zsh>\0
.De
\fC%h\fP\0represents\0the\0number\0of\0current\0history\0event.
.Ds
%\0PROMPT='%h\0%~\0%M>\0'
10\0~/etc/TeX/zsh\0apple-gunkies.gnu.ai.mit.edu>\0
%\0PROMPT='%h\0%~\0%m>\0'
11\0~/etc/TeX/zsh\0apple-gunkies>\0
%\0PROMPT='%h\0%t>\0'
12\06:11am>\0
%\0PROMPT='%n\0%w\0tty%l>'
pfalstad\0Fri\024\0ttyp0>
.De
\fBPROMPT2\fP is used in multiline commands, like for-loops. The
\fC%_\fP escape sequence was made especially for this prompt. It is
replaced by the kind of command that is being entered.
.Ds
%\0PROMPT2='%_>\0'
%\0for\0i\0in\0foo\0bar
for>
%\0echo\0'hi
quote>
.De
Also available is the \fBRPROMPT\fP parameter.
If this is set, the shell puts a prompt on the \fIright\fP side
of the screen.
.Ds
%\0RPROMPT='%t'
%\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06:14am
%\0RPROMPT='%~'
%\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~/etc/TeX/zsh
%\0PROMPT='%l\0%T\0%m[%h]\0'\0RPROMPT='\0%~'
p0\06:15\0phoenix[5]\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~/etc/TeX/zsh
.De
These special escape sequences can also be used with the
\fC-P\fP option to \fCprint\fP:
.Ds
%\0print\0-P\0%h\0tty%l
15\0ttyp1
.De
.PP
The \fBPOSTEDIT\fP parameter is printed whenever the editor exits.
This can be useful for termcap tricks. To highlight the prompt
and command line while leaving command output unhighlighted, try this:
.Ds
%\0POSTEDIT=`echotc\0se`
%\0PROMPT='%S%%\0'
.De
.Sh "Login/logout watching"
.PP
You can specify login or logout events to monitor
by setting the \fBwatch\fP variable.
Normally, this is done by specifying a list of usernames.
.Ds
%\0watch=(\0pfalstad\0subbarao\0sukthnkr\0egsirer\0)
.De
The \fClog\fP command reports all people logged in
that you are watching for.
.Ds
%\0log
pfalstad\0has\0logged\0on\0p0\0from\0mickey.
pfalstad\0has\0logged\0on\0p5\0from\0mickey.
%\0\fR...\fC
subbarao\0has\0logged\0on\0p8\0from\0phoenix.
%\0\fR...\fC
subbarao\0has\0logged\0off\0p8\0from\0phoenix.
%\0\fR...\fC
sukthnkr\0has\0logged\0on\0p8\0from\0dew.
%\0\fR...\fC
sukthnkr\0has\0logged\0off\0p8\0from\0dew.
.De
If you specify hostnames with an \fC@\fP prepended,
the shell will watch for all users logging in from
the specified host.
.Ds
%\0watch=(\0@mickey\0@phoenix\0)
%\0log
djthongs\0has\0logged\0on\0q2\0from\0phoenix.
pfalstad\0has\0logged\0on\0p0\0from\0mickey.
pfalstad\0has\0logged\0on\0p5\0from\0mickey.
.De
If you give a tty name with a \fC%\fP prepended, the shell
will watch for all users logging in on that tty.
.Ds
%\0watch=(\0%ttyp0\0%console\0)
%\0log
root\0has\0logged\0on\0console\0from\0.
pfalstad\0has\0logged\0on\0p0\0from\0mickey.
.De
The format of the reports may also be changed.
.Ds
%\0watch=(\0pfalstad\0gettes\0eps\0djthongs\0jcorr\0bdavis\0)
%\0log
jcorr\0has\0logged\0on\0tf\0from\0128.112.176.3:0.
jcorr\0has\0logged\0on\0r0\0from\0128.112.176.3:0.
gettes\0has\0logged\0on\0p4\0from\0yo:0.0.
djthongs\0has\0logged\0on\0pe\0from\0grumpy:0.0.
djthongs\0has\0logged\0on\0q2\0from\0phoenix.
bdavis\0has\0logged\0on\0qd\0from\0BRUNO.
eps\0has\0logged\0on\0p3\0from\0csx30:0.0.
pfalstad\0has\0logged\0on\0p0\0from\0mickey.
pfalstad\0has\0logged\0on\0p5\0from\0mickey.
%\0WATCHFMT='%n\0on\0tty%l\0from\0%M'
%\0log
jcorr\0on\0ttytf\0from\0128.112.176.3:0.
jcorr\0on\0ttyr0\0from\0128.112.176.3:0.
gettes\0on\0ttyp4\0from\0yo:0.0
djthongs\0on\0ttype\0from\0grumpy:0.0
djthongs\0on\0ttyq2\0from\0phoenix.Princeto
bdavis\0on\0ttyqd\0from\0BRUNO.pppl.gov
eps\0on\0ttyp3\0from\0csx30:0.0
pfalstad\0on\0ttyp0\0from\0mickey.Princeton
pfalstad\0on\0ttyp5\0from\0mickey.Princeton
%\0WATCHFMT='%n\0fm\0%m'
%\0log
jcorr\0fm\0128.112.176.3:0
jcorr\0fm\0128.112.176.3:0
gettes\0fm\0yo:0.0
djthongs\0fm\0grumpy:0.0
djthongs\0fm\0phoenix
bdavis\0fm\0BRUNO
eps\0fm\0csx30:0.0
pfalstad\0fm\0mickey
pfalstad\0fm\0mickey
%\0WATCHFMT='%n\0%a\0at\0%t\0%w.'
%\0log
jcorr\0logged\0on\0at\03:15pm\0Mon\020.
jcorr\0logged\0on\0at\03:16pm\0Wed\022.
gettes\0logged\0on\0at\06:54pm\0Wed\022.
djthongs\0logged\0on\0at\07:19am\0Thu\023.
djthongs\0logged\0on\0at\07:20am\0Thu\023.
bdavis\0logged\0on\0at\012:40pm\0Thu\023.
eps\0logged\0on\0at\04:19pm\0Thu\023.
pfalstad\0logged\0on\0at\03:39am\0Fri\024.
pfalstad\0logged\0on\0at\03:42am\0Fri\024.
.De
If you have a \fC.friends\fP file in your home directory,
a convenient way to make \fBzsh\fP watch for all your friends
is to do this:
.Ds
%\0watch=(\0$(<\0~/.friends)\0)
%\0echo\0$watch
subbarao\0maruchck\0root\0sukthnkr\0\fR...
.De
If watch is set to \fCall\fP, then all users logging in or out
will be reported.
.Sh "Options"
.PP
Some options have already been mentioned; here are a few more:
.PP
Using the \fIAUTOCD\fP option, you can simply type the name
of a directory, and it will become the current directory.
.Ds
%\0cd\0/
%\0setopt\0autocd
%\0bin
%\0pwd
/bin
%\0../etc
%\0pwd
/etc
.De
With \fICDABLEVARS\fP, if the argument to \fCcd\fP is the name of a
parameter whose value is a valid directory, it will become
the current directory.
.Ds
%\0setopt\0cdablevars
%\0foo=/tmp
%\0cd\0foo
/tmp
.De
\fICORRECT\fP turns on spelling correction for commands,
and the \fICORRECTALL\fP option turns on spelling correction
for all arguments.
.Ds
%\0setopt\0correct
%\0sl
zsh:\0correct\0`sl'\0to\0`ls'\0[nyae]?\0y
%\0setopt\0correctall
%\0ls\0x.v11r4
zsh:\0correct\0`x.v11r4'\0to\0`X.V11R4'\0[nyae]?\0n
/usr/princton/src/x.v11r4\0not\0found
%\0ls\0/etc/paswd
zsh:\0correct\0to\0`/etc/paswd'\0to\0`/etc/passwd'\0[nyae]?\0y
/etc/passwd
.De
If you press \fCy\fP
when the shell asks you if you want to correct a word, it will
be corrected. If you press \fCn\fP, it will be left alone.
Pressing \fCa\fP aborts the command, and pressing \fCe\fP brings the line
up for editing again, in case you agree the word is spelled wrong
but you don't like the correction.
.PP
Normally, a quoted expression may contain a newline:
.Ds
%\0echo\0'
>\0foo
>\0'
foo
%
.De
With \fICSHJUNKIEQUOTES\fP set, this is illegal, as it is
in csh.
.Ds
%\0setopt\0cshjunkiequotes
%\0ls\0'foo
zsh:\0unmatched\0'
.De
\fIGLOBDOTS\fP lets files beginning with a \fC.\fP be matched without
explicitly specifying the dot.
.Ds
%\0ls\0-d\0*x*
Mailboxes
%\0setopt\0globdots
%\0ls\0-d\0*x*
\&.exrc\0\0\0\0\0\0\0\0\0.pnewsexpert\0\0.xserverrc
\&.mushexpert\0\0\0.xinitrc\0\0\0\0\0\0Mailboxes
.De
\fIHISTIGNOREDUPS\fP prevents the current line from being
saved in the history if it is the same as the previous one;
\fIHISTIGNORESPACE\fP prevents the current line from being
saved if it begins with a space.
.Ds
%\0PROMPT='%h>\0'
39>\0setopt\0histignoredups
40>\0echo\0foo
foo
41>\0echo\0foo
foo
41>\0echo\0foo
foo
41>\0echo\0bar
bar
42>\0setopt\0histignorespace
43>\0\0echo\0foo
foo
43>\0\0echo\0fubar
fubar
43>\0\0echo\0fubar
fubar
.De
\fIIGNOREBRACES\fP turns off csh-style brace expansion.
.Ds
%\0echo\0x{y{z,a},{b,c}d}e
xyze\0xyae\0xbde\0xcde
%\0setopt\0ignorebraces
%\0echo\0x{y{z,a},{b,c}d}e
x{y{z,a},{b,c}d}e
.De
\fIIGNOREEOF\fP forces the user to type \fCexit\fP or \fClogout\fP,
instead of just pressing \fI^D\fP.
.Ds
%\0setopt\0ignoreeof
%\0^D
zsh:\0use\0'exit'\0to\0exit.
.De
\fIINTERACTIVECOMMENTS\fP turns on interactive comments;
comments begin with a \fC#\fP.
.Ds
%\0setopt\0interactivecomments
%\0date\0#\0this\0is\0a\0comment
Fri\0May\024\006:54:14\0EDT\01991
.De
\fINOBEEP\fP makes sure the shell never beeps.
.PP
\fINOCLOBBER\fP prevents you from accidentally
overwriting an existing file.
.Ds
%\0setopt\0noclobber
%\0cat\0/dev/null\0>~/.zshrc
zsh:\0file\0exists:\0/u/pfalstad/.zshrc
.De
If you really do want to clobber a file, you can use the
\fC>!\fP operator.
To make things easier in this case, the \fC>\fP is stored in
the history list as a \fC>!\fP:
.Ds
%\0cat\0/dev/null\0>!\0~/.zshrc
%\0cat\0/etc/motd\0>\0~/.zshrc
zsh:\0file\0exists:\0/u/pfalstad/.zshrc
%\0!!
cat\0/etc/motd\0>!\0~/.zshrc
%\0\fR...
.De
\fIRCQUOTES\fP lets you use a more elegant method for including
single quotes in a singly quoted string:
.Ds
%\0echo\0'"don'\e''t\0do\0that."'
"don't\0do\0that."
%\0echo\0'"don''t\0do\0that."'
"dont\0do\0that."
%\0setopt\0rcquotes
%\0echo\0'"don''t\0do\0that."'
"don't\0do\0that."
.De
Finally,
\fISUNKEYBOARDHACK\fP wins the award for the strangest option.
If a line ends with \fC`\fP, and there are an odd number of them
on the line, the shell will ignore the trailing \fC`\fP. This
is provided for keyboards whose RETURN key is too small,
and too close to the \fC`\fP key.
.Ds
%\0setopt\0sunkeyboardhack
%\0date`
Fri\0May\024\006:55:38\0EDT\01991
.De
.Sh "Closing Comments"
.PP
I (Bas de Bakker) would be happy to receive mail if anyone has any
tricks or ideas to add to this document, or if there are some points
that could be made clearer or covered more thoroughly. Please notify
me of any errors in this document.
.if o \{\
.bp
.sv 1i
.\}
.pn 1
.bp
.PX

32
Doc/zmacros.yo Normal file
View File

@ -0,0 +1,32 @@
STARTDEF()
DEFINEMACRO(includefile)(1)(\
TYPEOUT(Including file ARG1)\
comment(Yodl file: ARG1)NL()\
INCLUDEFILE(ARG1)\
)
DEFINEMACRO(def)(3)(\
DEFINEMACRO(ARG1)(ARG2)(ARG3)\
)
DEFINEMACRO(undef)(1)(\
UNDEFINEMACRO(ARG1)\
)
DEFINEMACRO(redef)(3)(\
UNDEFINEMACRO(ARG1)\
DEFINEMACRO(ARG1)(ARG2)(ARG3)\
)
DEFINEMACRO(LPAR)(0)(CHAR(40))
DEFINEMACRO(RPAR)(0)(CHAR(41))
DEFINEMACRO(PLUS)(0)(CHAR(+))
DEFINEMACRO(NL)(0)(
)
DEFINEMACRO(ifzman)(1)()
DEFINEMACRO(ifnzman)(1)(ARG1)
DEFINEMACRO(ifztexi)(1)()
DEFINEMACRO(ifnztexi)(1)(ARG1)
ENDDEF()

192
Doc/zman.yo Normal file
View File

@ -0,0 +1,192 @@
STARTDEF()
TYPEOUT(Zsh Yodl-to-man converter)
DEFINESYMBOL(zman)
INCLUDEFILE(zmacros)
redef(ifzman)(1)(ARG1)
redef(ifnzman)(1)()
def(CMT)(0)(NOTRANS(.'))
COMMENT(--- character translation ---)
DEFINECHARTABLE(standard)(
'' = ".' (avoiding a yodl bug)"
'\\' = "\\e"
'.' = "\\&."
'-' = "\\-"
)
USECHARTABLE(standard)
def(STDPAR)(0)(\
redef(PARAGRAPH)(0)(NL()NOTRANS(.PP)NL())\
)
COMMENT(--- emphasised text ---)
def(em)(1)(NOTRANS(\fI)ARG1NOTRANS(\fP))
def(bf)(1)(NOTRANS(\fB)ARG1NOTRANS(\fP))
def(tt)(1)(NOTRANS(\fB)ARG1NOTRANS(\fP))
def(var)(1)(NOTRANS(\fI)ARG1NOTRANS(\fP))
COMMENT(--- man page headers ---)
def(manpage)(4)(\
NOTRANS(.TH ")ARG1" "ARG2" "ARG3" "ARG4"\
)
def(manpagename)(2)(\
sect(NAME)NL()\
ARG1 - ARG2\
)
COMMENT(--- TeXinfo headers and conditionals ---)
def(texinfo)(2)(CMT())
def(texiifinfo)(1)()
def(texiiftex)(1)()
def(texipage)(0)(CMT())
def(texititlepage)(0)(CMT())
def(texiendtitlepage)(0)(CMT())
def(texititle)(1)(CMT())
def(texisubtitle)(1)(CMT())
def(texiauthor)(1)(CMT())
def(texinode)(4)(CMT())
def(texitop)(1)(CMT())
COMMENT(--- section divisions ---)
def(chapter)(1)(CMT())
def(sect)(1)(\
NOTRANS(.SH ")UPPERCASE(ARG1)(0)"NL()\
STDPAR()\
CMT()\
)
def(subsect)(1)(\
NOTRANS(.SS ")ARG1"NL()\
CMT()\
)
COMMENT(--- comment output ---)
DEFINECHARTABLE(roffcomment)(
'\n' = "\n.\\\" "
)
def(comment)(1)(\
USECHARTABLE(roffcomment)\
NOTRANS(.\" )ARG1\
USECHARTABLE(standard)\
)
COMMENT(--- cross-references ---)
def(manref)(2)(\
NOTRANS(\fI)ARG1NOTRANS(\fP)(ARG2)\
)
def(zmanref)(1)(manref(ARG1)(1))
def(noderef)(1)(the section `ARG1')
COMMENT(--- lists ---)
def(startitem)(0)(\
NOTRANS(.PD 0)\
redef(ITEM)(0)(NOTRANS(.PD)NL())\
)
def(enditem)(0)(\
ENDITEM()\
STDPAR()\
redef(ENDITEM)(0)(NOTRANS(.RE)STDPAR())\
)
def(item)(2)(\
NOTRANS(.TP)NL()\
ITEM()\
redef(ITEM)(0)()\
ARG1\
redef(ENDITEM)(0)(CMT())\
redef(PARAGRAPH)(0)(\
NL()NOTRANS(.RS)NL()NOTRANS(.PP)NL()\
STDPAR()\
redef(ENDITEM)(0)(NOTRANS(.RE)STDPAR())\
)\
ARG2\
ENDITEM()\
)
def(xitem)(1)(\
NOTRANS(.TP)NL()\
NOTRANS(.PD 0)NL()\
redef(ITEM)(0)(NOTRANS(.PD)NL())\
ARG1\
)
def(startsitem)(0)(\
NOTRANS(.PD 0)\
)
def(endsitem)(0)(\
NOTRANS(.PD)\
)
def(sitem)(2)(\
NOTRANS(.TP)NL()\
ARG1NL()\
ARG2\
)
def(sxitem)(1)(\
NOTRANS(.TP)NL()\
ARG1\
)
def(startlist)(0)(\
NOTRANS(.PD 0)\
)
def(endlist)(0)(\
NOTRANS(.PD)\
)
def(list)(1)(\
NOTRANS(.TP)NL()\
ARG1\
)
def(startitemize)(0)(\
startitem()\
)
def(enditemize)(0)(\
enditem()\
)
def(itemiz)(1)(\
item(NOTRANS(\)LPAR()NOTRANS(bu))(NL()ARG1NL())\
)
COMMENT(--- special effects ---)
def(nofill)(1)(\
NOTRANS(.nf)NL()\
ARG1\
NL()NOTRANS(.fi)\
)
def(indent)(1)(\
NOTRANS(.RS)\
ARG1\
NOTRANS(.RE)\
)
COMMENT(--- hyperlink menus ---)
def(startmenu)(0)(CMT())
def(endmenu)(0)(CMT())
def(menu)(1)(CMT())
COMMENT(--- indices ---)
def(cindex)(1)(CMT())
def(findex)(1)(CMT())
def(kindex)(1)(CMT())
def(pindex)(1)(CMT())
def(tindex)(1)(CMT())
def(vindex)(1)(CMT())
ENDDEF()\

83
Doc/zsh.yo Normal file
View File

@ -0,0 +1,83 @@
ifzman(\
IFDEF(ZSHALL)(\
def(ifzshone)(1)()\
def(ifzshall)(1)(ARG1)\
manpage(ZSHALL)(1)(date())(zsh version())
manpagename(zshall)(the Z shell meta-man page)
)(\
def(ifzshone)(1)(ARG1)\
def(ifzshall)(1)()\
manpage(ZSH)(1)(date())(zsh version())
manpagename(zsh)(the Z shell)
)\
)\
ifnzman(\
def(ifzshone)(1)()\
def(ifzshall)(1)()\
)\
ifztexi(\
texinfo(zsh.info)(zsh)
NOTRANS(@setchapternewpage odd
@iftex
@finalout
@afourpaper
@end iftex)
texititlepage()
texititle(The Z Shell Guide)
texisubtitle(Version version())
texisubtitle(Updated date())
texiauthor(Original documentation by Paul Falstad)
texipage()
This is a texinfo version of the documentation for the Z Shell, originally by
Paul Falstad.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
texiendtitlepage()
)\
ifnzman(includefile(Zsh/guide.yo))
includefile(Zsh/intro.yo)
includefile(Zsh/invoke.yo)
includefile(Zsh/files.yo)
ifnzman(includefile(Zsh/grammar.yo))
ifnzman(includefile(Zsh/redirect.yo))
ifnzman(includefile(Zsh/exec.yo))
ifnzman(includefile(Zsh/func.yo))
ifnzman(includefile(Zsh/jobs.yo))
ifnzman(includefile(Zsh/arith.yo))
ifnzman(includefile(Zsh/cond.yo))
ifnzman(includefile(Zsh/compat.yo))
ifnzman(includefile(Zsh/prompt.yo))
ifnzman(includefile(Zsh/restricted.yo))
ifnzman(includefile(Zsh/expn.yo))
ifnzman(includefile(Zsh/params.yo))
ifnzman(includefile(Zsh/options.yo))
ifnzman(includefile(Zsh/builtins.yo))
ifnzman(includefile(Zsh/zle.yo))
ifnzman(includefile(Zsh/compctl.yo))
ifnzman(includefile(Zsh/modules.yo))
ifzshall(\
def(source)(1)(NOTRANS(.so )man1/ARG1NOTRANS(.)1)\
CMT()
source(zshmisc)
source(zshexpn)
source(zshparam)
source(zshoptions)
source(zshbuiltins)
source(zshzle)
source(zshcompctl)
source(zshmodules)
manpage(ZSHALL)(1)(date())(zsh version())
)\
ifzman(includefile(Zsh/filelist.yo))
ifzman(includefile(Zsh/seealso.yo))
ifnzman(includefile(Zsh/index.yo))

3
Doc/zshbuiltins.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHBUILTINS)(1)(date())(zsh version())
manpagename(zshbuiltins)(zsh built-in commands)
includefile(Zsh/builtins.yo)

3
Doc/zshcompctl.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHCOMPCTL)(1)(date())(zsh version())
manpagename(zshcompctl)(zsh programmable completion)
includefile(Zsh/compctl.yo)

3
Doc/zshexpn.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHEXPN)(1)(date())(zsh version())
manpagename(zshexpn)(zsh expansion and substitution)
includefile(Zsh/expn.yo)

12
Doc/zshmisc.yo Normal file
View File

@ -0,0 +1,12 @@
manpage(ZSHMISC)(1)(date())(zsh version())
manpagename(zshmisc)(everything and then some)
includefile(Zsh/grammar.yo)
includefile(Zsh/redirect.yo)
includefile(Zsh/exec.yo)
includefile(Zsh/func.yo)
includefile(Zsh/jobs.yo)
includefile(Zsh/arith.yo)
includefile(Zsh/cond.yo)
includefile(Zsh/compat.yo)
includefile(Zsh/prompt.yo)
includefile(Zsh/restricted.yo)

3
Doc/zshmodules.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHMODULES)(1)(date())(zsh version())
manpagename(zshmodules)(zsh loadable modules)
includefile(Zsh/modules.yo)

3
Doc/zshoptions.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHOPTIONS)(1)(date())(zsh version())
manpagename(zshoptions)(zsh options)
includefile(Zsh/options.yo)

3
Doc/zshparam.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHPARAM)(1)(date())(zsh version())
manpagename(zshparam)(zsh parameters)
includefile(Zsh/params.yo)

3
Doc/zshzle.yo Normal file
View File

@ -0,0 +1,3 @@
manpage(ZSHZLE)(1)(date())(zsh version())
manpagename(zshzle)(zsh command line editor)
includefile(Zsh/zle.yo)

246
Doc/ztexi.yo Normal file
View File

@ -0,0 +1,246 @@
STARTDEF()
TYPEOUT(Zsh Yodl-to-TeXinfo converter)
DEFINESYMBOL(ztexi)
INCLUDEFILE(zmacros)
redef(ifztexi)(1)(ARG1)
redef(ifnztexi)(1)()
def(CMT)(0)(NOTRANS(@c))
ATEXIT(\
NL()\
NOTRANS(@setchapternewpage odd)NL()\
NOTRANS(@contents)NL()\
NOTRANS(@bye)NL()\
)
COMMENT(--- character translation ---)
DEFINECHARTABLE(standard)(
'' = "@c (avoiding a yodl bug)"
'@' = "@@"
'{' = "@{"
'}' = "@}"
)
USECHARTABLE(standard)
SUBST('')(NOTRANS(@value{dsq}))
def(STDPAR)(0)(redef(PARAGRAPH)(0)(NL()NL()NOTRANS(@noindent)NL()))
COMMENT(--- emphasised text ---)
def(em)(1)(NOTRANS(@emph{)ARG1NOTRANS(}))
def(bf)(1)(NOTRANS(@cite{)ARG1NOTRANS(}))
def(tt)(1)(NOTRANS(@code{)ARG1NOTRANS(}))
def(var)(1)(NOTRANS(@var{)ARG1NOTRANS(}))
COMMENT(--- man page headers ---)
def(manpage)(4)(STDPAR())
def(manpagename)(2)()
COMMENT(--- TeXinfo headers and conditionals ---)
def(texinfo)(2)(\
STDPAR()\
NOTRANS(\input texinfo.tex)NL()\
NOTRANS(@c %**start of header)NL()\
NOTRANS(@setfilename )ARG1NL()\
NOTRANS(@settitle )ARG2NL()\
NOTRANS(@c %**end of header)NL()\
NL()\
NOTRANS(@ifinfo)NL()\
NOTRANS(@set dsq @'@')NL()\
NOTRANS(@end ifinfo)NL()\
NOTRANS(@iftex)NL()\
NOTRANS(@set dsq '{}')NL()\
NOTRANS(@end iftex)NL()\
)
def(texiifinfo)(1)(\
NOTRANS(@ifinfo)NL()\
ARG1\
NOTRANS(@end ifinfo)NL()\
)
def(texiiftex)(1)(\
NOTRANS(@iftex)NL()\
ARG1\
NOTRANS(@end iftex)NL()\
)
def(texipage)(0)(\
NOTRANS(@page)\
)
def(texititlepage)(0)(\
NOTRANS(@titlepage)\
)
def(texiendtitlepage)(0)(\
NOTRANS(@end titlepage)\
)
def(texititle)(1)(\
NOTRANS(@title )ARG1\
)
def(texisubtitle)(1)(\
NOTRANS(@subtitle )ARG1\
)
def(texiauthor)(1)(\
NOTRANS(@author )ARG1\
)
def(texinode)(4)(\
NOTRANS(@node )ARG1, ARG2, ARG3, ARG4\
)
def(texitop)(1)(\
NOTRANS(@top )ARG1\
)
COMMENT(--- section divisions ---)
def(chapter)(1)(\
NL()\
NOTRANS(@chapter )ARG1NL()\
NOTRANS(@noindent)\
)
def(sect)(1)(\
NL()\
NOTRANS(@section )ARG1NL()\
NOTRANS(@noindent)\
)
def(subsect)(1)(\
NL()\
NOTRANS(@subsection )ARG1NL()\
NOTRANS(@noindent)\
)
COMMENT(--- comment output ---)
DEFINECHARTABLE(texicomment)(
'\n' = "\n@c "
)
def(comment)(1)(\
USECHARTABLE(texicomment)\
NOTRANS(@c )ARG1\
USECHARTABLE(standard)\
)
COMMENT(--- cross-references ---)
def(manref)(2)(man page ARG1LPAR()ARG2RPAR())
def(zmanref)(1)(manref(ARG1)(1))
def(noderef)(1)(\
NOTRANS(@ref{)ARG1NOTRANS(})\
)
COMMENT(--- lists ---)
def(startitem)(0)(\
NOTRANS(@table @asis)\
redef(ITEMX)(0)()\
)
def(enditem)(0)(\
NOTRANS(@end table)\
)
def(item)(2)(\
NOTRANS(@item)ITEMX() ARG1\
ARG2\
redef(ITEMX)(0)()\
)
def(xitem)(1)(\
NOTRANS(@item)ITEMX() ARG1\
redef(ITEMX)(0)(x)\
)
def(startsitem)(0)(\
startitem()\
)
def(endsitem)(0)(\
enditem()\
)
def(sitem)(2)(\
item(ARG1)(NL()ARG2)\
)
def(sxitem)(1)(\
xitem(ARG1)\
)
def(startlist)(0)(\
startitem()\
)
def(endlist)(0)(\
enditem()\
)
def(list)(1)(\
item(ARG1)()\
)
def(startitemize)(0)(\
NOTRANS(@itemize @bullet)NL()\
)
def(enditemize)(0)(\
NOTRANS(@end itemize)\
)
def(itemiz)(1)(\
sitem()(ARG1)\
)
COMMENT(--- special effects ---)
DEFINECHARTABLE(nofillchars)(
'@' = "@@"
'{' = "@{"
'}' = "@}"
'\n' = "@*\n"
)
def(nofill)(1)(\
USECHARTABLE(nofillchars)\
ARG1\
USECHARTABLE(standard)\
)
def(indent)(1)(\
ARG1\
)
COMMENT(--- hyperlink menus ---)
def(startmenu)(0)(\
NOTRANS(@menu)\
)
def(endmenu)(0)(\
NOTRANS(@end menu)\
)
def(menu)(1)(\
* ARG1NOTRANS(::)\
)
COMMENT(--- indices ---)
def(cindex)(1)(\
NOTRANS(@cindex )ARG1\
)
def(findex)(1)(\
NOTRANS(@findex )ARG1\
)
def(kindex)(1)(\
NOTRANS(@kindex )ARG1\
)
def(pindex)(1)(\
NOTRANS(@pindex )ARG1\
)
def(tindex)(1)(\
NOTRANS(@tindex )ARG1\
)
def(vindex)(1)(\
NOTRANS(@vindex )ARG1\
)
ENDDEF()\

3
Etc/.cvsignore Normal file
View File

@ -0,0 +1,3 @@
Makefile
FAQ
FAQ.html

5
Etc/.distfiles Normal file
View File

@ -0,0 +1,5 @@
DISTFILES_SRC='
.cvsignore .distfiles Makefile.in
BUGS CONTRIBUTORS FAQ FAQ.yo FEATURES MACHINES NEWS
FTP-README pubring.pgp
'

41
Etc/BUGS Normal file
View File

@ -0,0 +1,41 @@
-----------------
KNOWN BUGS IN ZSH
-----------------
------------------------------------------------------------------------
Completion has a habit of doing the wrong thing after a
backslash/newline.
------------------------------------------------------------------------
If you suspend "man", zle seems to get into cooked mode. It works ok
for plain "less".
It is not specific neither to man nor to zsh.
E.g. call the following program foo:
#include <sys/wait.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int status;
if (!fork()) /* child */
execvp(argv[1], argv + 1);
else /* parent */
wait(&status);
}
Then if you suspend
% foo less something
from zsh/bash, zle/readline gets into cooked mode.
------------------------------------------------------------------------
% zsh -c 'cat a_long_file | less ; :'
can be interrupted with ^C. The prompt comes back and less is orphaned.
If you go to the end of the file with less and cat terminates, ^C
will not terminate less. The `; :' after less forces zsh to fork before
executing less.
------------------------------------------------------------------------
The pattern %?* matches names beginning with %? instead of names with at
least two characters beginning with %. This is a hack to allow %?foo job
substitution without quoting. This behaviour is incompatible with sh
and ksh and may be removed in the future. A good fix would be to keep
such patterns unchanged if they do not match regardless of the state of
the nonomatch and nullglob options.
------------------------------------------------------------------------

127
Etc/CONTRIBUTORS Normal file
View File

@ -0,0 +1,127 @@
----------------
ZSH CONTRIBUTORS
----------------
Zsh was originally written by Paul Falstad <pf@zsh.org>. Zsh is
now maintained by the members of the zsh-workers mailing list
<zsh-workers@math.gatech.edu>. The development is currently coordinated
by Andrew Main (Zefram) <zefram@zsh.org>.
This file credits only the major contributors to the current release.
See the ChangeLog files for a complete list of people who have submitted
patches. Note that email addresses below and in the ChangeLog file
are included for disambiguation purposes only, and are not guaranteed
to be currently accurate. If you feel that you or someone else have
been unfairly omitted from this list please mail the current maintainer
at <coordinator@zsh.org>.
Version 3.0
-----------
* Richard Coleman <coleman@math.gatech.edu> maintained the code till the
release of zsh-2.6-beta16. Converted zsh to use autoconf thus greatly
improving the portability. Rewrote signal handling code. Reorganized
internal hash tables and rewrote the related builtins (enable, disable,
hash, unhash). Made some cleanups in exec.c.
* Zoltán Hidvégi <hzoli@cs.elte.hu> maintained zsh from version
2.6-beta16. Rewrote most of the lexer and substitution and the related
completion code. Improved sh/ksh/POSIX compatibility. Fixed lots
of bugs in completion, parameter and history code. Made zsh fully
8-bit clean. Made some reorganizations in exec.c. Fixed signal
handling bugs. Fixed lots of bugs in various places.
* Peter W. Stephenson <pws@ifh.de> the maintainer of the zsh FAQ.
Reorganizations in exec.c. Rewrote and reorganized the history code.
Rewrote the zshcompctl manual page. Fixed several bugs related to
programmable completion. Fixed several signal handling bugs. Rewrote
test and read builtins. Lots of other bugfixes.
* Andrew Main (Zefram) <zefram@fysh.org> reorganized builtin.c.
Rewrote large parts of the zle vi mode. Redirection fixes. Reorganized
parts of the completion code, added some enhancements and fixed lots of
bugs. Made zle fully 8-bit clean. Fixed several zle bugs. Reorganized
zsh option handling. Lots of other bugfixes.
* Sven Wischnowsky <wischnow@informatik.hu-berlin.de> wrote most of the
programmable completion code in zsh-2.5.0. Several bugfixes in exec.c
and jobs.c. Lots of completion bugfixes and enhancements.
* Geoff Wing <mason@werple.net.au> rewrote most of zle_refresh.c. Some
other bugfixes.
* Clive Messer <clive@epos.demon.co.uk> brought the texinfo documentation
up-to-date.
* Mark Borges <mdb@cdc.noaa.gov> maintains the zsh web page
(http://www.mal.com/zsh/). Several documentation fixes. Maintains the
texinfo documentation together with Clive.
* Wayne Davison <wayne@clari.net> improved the the zle search functions
and made them 8-bit clean. Some other little bugfixes.
* Bart Schaefer <schaefer@candle.brasslantern.com> submitted several
bugfixes, reported lots of bugs and gave many very useful suggestions.
Version 2.5
-----------
Bas de Bakker maintained zsh till the release of zsh-2.5.0. People who
have contributed to zsh-2.5.0 are (in lexical order):
Chris.Moore@src.bae.co.uk (Chris Moore)
Harald.Eikrem@delab.sintef.no
Irving_Wolfe@happy-man.com (Irving Wolfe)
Jarkko.Hietaniemi@hut.fi (Jarkko Hietanimi)
P.Stephenson@swansea.ac.uk (Peter Stephenson)
Richard.Sharman@software.mitel.com (Richard Sharman)
Tero_Kivinen@hut.FI (Tero Kivinen)
arf@maths.nott.ac.uk (Anthony Iano-Fletcher)
bas@phys.uva.nl (Bas de Bakker)
benson@odi.com (Benson Margulies)
billb@bedford.progress.com (Bill Burton)
brown@wi.extrel.com (M. Brown)
carlos@snfep1.if.usp.br (Carlos Carvalho)
cedman@capitalist.princeton.edu (Carl Edman)
chip%fin@myrddin.sybus.com (Chip Salzenberg)
chs@apu.fi (Hannu Strang)
coleman@math.gatech.edu (Richard Coleman)
cross@eng.umd.edu (Chris Ross)
dm@cs.brown.edu (Dimitris Michailidis)
dmm0t@rincewind.mech.virginia.edu (David M. Meyer)
esky@CS.UCLA.EDU (Eskandar Ensafi)
franl@centerline.com (Fran Litterio)
gansevle@cs.utwente.nl (Fred Gansevles)
gnohmon@ssiny.com (Ralph Betza)
guillaum@clipper.ens.fr (Florent Guillaume)
guthrie@math.upenn.edu (John Guthrie)
hegedus@celeste.eng.yale.edu (Peter Hegedus)
henryg@tusc.com.au (Henry Guillaume)
hoh@approve.se (Goran Larsson)
hooft@chem.ruu.nl (Rob Hooft)
hsw1@papa.attmail.com (Stephen Harris)
irving@happy-man.com (Irving Wolfe)
jch@cs.cmu.edu (Jonathan Hardwick)
jos@oce.nl (Jos Backus)
liblit@cs.psu.edu (Benjamin Liblit)
marc@cam.org (Marc Boucher)
mason@werple.apana.org.au (Geoff Wing)
mycroft@gnu.ai.mit.edu (Charles Hannum)
mystic@axposf.pa.dec.com (D. Hall)
norbert@i3.informatik.rwth-aachen.de (Norbert Kiesel)
oberon@cs.tu-berlin.de (Sven Wischnowsky)
pclink@qld.tne.oz.au (Rick)
pem@aaii.oz.au (Paul Maisano)
per@efd.lth.se (Per Foreby)
pf@z-code.com (Paul Falstad)
roderick@ibcinc.com (Roderick Schertler)
schaefer@z-code.com (Bart Schaefer)
schlangm@informatik.uni-muenchen.de (Harald Schlangmann)
seniorr@teleport.com (Russell Senior)
sinclair@dcs.gla.ac.uk (Duncan Sinclair)
sterling@oldcolo.com (Bruce Sterling Woodcock)
suzuki@otsl.oki.co.jp (Hisao Suzuki)
tsm@cs.brown.edu (Timothy Miller)
vogelke@c17mis.wpafb.af.mil (Karl E. Vogel)
wacker@physik.uni-dortmund.de (Klaus Wacker)
wacren@cis10.ens-cachan.fr (Laurent Wacrenier)

2018
Etc/FAQ.yo Normal file
View File

@ -0,0 +1,2018 @@
mailto(pws@ifh.de)\
whentxt(notableofcontents())\
COMMENT(-- mytt is like tt but adds quotes `like this' for plain text --)\
def(mytt)(1)(\
whentxt(`ARG1')\
whenhtml(tt(ARG1))\
whenlatex(tt(ARG1))\
whenms(tt(ARG1))\
whensgml(tt(ARG1)))\
COMMENT(-- mybf/em are like bf/em but add *emphasis* for text too --)\
def(mybf)(1)(\
whentxt(*ARG1*)\
whenhtml(bf(ARG1))\
whenlatex(bf(ARG1))\
whenms(bf(ARG1))\
whensgml(bf(ARG1)))
def(myem)(1)(\
whentxt(_ARG1_)\
whenhtml(em(ARG1))\
whenlatex(em(ARG1))\
whenms(em(ARG1))\
whensgml(em(ARG1)))\
COMMENT(-- mydit is like dit but no `o' for text mode --)\
def(mydit)(1)(\
whenlatex(dit(ARG1))\
whenhtml(dit(ARG1))\
whentxt(ARG1)\
whenman(dit(ARG1))\
whenms(dit(ARG1))\
whensgml(dit(ARG1)))\
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)))\
def(myeitd)(0)(\
whenlatex(eit())whenhtml(eit())whenman(eit())whenms(eit())whensgml(eit())\
whentxt(USECOUNTER(XXenumcounter).))\
COMMENT(-- don't want headers for text, USENET headers must come first --)\
def(myreport)(3)(\
whentxt(report()()())\
whenhtml(report(ARG1)(ARG2)(ARG3))\
whenlatex(report(ARG1)(ARG2)(ARG3))\
whenman(report(ARG1)(ARG2)(ARG3))\
whenms(report(ARG1)(ARG2)(ARG3))\
whensgml(report(ARG1)(ARG2)(ARG3)))
myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1998/10/26)
COMMENT(-- the following are for Usenet and must appear first)\
description(
mydit(Archive-Name:) unix-faq/shell/zsh
mydit(Last-Modified:) 1998/10/26
mydit(Submitted-By:) email(pws@amtp.liv.ac.uk (Peter Stephenson))
mydit(Version:) $Id: FAQ.yo,v 1.1 1999/04/15 18:05:37 akr Exp $
mydit(Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995, 1996, 1997, 1998 \
(see end of document)
)
bf(Changes since issue posted September 1998:)
description(
mydit(2.1) Another mytt(typeset) difference turned up.
mydit(5.4) Slight addition to Y2K item (prompt formatting)
)
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 mytt(sh), mytt(csh) or mytt(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 link(1.6)(16); if you want to know what to do with
insoluble problems, go to link(5.2)(52).
whentxt(Notation: Quotes `like this' are ordinary textual quotation
marks. Other uses of quotation marks are input to the shell.)
COMMENT(-- need to do this specially in text since it should go here --)
whentxt(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. mytt(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(Introducing zsh and how to install it)
sect(Sources of information)
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
now maintained by Karsten Thygesen and others (mail \
email(zsh@sunsite.auc.dk)
with any related messages). The FAQ is at \
url(http://sunsite.auc.dk/zsh/FAQ/)(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 url(http://sunsite.auc.dk/zsh/FAQ/zshfaq.yo)
(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
description(
mydit(USA) url(http://www.cis.ohio-state.edu/hypertext/faq/usenet/top.html)
(http://www.cis.ohio-state.edu/hypertext/faq/usenet/top.html)
mydit(UK) url(http://www.lib.ox.ac.uk/internet/news/faq/comp.unix.shell.html)
(http://www.lib.ox.ac.uk/internet/news/faq/comp.unix.shell.html)
mydit(Netherlands) url(http://www.cs.ruu.nl/wais/html/na-dir/unix-faq/shell/.html)
(http://www.cs.ruu.nl/wais/html/na-dir/unix-faq/shell/.html)
)
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.
(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 $)
when you are on the title you want.)
For any more eclectic information, you should contact the mailing
list: see question link(5.2)(52).
sect(What is it?)
Zsh is a UNIX command interpreter (shell) which of the standard
shells most resembles the Korn shell (ksh); its compatibility with
the 1988 Korn shell has been gradually increasing. It includes
enhancements of many types, notably in the command-line editor,
options for customising its behaviour, filename globbing, features
to make C-shell (csh) users feel more at home and extra features
drawn from tcsh (another `custom' shell).
It was written by Paul Falstad when a student at Princeton; however,
Paul doesn't maintain it any more and enquiries should be sent to
the mailing list (see question link(5.2)(52)). Zsh is distributed under a
standard Berkeley style copyright.
For more information, the files Doc/intro.txt or Doc/intro.troff
included with the source distribution are highly recommended. A list
of features is given in FEATURES, also with the source.
sect(What is it good at?)
Here are some things that zsh is particularly good at. No claim of
exclusivity is made, especially as shells copy one another, though
in the areas of command line editing and globbing zsh is well ahead
of the competition. I am not aware of a major interactive feature
in any other freely-available shell which zsh does not also have
(except smallness).
itemize(
it() Command line editing:
itemize(
it() programmable completion: incorporates the ability to use
the full power of zsh globbing (compctl -g),
it() multi-line commands editable as a single buffer (even files!),
it() variable editing (vared),
it() command buffer stack,
it() print text straight into the buffer for immediate editing (print -z),
it() execution of unbound commands,
it() menu completion,
it() variable, editing function and option name completion,
it() inline expansion of variables, history commands.
)
it() Globbing --- extremely powerful, including:
itemize(
it() recursive globbing (cf. find),
it() file attribute qualifiers (size, type, etc. also cf. find),
it() full alternation and negation of patterns.
)
it() Handling of multiple redirections (simpler than tee).
it() Large number of options for tailoring.
it() Path expansion (=foo -> /usr/bin/foo).
it() Adaptable messages for spelling, watch, time as well as prompt
(including conditional expressions).
it() Named directories.
it() Comprehensive integer arithmetic.
it() Manipulation of arrays (including reverse subscripting).
it() Spelling correction.
)
sect(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 config.h.in 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.
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
directory. Also read the Etc/MACHINES file for up-to-date
information on compilation on certain architectures.
mybf(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.
sect(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 link(5.1)(51). This is
longer than usual due to enhanced sh, ksh and POSIX compatibility.
The beta version 3.1.4 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 link(5.1)(51) 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.
sect(Where do I get it?)
label(16)
The archive is now run by email(Andrew Main <zefram@tao.co.uk>).
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) .
description(
mydit(Home site) url(ftp://ftp.zsh.org)(ftp://ftp.zsh.org)
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)
(ftp://sunsite.auc.dk/pub/unix/shells/zsh)
mydit(Finland) url(ftp://ftp.funet.fi/pub/unix/shells/zsh/)
(ftp://ftp.funet.fi/pub/unix/shells/zsh/)
mydit(France) url(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/)
(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/)
mydit(Germany) url(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/)
(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/)
mydit() url(ftp://ftp.gmd.de/packages/zsh/)
(ftp://ftp.gmd.de/packages/zsh/)
mydit() url(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/)
(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/)
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/) )
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/)
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(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/)
(ftp://ftp.nis.co.jp/pub/shells/zsh/)
mydit(Norway) url(ftp://ftp.uit.no/pub/unix/shells/zsh/)
(ftp://ftp.uit.no/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(Slovenia) url(ftp://ftp.siol.net/pub/unix/shells/zsh/)
(ftp://ftp.siol.net/pub/unix/shells/zsh/)
mydit(Sweden) url(ftp://ftp.lysator.liu.se/pub/unix/zsh/)
(ftp://ftp.lysator.liu.se/pub/unix/zsh/)
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(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/)
(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/)
)
The Windows port mentioned above is maintained separately by email(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:
description(
mydit() url(ftp://ftp.blarg.net/users/amol/zsh)
(ftp://ftp.blarg.net/users/amol/zsh)
)
Likewise the OS/2 port is available from email(TAMURA Kent
<kent@tril.ibm.co.jp>) at
description(
mydit() url(http://cgi.din.or.jp/~tkent/tmp/zsh-3.0.0-os2-a01.zip)
(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
link(1.1)(11)) at:
description(
mydit() url(http://sunsite.auc.dk/zsh/Patches/)
(http://sunsite.auc.dk/zsh/Patches/)
)
sect(I don't have root access: how do I make zsh my login shell?)
Unfortunately, on many machines you can't use mytt(chsh) to change your
shell unless the name of the shell is contained in /etc/shells, so if
you have your own copy of zsh you need some sleight-of-hand to use it
when you log on. (Simply typing mytt(zsh) is not really a solution since
you still have your original login shell waiting for when you exit.)
The basic idea is to use mytt(exec <zsh-path>) to replace the current
shell with zsh. Often you can do this in a login file such as .profile
(if your shell is sh or ksh) or .login (if it's csh). Make sure you
have some way of altering the file (e.g. via FTP) before you try this as
mytt(exec) is often rather unforgiving.
If you have zsh in a subdirectory mytt(bin) of your home directory,
put this in .profile:
verb(
[ -f $HOME/bin/zsh ] && exec $HOME/bin/zsh -l
)
or if your login shell is csh or tcsh, put this in .login:
verb(
if ( -f ~/bin/zsh ) exec ~/bin/zsh -l
)
(in each case the mytt(-l) tells zsh it is a login shell).
If you want to check this works before committing yourself to it,
you can make the login shell ask whether to exec zsh. The following
work for Bourne-like shells:
verb(
[ -f $HOME/bin/zsh ] && {
echo "Type Y to run zsh: \c"
read line
[ "$line" = Y ] && exec $HOME/bin/zsh -l
}
)
and for C-shell-like shells:
verb(
if ( -f ~/bin/zsh ) then
echo -n "Type Y to run zsh: "
if ( "$<" == Y ) exec ~/bin/zsh -l
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
will cause csh scripts (yes, unfortunately some people write these)
which do not call `csh -f' to fail. If you want to tell xterm to
run zsh, change the SHELL environment variable to the full path of
zsh at the same time as you exec zsh (in fact, this is sensible for
consistency even if you aren't using xterm). If you have to exec
zsh from your .cshrc, a minimum safety check is mytt(if ($?prompt) exec
zsh).
If you like your login shell to appear in the process list as mytt(-zsh),
you can link mytt(zsh) to mytt(-zsh) (e.g. by mytt(ln -s ~/bin/zsh
~/bin/-zsh)) and change the exec to mytt(exec -zsh). (Make sure
mytt(-zsh) is in your path.) This has the same effect as the mytt(-l)
option.
Footnote: if you DO have root access, make sure zsh goes in
/etc/shells on all appropriate machines, including NIS clients, or you
may have problems with FTP to that machine.
chapter(How does zsh differ from...?)
As has already been mentioned, zsh is most similar to ksh, while many
of the additions are to please csh users. Here are some more detailed
notes. See also the article `UNIX shell differences and how to change
your shell' posted frequently to the USENET group comp.unix.shell.
sect(Differences from sh and ksh)
label(21)
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:
enumerate(
myeit() 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;
myeit() 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 mytt(ARGV0=sh zsh) will also work);
myeit() 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;
myeit() 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;
myeit() 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 link(3.1)(31); 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 link(3.1)(31)) 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.
itemize(
it() Syntax:
itemize(
it()* Shell word splitting: see question link(3.1)(31).
it()* Arrays are (by default) more csh-like than ksh-like:
subscripts start at 1, not 0; tt(array[0]) refers to tt(array[1]);
mytt($array) refers to the whole array, not tt($array[0]);
braces are unnecessary: tt($a[1] == ${a[1]}), etc.
The KSH_ARRAYS option is now available.
it() Coprocesses are established by mytt(coproc); mytt(|&) behaves like
csh. Handling of coprocess file descriptors is also different.
it() In mytt(cmd1 && cmd2 &), only mytt(cmd2) instead of the whole
expression is run in the background in zsh. The manual implies
this is a bug. Use mytt({ cmd1 && cmd2 } &) as a workaround.
)
it() Command line substitutions, globbing etc.:
itemize(
it()* Failure to match a globbing pattern causes an error (use
NO_NOMATCH).
it()* The results of parameter substitutions are treated as plain text:
mytt(foo="*"; print $foo) prints all files in ksh but mytt(*) in zsh.
(GLOB_SUBST has been added to fix this.)
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'.
Equivalents:
verb(
----------------------------------------------------------------------
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 mytt(^), mytt(~) and mytt(#) (but not mytt(|))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 mytt(~) is the only globbing operator to have a lower
precedence than mytt(/). For example, mytt(**/foo~*bar*) matches any
file in a subdirectory called mytt(foo), except where mytt(bar)
occurred somewhere in the path (e.g. mytt(users/barstaff/foo) will
be excluded by the mytt(~) operator). As the mytt(**) operator cannot
be grouped (inside parentheses it is treated as mytt(*)), this is
the way to exclude some subdirectories from matching a mytt(**).
it() Unquoted assignments do file expansion after mytt(:)s (intended for
PATHs).
it() mytt(integer) does not allow mytt(-i).
it() mytt(typeset) and mytt(integer) have special behaviour for
assignments in ksh, but not in zsh. For example, this doesn't
work in zsh:
verb(
integer k=$(wc -l ~/.zshrc)
)
because the return value from tt(wc) includes leading
whitespace which causes wordsplitting. Ksh handles the
assignment specially as a single word.
)
it() Command execution:
itemize(
it()* There is no tt($ENV) variable (use tt(/etc/zshrc), tt(~/.zshrc);
note also tt($ZDOTDIR)).
it() tt($PATH) is not searched for commands specified
at invocation without -c.
)
it() Aliases and functions:
itemize(
it() The order in which aliases and functions are defined is significant:
function definitions with () expand aliases -- see question \
link(2.3)(23).
it() Aliases and functions cannot be exported.
it() There are no tracked aliases: command hashing replaces these.
it() The use of aliases for key bindings is replaced by `bindkey'.
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() Traps and signals:
itemize(
it() Traps are not local to functions.
it() TRAPERR has become TRAPZERR (this was forced by UNICOS which
has SIGERR).
)
it() Editing:
itemize(
it() The options tt(emacs), tt(gmacs), tt(viraw) are not supported.
Use bindkey to change the editing behaviour: mytt(set -o {emacs,vi})
becomes mytt(bindkey -{e,v}); for gmacs, go to emacs mode and use
mytt(bindkey \^t gosmacs-transpose-characters).
it() The mytt(keyword) option does not exist and mytt(-k) is instead
interactivecomments. (mytt(keyword) will not be in the next ksh
release either.)
it() Management of histories in multiple shells is different:
the history list is not saved and restored after each command.
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
default.
)
it() Built-in commands:
itemize(
it() Some built-ins (tt(r), tt(autoload), tt(history), tt(integer) ...)
were aliases in ksh.
it() There is no built-in command newgrp: use e.g. mytt(alias
newgrp="exec newgrp")
it() mytt(jobs) has no mytt(-n) flag.
it() mytt(read) has no mytt(-s) flag.
)
it() Other idiosyncrasies:
itemize(
it() mytt(select) always redisplays the list of selections on each loop.
)
)
sect(Similarities with csh)
Although certain features aim to ease the withdrawal symptoms of csh
(ab)users, the syntax is in general rather different and you should
certainly not try to run scripts without modification. The c2z script
is provided with the source (in Misc/c2z) to help convert .cshrc
and .login files; see also the next question concerning aliases,
particularly those with arguments.
Csh-compatibility additions include:
itemize(
it() tt(logout), tt(rehash), tt(source), tt((un)limit) built-in commands.
it() tt(*rc) file for interactive shells.
it() Directory stacks.
it() tt(cshjunkie*), tt(ignoreeof) options.
it() The CSH_NULL_GLOB option.
it() tt(>&), tt(|&) etc. redirection.
(Note that mytt(>file 2>&1) is the standard Bourne shell command for
csh's mytt(>&file).)
it() tt(foreach ...) loops; alternative syntax for other loops.
it() Alternative syntax mytt(if ( ... ) ...), though this still doesn't
work like csh: it expects a command in the parentheses. Also
mytt(for), mytt(which).
it() tt($PROMPT) as well as tt($PS1), tt($status) as well as tt($?),
tt($#argv) as well as tt($#), ....
it() Escape sequences via tt(%) for prompts.
it() Special array variables tt($PATH) etc. are colon-separated, tt($path)
are arrays.
it() tt(!)-type history (which may be turned off via mytt(setopt
nobanghist)).
it() Arrays have csh-like features (see under link(2.1)(21)).
)
sect(Why do my csh aliases not work? (Plus other alias pitfalls.))
label(23)
First of all, check you are using the syntax
verb(
alias newcmd='list of commands'
)
and not
verb(
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 mytt(\!*), 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
verb(
alias cd 'cd \!*; echo $cwd'
)
can be replaced by the zsh function,
verb(
cd() { builtin cd $*; echo $PWD; }
)
(the `builtin' tells zsh to use its own `cd', avoiding an infinite loop)
or, perhaps better,
verb(
cd() { builtin cd $*; print -D $PWD; }
)
(which converts your home directory to a tt(~)). In fact, this problem is
better solved by defining the special function chpwd() (see the manual).
Note also that the mytt(;) 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.
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.).
Otherwise, you can use a zsh alias.
myeit() If you use a zsh function, you need to refer _at_least_ to
tt($*) in the body (inside the tt({ })). Parameters don't magically
appear inside the tt({ }) the way they get appended to an alias.
myeit() If the csh alias references its own name (tt(alias rm "rm -i")),
then in a zsh function you need the "command" keyword
(function tt(rm() { command rm -i $* })), but in a zsh alias
you don't (tt(alias rm="rm -i")).
myeit() If you have aliases that refer to each other (tt(alias ls "ls -C";
alias lf "ls -F" ==> lf == ls -C -F)) then you must either:
itemize(
it() convert all of them to zsh functions; or
it() 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:
myeit() Mapping from csh alias "parameter referencing" into zsh function
(assuming shwordsplit and ksharrays are NOT set in zsh):
verb(
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))
)
myeit() Remember that it is NOT a syntax error in a zsh function to
refer to a position (tt($1), tt($2), etc.) greater than the number of
parameters. (E.g., in a csh alias, a reference to tt(\!:5) will
cause an error if 4 or fewer arguments are given; in a zsh
function, tt($5) is the empty string if there are 4 or fewer
parameters.)
myeit() To begin a zsh alias with a - (dash, hyphen) character, use
mytt(alias --):
verb(
csh zsh
=============== ==================
alias - "fg %-" alias -- -="fg %-"
)
myeit() Stay away from mytt(alias -g) in zsh until you REALLY know what
you're doing.
)
There is one other serious problem with aliases: consider
verb(
alias l='/bin/ls -F'
l() { /bin/ls -la $* | more }
)
mytt(l) in the function definition is in command position and is expanded
as an alias, defining mytt(/bin/ls) and mytt(-F) as functions which call
mytt(/bin/ls), which gets a bit recursive. This can be avoided if you use
mytt(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 mytt(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.
sect(Similarities with tcsh)
(The sections on csh apply too, of course.) Certain features have
been borrowed from tcsh, including tt($watch), tt(run-help), tt($savehist),
tt($histlit), periodic commands etc., extended prompts, tt(sched)
and tt(which) built-ins. Programmable completion was inspired by,
but is entirely different to, tcsh's mytt(complete). (There is a perl
script called tt(lete2ctl) in the Misc directory of the source
distribution to convert mytt(complete) to mytt(compctl) statements.)
This list is not definitive: some features have gone in the other
direction.
If you're missing the editor function tt(run-fg-editor), try something
with mytt(bindkey -s) (which binds a string to a keystroke), e.g.
verb(
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. mytt(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 mytt(-c) option:
verb(
bindkey -s '^p' '\eqpwd\n'
)
In both these examples, the mytt(\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
verb(
bindkey '\eq' push-input
)
to save the entire buffer.
sect(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.
sect(Shouldn't zsh be more/less like ksh/(t)csh?)
People often ask why zsh has all these `unnecessary' csh-like features,
or alternatively why zsh doesn't understand more csh syntax. This is
far from a definitive answer and the debate will no doubt continue.
Paul's object in writing zsh was to produce a ksh-like shell which
would have features familiar to csh users. For a long time, csh was
the preferred interactive shell and there is a strong resistance to
changing to something unfamiliar, hence the additional syntax and
CSH_JUNKIE options. This argument still holds. On the other hand,
the arguments for having what is close to a plug-in replacement for ksh
are, if anything, even more powerful: the deficiencies of csh as a
programming language are well known (look in any Usenet FAQ archive, e.g.
url(http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/\
shell/csh-whynot/faq.html)
(http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/shell/csh-whynot/faq.html)
if you are in any doubt) and zsh is able to run many standard
scripts such as /etc/rc.
Of course, this makes zsh rather large and feature-ridden so that it
seems to appeal mainly to hackers. The only answer, perhaps not
entirely satisfactory, is that you have to ignore the bits you don't
want. The introduction of loadable in modules in version 3.1 should
help.
chapter(How to get various things to work)
sect(Why does mytt($var) where mytt(var="foo bar") not do what I expect?)
label(31)
In most Bourne-shell derivatives, multiple-word variables such as
verb(
var="foo bar"
)
are split into words when passed to a command or used in a mytt(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:
verb(
args() { echo $#; }
)
and with our definition of `var',
verb(
args $var
)
produces the output `1'. After
verb(
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,
verb(
set -A array one two three twenty
)
(or
verb(
array=(one two three twenty)
)
if you prefer), followed by
verb(
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, tt($IFS); in other words, with mytt(IFS=:; foo=a:b; args $foo)
you get the answer 1.
Other ways of causing word splitting include a judicious use of
`eval':
verb(
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 mytt(') in this example,
must already be quoted), or, less standard but more reliable,
turning on SHWORDSPLIT for one variable only:
verb(
args ${=sentence}
)
always returns 8 with the above definition of mytt(args). (In older
versions of zsh, tt(${=foo}) toggled SHWORDSPLIT; now it forces it on.)
Note also the tt("$@") method of word splitting is always available in zsh
functions and scripts (though strictly this does array splitting, not
word splitting).
SHWORDSPLIT is set when zsh is invoked with the names `ksh' or `sh',
or (entirely equivalent) when mytt(emulate ksh) or mytt(emulate sh) is in
effect.
sect(What is the difference between `export' and the ALL_EXPORT option?)
Normally, you would put a variable into the environment by using
mytt(export var). The command mytt(setopt allexport) causes all
variables which are subsequently set (N.B. not all the ones which
already exist) to be put into the environment.
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.
This is bigger as well as slower.
myeit() It really is mybf(every) variable which is exported, even loop
variables in mytt(for) loops. This is probably a waste.
myeit() An arbitrary variable created by the user might have a special
meaning to a command. Since all shell variables are visible to
commands, there is no protection against this.
)
For these reasons it is usually best to avoid ALL_EXPORT unless you
have a specific use for it. One safe use is to set it before
creating a list of variables in an initialisation file, then unset
it immediately afterwards. Only those variables will be automatically
exported.
sect(How do I turn off spelling correction/globbing for a single command?)
In the first case, you presumably have mytt(setopt correctall) in an
initialisation file, so that zsh checks the spelling of each word in
the command line. You probably do not want this behaviour for
commands which do not operate on existing files.
The answer is to alias the offending command to itself with
mytt(nocorrect) stuck on the front, e.g.
verb(
alias mkdir='nocorrect mkdir'
)
To turn off globbing, the rationale is identical:
verb(
alias mkdir='noglob mkdir'
)
You can have both tt(nocorrect) and tt(noglob), if you like, but the
tt(nocorrect) must come first, since it is needed by the line editor,
while tt(noglob) is only handled when the command is examined.
Note also that a shell function won't work: the no... directives must
be expanded before the rest of the command line is parsed.
sect(How do I get the meta key to work on my xterm?)
label(34)
As stated in the manual, zsh needs to be told about the meta key by
using mytt(bindkey -me) or mytt(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; mytt(stty pass8) is the
usual incantation. Sample .zshrc entry:
verb(
[[ $TERM = "xterm" ]] && stty pass8 && bindkey -me
)
or, on SYSVR4-ish systems without pass8,
verb(
[[ $TERM = "xterm" ]] && stty -parenb -istrip cs8 && bindkey -me
)
(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.
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).
sect(How do I automatically display the directory in my xterm title bar?)
You should use the special function mytt(chpwd), which is called when
the directory changes. The following checks that standard output is
a terminal, then puts the directory in the title bar if the terminal
is an tt(xterm) or a tt(sun-cmd).
verb(
chpwd() {
[[ -t 1 ]] || return
case $TERM in
sun-cmd+CHAR(41) print -Pn "\e]l%~\e\\"
;;
xterm+CHAR(41) print -Pn "\e]2;%~\a"
;;
esac
}
)
Change mytt(%~) if you want the message to be different. (The mytt(-P)
option interprets such sequences just like in prompts, in this case
producing the current directory; you can of course use mytt($PWD) here,
but that won't use the mytt(~) notation which I find clearer.) Note that
when the tt(xterm) starts up you will probably want to call tt(chpwd)
directly: just put mytt(chpwd) in tt(.zshrc) after it is defined or \
autoloaded.
sect(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
link(3.4)(34) 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
verb(\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
verb(
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.
sect(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 tt(.zshrc):
verb(
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 mytt(vi-backward-char) and mytt(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 mytt(<ESC>O) followed by tt(A),
tt(B), tt(C) or tt(D), as well as the corresponding set beginning
mytt(<ESC>[), so this may be redundant.
sect(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
verb(
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: mytt(ttyctl -f) freezes the terminal to protect it
from hiccups introduced by other programmes (kermit has been known to
do this).
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
character' when you don't want it to be), try
verb(
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 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?)
(This information comes from Bart Schaefer and other zsh-workers.)
Emacs 19.29 or thereabouts stopped using a terminal type of "emacs"
in shell buffers, and instead sets it to "dumb". Zsh only kicks in
its special I'm-inside-emacs initialization when the terminal type
is "emacs".
Probably the most reliable way of dealing with this is to look for
the environment variable mytt($EMACS), which is set to mytt(t) in
Emacs' shell mode. Putting
verb(
[[ $EMACS = t ]] && unsetopt zle
)
in your .zshrc should be sufficient.
Another method is to put
verb(
#!/bin/sh
TERM=emacs exec zsh
)
into a file ~/bin/eshell, then mytt(chmod +x ~/bin/eshell), and
tell emacs to use that as the shell by adding
verb(
(setenv "ESHELL" "~/bin/eshell")
)
to ~/.emacs.
sect(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
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 {)
or mytt(foo () {), and consequently no matching mytt(}) at the end.
This is the traditional zsh method. The advantage is that the
file is called exactly like a script, so can double as both.
To define a function mytt(xhead () { print -n "\033]2;$*\a"; }),
the file would just contain mytt(print -n "\033]2;$*\a").
myeit() The file contains the entire definition, and maybe even
other code: it is run when the function needs to be loaded, then
the function itself is called up. This is the method in ksh.
To define the same function mytt(xhead), the whole of the
usual definition should be in the file.
)
In old versions of zsh, before 3.0, only the first behaviour was
allowed, so you had to make sure the file found for autoload just
contained the function body. You could still define other functions
in the file with the standard form for definitions, though they
would be redefined each time you called the main function.
In version 3.0.x, the second behaviour is activated if the file
defines the autoloaded function. Unfortunately, this is
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
compatiblity, i.e. the function myem(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
function in the second form, and nothing else apart from comments
and whitespace, it will use the function defined in the file;
otherwise, it will assume the old behaviour. The option is set
if mytt(emulate ksh) is in effect, of course.
(A neat trick to autoload all functions in a given directory is to
include a line like mytt(autoload ~/fns/*(:t)) in .zshrc; the bit in
parentheses removes the directory part of the filenames, leaving
just the function names.)
sect(How does base arithmetic work?)
The ksh syntax is now understood, i.e.
verb(
let 'foo = 16#ff'
)
or equivalently
verb(
(( foo = 16#ff ))
)
or even
verb(
foo=$[16#ff]
)
(note that `foo=$((16#ff))' is now supported). The original syntax was
verb(
(( foo = [16]ff ))
)
--- this was based on a misunderstanding of the ksh manual page. It
still works but its use is deprecated. Then
verb(
echo $foo
)
gives the answer `255'. It is possible to declare variables explicitly
to be integers, via
verb(
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
verb(
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 mytt($(( ... ))) method will
always display in decimal.
sect(How do I get a newline in my prompt?)
You can place a literal newline in quotes, i.e.
verb(
PROMPT="Hi Joe,
what now?%# "
)
If you have the bad taste to set the option cshjunkiequotes, which
inhibits such behaviour, you will have to bracket this with
mytt(unsetopt cshjunkiequotes) and mytt(setopt cshjunkiequotes), or put it
in your tt(.zshrc) before the option is set.
Arguably the prompt code should handle `print'-like escapes. Feel
free to write this :-CHAR(41). Otherwise, you can use
verb(
PROMPT=$(print "Hi Joe,\nwhat now?%# ")
)
in your initialisation file.
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(#)
are metacharacters. tt(^a) matches any file except one called tt(a), so the
line is interpreted as bindkey followed by a list of files. Quote the
tt(^) with a backslash or put quotation marks around tt(^a).
sect(Why can't I bind tt(\C-s) and tt(\C-q) any more?)
The control-s and control-q keys now do flow control by default,
unless you have turned this off with mytt(stty -ixon) or redefined the
keys which control it with mytt(stty start) or mytt(stty stop). (This is
done by the system, not zsh; the shell simply respects these
settings.) In other words, tt(\C-s) stops all output to the terminal,
while tt(\C-q) resumes it.
There is an option NO_FLOW_CONTROL to stop zsh from allowing flow
control and hence restoring the use of the keys: put mytt(setopt
noflowcontrol) in your tt(.zshrc) file.
sect(How do I execute command mytt(foo) within function mytt(foo)?)
The command mytt(command foo) does just that. You don't need this with
aliases, but you do with functions. Note that error messages like
verb(
zsh: job table full or recursion limit exceeded
)
are a good sign that you tried calling `foo' in function `foo' without
using `command'. If mytt(foo) is a builtin rather than an external
command, use mytt(builtin foo) instead.
sect(Why do history substitutions with single bangs do something funny?)
If you have a command like "tt(echo !-2:$ !$)", the first history
substitution then sets a default to which later history substitutions
with single unqualified bangs refer, so that !$ becomes equivalent to
tt(!-2:$). The option CSH_JUNKIE_HISTORY makes all single bangs refer
to the last command.
sect(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 mytt(nohup)
option exists if you don't want them killed. Note that you can always
run programs with mytt(nohup) in front of the pipeline whether or not the
option is set, which will prevent that job from being killed on
logout. (mytt(nohup) is actually an external command.)
The mytt(disown) builtin is very useful in this respect: if zsh informs
you that you have background jobs when you try to logout, you can
mytt(disown) all the ones you don't want killed when you exit. This is
also a good way of making jobs you don't need the shell to know about
(such as commands which create new windows) invisible to the shell.
Likewise, you can start a background job with mytt(&!) instead of just
mytt(&) at the end, which will automatically disown the job.
sect(How do I list all my history entries?)
Tell zsh to start from entry 1: mytt(history 1). Those entries at the
start which are no longer in memory will be silently omitted.
sect(How does the alternative loop syntax, e.g. mytt(while {...} {...}) \
work?)
Zsh provides an alternative to the traditional sh-like forms with mytt(do),
verb(
while TEST; do COMMANDS; done
)
allowing you to have the COMMANDS delimited with some other command
structure, often mytt({...}). The rules are quite complicated and
in most scripts it is probably safer --- and certainly more
compatible --- to stick with the sh-like rules. If you are
wondering, the following is a rough guide.
To make it work you must make sure the TEST itself is clearly
delimited. For example, this works:
verb(
while (( i++ < 10 )) { echo i is $i; }
)
but this does myem(not):
verb(
while let "i++ < 10"; { echo i is $i; } # Wrong!
)
The reason is that after mytt(while), any sort of command list is valid.
This includes the whole list mytt(let "i++ < 10"; { echo i $i; });
the parser simply doesn't know when to stop. Furthermore, it is
wrong to miss out the semicolon, as this makes the mytt({...}) part
of the argument to mytt(let). A newline behaves the same as a
semicolon, so you can't put the brace on the next line as in C.
So when using this syntax, the test following the mytt(while) must
be wrapped up: any of mytt(((...))), mytt([[...]]), mytt({...}) or
mytt((...)) will have this effect. (They have their usual syntactic
meanings too, of course; they are not interchangeable.) Note that
here too it is wrong to put in the semicolon, as then the case
becomes identical to the preceding one:
verb(
while (( i++ < 10 )); { echo i is $i; } # Wrong!
)
The same is true of the mytt(if) and mytt(until) constructs:
verb(
if { true } { echo yes } else { echo no }
)
but with mytt(for), which only needs a list of words, you can get
away with it:
verb(
for foo in a b; { echo foo is $a; bar=$foo; }
)
since the parser knows it only needs everything up to the first
semicolon. For the same reason, there is no problem with the mytt(repeat),
mytt(case) or mytt(select) constructs; in fact, mytt(repeat) doesn't even
need the semicolon since it knows the repeat count is just one word.
This is independent of the behaviour of the SHORTLOOPS option (see
manual), which you are in any case encouraged even more strongly not
to use in programs as it can be very confusing.
sect(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,
verb(
HISTSIZE=200
HISTFILE=~/.zsh_history
SAVEHIST=200
)
tt($HISTSIZE) tells the shell how many lines to keep internally,
tt($HISTFILE) tells it where to write the history, and tt($SAVEHIST),
the easiest one to forget, tells it how many to write out. The
simplest possibility is to set it to the same as tt($HISTSIZE) as
above. There are also various options affecting history; see the
manual.
chapter(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.
sect(What is completion?)
`Completion' is where you hit a particular command key (TAB is the
standard one) and the shell tries to guess the word you are typing
and finish it for you --- a godsend for long file names, in
particular, but in zsh there are many, many more possibilities than
that.
There is also a related process, `expansion', where the shell sees
you have typed something which would be turned by the shell into
something else, such as a variable turning into its value ($PWD
becomes /home/users/mydir) or a history reference (!! becomes
everything on the last command line). In zsh, when you hit TAB it
will look to see if there is an expansion to be done; if there is,
it does that, otherwise it tries to perform completion. (You can
see if the word would be expanded --- not completed --- by TAB by
typing mytt(\C-x g), which lists expansions.) Expansion is generally
fairly intuitive and not under user control; for the rest of the
chapter I will discuss completion only.
sect(What sorts of things can be completed?)
label(42)
The simplest sort is filename completion, mentioned above. Unless
you have made special arrangements, as described below, then after
you type a command name, anything else you type is assumed by the
completion system to be a filename. If you type part of a word and
hit TAB, zsh will see if it matches the first part a file name and
if it does it will automatically insert the rest.
The other simple type is command completion, which applies
(naturally) to the first word on the line. In this case, zsh
assumes the word is some command to be executed lying in your $PATH
(or something else you can execute, like a builtin command, a
function or an alias) and tries to complete that.
Other forms of completion have to be set up by special arrangement.
See the manual entry for compctl for a list of all the flags: you
can make commands complete variable names, user names, job names,
etc., etc.
For example, one common use is that you have an array variable,
tt($hosts), which contains names of other machines you use frequently on
the network:
verb(
hosts=(fred.ph.ku.ac.uk snuggles.floppy-bunnies.com here.there.edu)
)
then you can tell zsh that when you use telnet (or ftp, or ...), the
argument will be one of those names:
verb(
compctl -k hosts telnet ftp ...
)
so that if you type mytt(telnet fr) and hit TAB, the rest of the name
will appear by itself.
An even more powerful option to tt(compctl) (tt(-g)) is to tell zsh that
only certain sorts of filename are allowed. The argument to tt(-g) is
exactly like a glob pattern, with the usual wildcards mytt(*), mytt(?), etc.
In the compctl statement it needs to be quoted to avoid it being
turned into filenames straight away. For example,
verb(
compctl -g '*.(ps|eps)' ghostview
)
tells zsh that if you type TAB on an argument after a ghostview
command, only files ending in mytt(.ps) or mytt(.eps) should be considered
for completion.
A useful addition for zsh from version 3.1 is directory completion:
verb(
compctl -/ cd
)
Before, you had to use tt(-g), but this is neater: it takes care of
things like ignoring directories beginning with a dot unless you've
typed the dot yourself, and whole directory paths are understood.
Note that flags may be combined; if you have more than one, all the
possible completions for all of them are put into the same list, all
of them being possible completions. So
verb(
compctl -k hosts -f rcp
)
tells zsh that rcp can have a hostname or a filename after it. (You
really need to be able to handle host:file, which is where
programmable completion comes in, see link(4.5)(45).) Also, from
version 3.1 you can always handle directories at the same time as
other files just by adding tt(-/) to the list.
sect(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 tt(\C-D) to see all the possible completions.
(That's assuming your 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(
it() with nobeep set, that annoying beep goes away
it() with nolistbeep, beeping is only turned off for ambiguous completions
it() with autolist set, when the completion is ambiguous you get a
list without having to type tt(\C-D)
it() with listambigous, this is modified so that nothing is listed if
there is an unambiguous prefix or suffix to be inserted
it() with menucomplete 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
it() with automenu, you only get the menu behaviour when you hit TAB
again on the ambiguous completion.
it() Finally, although it affects all completion lists, including
those explicitly requested, note also alwayslastprompt, 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
autolist, you may well want to `unsetopt listambiguous'.
sect(How do I complete in the middle of words / just what's before the cursor?)
Sometimes you have a word on the command-line (let's stick to file
names) which is incomplete in the middle. Normally if you hit tab
in zsh, it will simply go to the end of the word and try to complete
there. However, there are two ways of changing this.
First, there is the option COMPLETE_IN_WORD. This tries to fill in
the word at the point of the cursor. For example, if the current
directory contains mytt(foobar), then with the option set, you can
complete mytt(fbar) to mytt(foobar) by moving the cursor to the
mytt(b) and hitting tab.
That's not the full story, however. Sometimes you just want the
part of the word before the cursor completed. For example, the word
is mytt(/usr/loc/b), which you want to complete to mytt(/usr/local/bin).
Normally, zsh won't do this in one go because there are two bits
missing (but see below!), so you need to complete the mytt(/usr/loc)
on its own first. For this you need the function
tt(expand-or-complete-prefix): it works mostly like the usual
function bound to tab, but it ignores anything on the right of the
cursor. If you always want this behaviour (some other shells do
this), bind it to tab; otherwise put another binding, e.g. mytt(^X
TAB) in tt(~/.zshrc):
verb(
bindkey "^X^I" expand-or-complete-prefix
)
then in the example you can move to just after mytt(/usr/loc), hit
whatever key you've just bound, move to the end, and hit tab.
(Note that AUTO_REMOVE_SLASH behaviour applies here, see the manual.)
Even that doesn't exhaust the possibilities. Included with the
source distribution is the file tt(Functions/multicomp), a function
which you can bind as an alternative form of default completion (see
below for a description of alternative completion), e.g.
verb(
compctl -D -f + -U -Q -K multicomp
)
and whole sequences of directories, like mytt(/usr/loc/b) or even
mytt(/u/l/b) can be completed in one go. It works best with
menucompletion if the result is ambiguous.
sect(How do I get started with programmable completion?)
label(45)
Finally, the hairiest part of completion. It is possible to get zsh
to consider different completions not only for different commands,
but for different words of the same command, or even to look at
other words on the command line (for example, if the last word was a
particular flag) and decide then.
There are really two sorts of things to worry about. The simpler is
alternative completion: that just means zsh will try one
alternative, and only if there are no possible completions try the
next. For example
verb(
compctl -g '*.ps' + -f lpr
)
says that after lpr you'd prefer to find only mytt(.ps) files, so if
there are any, only those are used, but if there aren't any, any
old file is a possibility. You can also have a tt(+) with no flags
after it, which tells zsh that it's to treat the command like any
other if nothing was found. That's only really useful if your
default completion is fancy, i.e. you have done something with
mytt(compctl -D) to tell zsh how commands which aren't specially handled
are to have their arguments completed.
The second sort is the hard one. Following a mytt(-x), zsh expects that
the next thing will be some completion code, which is a single
letter followed by an argument in square brackets. For example
mytt(p[1]): mytt(p) is for position, and the argument tells it to look at
position 1; that says that this completion only applies to the word
immediately after the command. You can also say mytt(p[1,3]) which says
the completion only applies to the word if it's between the first
and third words, inclusive, after the command, and so on. See the
list in the `compctl' manual entry for a list of these conditions:
some conditions take one argument in the square brackets, some two.
Usually, negative numeric arguments count backwards from the end
(for example, mytt(p[-1]) applies to the last word on the line).
(Note the difference in the ways mytt(+) and mytt(-x) work. A mytt(+)
completion will always try and find completions for what's before
the mytt(+) first; it will only produce a list for what's after if
the first list was empty. On the other hand, if a condition for a
mytt(-x) matches, the appropriate set of completions is always used,
even if the list of completions produced is empty.)
The condition is then followed by the flags as usual (as in link(4.2)(42)),
and possibly other condition/flag sets following a single -; the
whole lot ends with a double -- before the command name. In other
words, each extended completion section looks like this:
verb(
-x <pattern> <flags>... [ - <pattern> <flags>... ...] --
)
Let's look at rcp again: this assumes you've set up tt($hosts) as above.
This uses the mytt(n[<n>,<string>]) flag, which tells zsh to look for
the tt(<n>)'th occurrence of <string> in the word, ignoring anything up
to and including that. We'll use it for completing the bits of
rcp's mytt(user@host:file) combination. (Of course, the file name is on
the local machine, not mytt(host), but let's ignore that; it may still
be useful.)
COMMENT(-- note space after backslash --)
verb(
compctl -k hosts -S ':' + -f -x 'n[1,:]' -f - \
'n[1,@]' -k hosts -S ':' -- rcp
)
This means: (1) try and complete a hostname (the bit before the
mytt(+)), if successful add a mytt(:) (tt(-S) for suffix); (2) if that fails
move on to try the code after the mytt(+): look and see if there is a
mytt(:) in a word (the mytt(n[1,:])); if there is, complete filenames
(tt(-f)) after the first of them; (3) otherwise look for an mytt(@) and
complete hostnames after the first of them (the mytt(n[1,@])), adding a
mytt(:) if successful; (4) if all else fails use the mytt(-f) before the
mytt(-x) and try to complete files.
So the rules for order are (1) try anything before a mytt(+) before
anything after it (2) try the conditions after a tt(-x) in order until
one succeeds (3) use the default flags before the tt(-x) if none of the
conditions was true.
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
completion if the word begins with mytt(foo) or mytt(bar),
myeit() spaces between conditions mean both must match: for example,
mytt(p[1] s[-]) says this completion only applies for the first word
after the command and only if it begins with a mytt(-),
myeit() commas between conditions mean either can match: for example,
mytt(c[-1,-f], s[-f]) means either the previous word (-1 relative to
the current one) is tt(-f), or the current word begins with tt(-f) ---
useful to use the same completion whether or not the tt(-f) has a
space after it.
)
You must be careful to put the whole expression inside quotation
marks, so that it appears as a single argument to tt(compctl).
Here's a useless example just to show a general mytt(-x) completion.
verb(
compctl -f -x 'c[-1,-u][-1,-U] p[2], s[-u]' -u - \
'c[-1,-j]' -P % -j -- foobar
)
The way to read this is: for command mytt(foobar), look and see if (((the
word before the current one is tt(-u)) or (the word before the current
one is tt(-U))) and (the current word is 2)) or (the current word begins
with tt(-u)); if so, try to complete user names. If the word before
the current one is tt(-j), insert the prefix mytt(%) before the current word
if it's not there already and complete job names. Otherwise, just
complete file names.
sect(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 mytt(-U) and mytt(-K func) flags you can get
almost unlimited power. The mytt(-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 mytt(-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 mytt(read -c). It can return a set of
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.
chapter(The future of zsh)
sect(What bugs are currently known and unfixed? (Plus recent \
important changes))
label(51)
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 link(2.1)(21); 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.
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() Zsh's notion of the current line number (via tt($LINENO)) is
sometimes not well handled, particularly when using functions and traps.
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.)
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
verb(
[[ 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.)
)
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):
itemize(
it() 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 mytt(unsetopt alwayslastprompt listambiguous) in your
tt(.zshrc) file.
it() tt(history-search-{forward,backward}) now only find previous
lines where the first word is the same as the current one. For
example,
verb(
comp<ESC>p
)
will find lines in the history like mytt(comp -edit emacs), but not
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.
It is possible to write functions which go a little closer to the
original behaviour; further changes are still possible.
it() In vi insert mode, the cursor keys no longer work. The following
will bind them:
COMMENT(-- note space after backslash --)
verb(
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 mytt(^[O) instead of mytt(^[[)). The
rationale is that the insert mode and command mode keymaps for
keys with prefixes are now separate.
)
Changes since zsh 2.5:
itemize(
it() The left hand of an assignment is no longer substituted. Thus,
mytt($1=$2) will not work. You can use something like mytt(eval
"$1=\$2"), which should have the identical effect.
it() 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. mytt(TRAPINT()
{...})) work as before.
it() 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.)
it() mytt([[) is a reserved word, hence must be separated from
other characters by whitespace; mytt({) and mytt(}) are also reserved
words if the IGNORE_BRACES option is set.
it() The option CSH_JUNKIE_PAREN has been removed: csh-like code now
always does what it looks like it does, so mytt(if ( ... ) ...)
executes the code in parentheses in a subshell. To make this
useful, the syntax expected after an mytt(if), etc., is less strict
than in other shells.
it() mytt(foo=*) does not perform globbing immediately on the right
hand side of the assignment; the old behaviour now requires the
option GLOB_ASSIGN. (mytt(foo=(*)) is and has always been the
consistent way of doing this.)
it() tt(<>) performs redirection of input and output to the specified file.
For numeric globs, you now need tt(<->).
it() The command line qualifiers tt(exec), tt(noglob), tt(command), \
tt(-) 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.).
it() The pushd builtin has been rewritten for compatibility with other
shells. The old behavour can be achieved with a shell function.
it() The current version now uses tt(~)'s for directory stack substitution
instead of tt(=)'s. This is for consistency: all other directory
substitution (tt(~user), tt(~name), tt(~+), ...) used a tilde, while
tt(=<number>) caused problems with tt(=program) substitution.
it() 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.
it() History expansion is disabled in single-quoted strings, like other
forms of expansion -- hence exclamation marks there should not be
backslashed.
it() The mytt($HISTCHARS) variable is now mytt($histchars). Currently both
are tied together for compatibility.
it() The PROMPT_SUBST option now performs backquote expansion -- hence
you should quote these in prompts. (SPROMPT has changed as a result.)
it() Quoting in prompts has changed: close parentheses inside ternary
expressions should be quoted with a tt(%); history is now tt(%!), not
tt(!). Backslashes are no longer special.
)
sect(Where do I report bugs, get more info / who's working on zsh?)
label(52)
The shell is being maintained by various (entirely self-appointed)
subscribers to the mailing list,
verb(
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
particularly welcome.
Two progressively lower volume lists exist, one with messages
concerning the use of zsh,
verb(
zsh-users@math.gatech.edu
)
and one just containing announcements: about releases, about major
changes in the shell, or this FAQ, for example,
verb(
zsh-announce@math.gatech.edu
)
(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
verb(
zsh-workers-request@math.gatech.edu
)
with the mybf(subject) line (this is a change from the old list)
verb(
subscribe <your-email-address>
)
e.g.
verb(
Subject: subscribe P.Stephenson@swansea.ac.uk
)
and you can unsubscribe in the same way.
The list maintainer, Richard Coleman, can be reached at
email(coleman@math.gatech.edu).
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
url(http://www.zsh.org/mla/)(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.
sect(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.
itemize(
it() Loadable module support (will be in 3.1 but much work still needs doing).
it() Ksh compatibility could be improved.
it() Option for glob qualifiers to follow perl syntax (a traditional item).
it() Binding of shell functions to key strokes, accessing editing
buffer from functions, executing zle functions as a command: now
under development for 3.1.
it() Users should be able to create their own foopath/FOOPATH array/path
combinations.
)
sect(Will zsh have problems in the year 2000?)
(This information was written by Bart Schaefer. Note it is a
description of the state of affairs as seen by the developers, it is
not a guarantee!)
You can confirm the following by looking at the source code yourself
if necessary; there's no other definitive reference:
Zsh uses UNIX/POSIX time_t, timeval, and tm data types for internal
date manipulations. These types either do not store year values at
all (for example, time_t is measured in seconds since midnight, Jan
1, 1970) or store them as integer types and NOT as pairs of digits.
Thus there can be no overflows at year 2000. On some unix systems,
time_t is a 32-bit value and will overflow during the year 2038, but
more modern systems use a 64-bit time_t.
The only input and output of dates that zsh performs for its own use
is optional history time-stamping. This is performed using time_t
values converted to long integers, which are either 32 or 64 bits,
see above.
Note, however, that zsh does provide facilities for formatted date
output, in particular in prompt escapes such as mytt(%W) and
mytt(%D) using mytt(print -P), so it's possible that scripts written
for zsh might employ 2-digit years. Shell scripts should always be
considered separate programs and therefore evaluated individually.
nsect(Acknowledgments:)
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).
nsect(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
documentation for any purpose, provided that the above copyright
notice appears in all copies of this documentation. Remember,
however, that this document changes monthly and it may be more useful
to provide a pointer to it rather than the entire text. A suitable
pointer is "information on the Z-shell can be obtained on the World
Wide Web at URL http://sunsite.auc.dk/zsh/".

74
Etc/FEATURES Normal file
View File

@ -0,0 +1,74 @@
------------
ZSH FEATURES
------------
very close to ksh/sh grammar, with csh additions
most features of ksh, bash, and tcsh
can emulate ksh or POSIX sh
81 builtins, 102 options, 162 key bindings
short for loops, ex: for i (*.c) echo $i
select
shell functions
conditional expressions (test builtin, [ ... ], and ksh-style [[ ... ]])
global aliases (may be expanded anywhere on the line)
directory stack access with =num
process substitution (vi =(cmd) edits the output of cmd)
generalized pipes (ls foo >>(cmd1) 2>>(cmd2) pipes stdout to cmd1
and stderr to cmd2)
arithmetic expressions
advanced globbing:
ls **/file searches recursively for "file" in subdirectories
ls file<20-> matches file20, file30, file100, etc.
ls *.(c|pro) matches *.c and *.pro
ls *(R) matches only world-readable files
ls *.c~lex.c matches all .c files except lex.c
null command shorthands:
"< file" is same as "more <file"
"> file" is same as "cat >file"
">> file" is same as "cat >>file"
ksh-style coprocesses
automatic file stream teeing (ls >foo >bar puts output in two places)
chpwd() function run every time you change directory (useful for
updating the status line)
job control
csh-style history
full vi line editing, including "c2w" and "y$" and such things
full emacs line editing
incremental history search
magic-space history
spelling correction
array parameters
$MACHTYPE, $VENDOR and $OSTYPE identify the host machine
$LINENO, $RANDOM, $SECONDS, $cdpath, $COLUMNS, $fignore, $HISTCHARS, $mailpath
$UID, $EUID, $GID, $EGID and $USERNAME can be assigned to
with autocd option, typing a directory name by itself is the same as
typing "cd dirname"
menu completion: pressing TAB repeatedly cycles through the possible matches
incremental path hashing
automatic process time reporting for commands that run over a certain limit
full tcsh-style prompt substitution
utmp login/logout reporting
with histverify option, performing csh-style history expansions causes the
input line to be brought up for editing instead of being executed
with sunkeyboardhack option, accidentally typed trailing ` characters
are removed from the input line (for those of you with Sun keyboards :-) )
autoloaded functions (loaded from a file when they are first referenced)
"cd old new" replaces "old" with "new" in directory string
generalized argument completion, including:
- command name completion
- filename and path completion
- hostname completion
- key binding completion
- option completion
- variable name completion
- user-specified keyword completion
- anything else you can think of
prompt on right side of screen
directory stacks
history datestamps and execution time records
command scheduling (like at(1), but in the shell's context)
tty mode freezing
up to 9 startup files (but you only need 1 or 2)
really 8-bit clean, and we mean it this time
which -a cmd lists all occurrences of "cmd" in the path
dynamically loadable binary modules

61
Etc/FTP-README Normal file
View File

@ -0,0 +1,61 @@
-------------------
FTP ARCHIVE FOR ZSH
-------------------
General
-------
README
You're reading it.
META-FAQ
Information about zsh ftp sites, web sites, and mailing lists.
FAQ
The zsh Frequently Asked Questions (FAQ) list.
pubring.pgp
PGP keys of some major Zsh developers.
MD5SUM
MD5 checksums of each file.
Source Code
-----------
zsh.tar.gz
Latest production release of zsh. Includes the source files of all
documentation.
zsh-beta.tar.gz
The current development version of zsh. Not guaranteed to be stable.
zsh-*.tar.gz
Specific zsh versions. If you just want the latest zsh then use
zsh.tar.gz or zsh-beta.tar.gz.
zsh-*-*.diff.gz
Context diffs between releases. Note that if you use this for
upgrading and you do not have the latest version of GNU autoconf
installed on your system you have to touch stamp.h.in and configure
in the main directory after applying the patches otherwise make will
think that these files are not up-to-date and will try to remake them.
Do not forget to specify the -p0 flag to patch. Without -p0 new
files will be created in the current directory.
old/*
Older zsh versions. Of historical interest only.
Documentation
-------------
zsh-doc.tar.gz
Pre-built Postscript, Info, DVI and HTML versions of the documentation
contained in the stable zsh distribution zsh.tar.gz.
zsh-beta-doc.tar.gz
Pre-built Postscript, Info, DVI and HTML versions of the documentation
contained in the beta zsh distribution zsh-beta.tar.gz.
zsh-*-doc.tar.gz
Pre-built documentation for specific zsh versions.

94
Etc/MACHINES Normal file
View File

@ -0,0 +1,94 @@
-----------------------------
ZSH ON SPECIFIC ARCHITECTURES
-----------------------------
These are the OSes that zsh has been tried on. If you succeed in getting
zsh to work on an OS not listed, let us know.
On all machines if you use gcc and upgrade your OS you must rebuild gcc
after the OS upgrade. A gcc left from a previous OS may seem to work
but compiling more complex programs may fail mysteriously.
The format of entries is thus:
Vendor: OS & version (hardware type) [zsh version tried]
information
Machines
--------
Cray: Unicos (C90 and T90)
Should build `out-of-the-box'.
Data General: DG/UX 5.4R3.10 MU01 (various AViiONs)
Should build `out-of-the-box'.
DEC: Ultrix (Alpha or DECstation)
DEC: Mach 3.0 (DECstation 5000/25)
DEC: OSF/1 1.2, 1.3, 2.0, 3.*, DEC Unix 4.* (Alpha)
In OSF/1 3.x, there is apparently a bug in the header file
/usr/include/rpcsvc/ypclnt.h; the prototype for yp_all() has a
struct ypall_callback as its final argument, which should be a
pointer (struct ypall_callback *). This prevents compilation of
one of zsh' files (zle_tricky.c). If you can't modify the header
file, create a directory called `rpcsvc' in zsh's Src subdirectory
and put a fixed version of the header file to it before compiling.
The strip coming with gcc-2.7.2 seems to create unusable binaries.
This problem is not related to zsh. If you have such problems,
remove the bogus strip and use /bin/strip instead.
FreeBSD: FreeBSD 2.2.7 [3.1.4]
Should build `out-of-the-box'.
HP: HP-UX 9, 10.20
Should build `out-of-the-box'.
IBM: AIX
Should build `out-of-the-box'.
Linux: Linux (i386) [3.1.4]
If you are using an early minor version of libc 5, then a bug
in the auto-configuration process may cause zsh to think that
your system doesn't support the lstat function. If the configure
process reports that there is no lstat, edit config.h and change
HAVE_LSTAT to 1. libc-5.2.18 or later does not have this problem.
NetBSD: NetBSD 1.*
Should build `out-of-the-box'.
Next: NextStep 3.*
Should build `out-of-the-box', but the zsh malloc routines are
not recommended.
Reliant: Reliant UNIX
Should build `out-of-the-box'.
Reliant: SINIX
Should build `out-of-the-box'. There is a bad combination of
static and shared libraries that prevents the use of dynamic
linking; configure now detects this and will disable dynamic
linking even if you requested it.
SGI: IRIX 5.1.1.1, 5.2, 5.3, 6.2, 6.3
Should build `out-of-the-box'.
Sun: SunOS 4.1.*
Under 4.1.3 if yellow pages is used, username completion may cause
segmentation violation. This is a bug in the shared library not
in zsh. Some libc.so.1.9.* has this bug (it fails in yp_all).
Statically linked binaries will work if linked with libc.so.1.8.1
(which means that if you can get a statically linked binary
compiled under 4.1.2 that it will probably work). An alternative
but untested solution may be to undefine HAVE_NIS in config.h.
This may work, but the first username completion will be _very_
slow (as slow as in tcsh).
Sun: Solaris 2.*
The UCB versions of the routines for reading directories are not
usable (the struct definitions are incompatible with the ones
assumed by zsh). The symptom of this is that globbed filenames in
the compiled version of zsh will be missing the first two letters.
To avoid this, make sure you compile zsh without any reference
to /usr/ucblib in your LD_LIBRARY_PATH. You can easily do this
by just unsetting LD_LIBRARY_PATH before building zsh.

59
Etc/Makefile.in Normal file
View File

@ -0,0 +1,59 @@
#
# Makefile for Etc subdirectory
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
subdir = Etc
dir_top = ..
SUBDIRS =
@@version.mk@@
@@defs.mk@@
# ========== DEPENDENCIES FOR BUILDING ==========
all: FAQ
FAQ: FAQ.yo
cd $(sdir) && $(YODL2TXT) FAQ.yo && mv -f FAQ.txt FAQ
FAQ.html: FAQ.yo
$(YODL2HTML) $(sdir)/FAQ.yo
# ========== DEPENDENCIES FOR CLEANUP ==========
@@clean.mk@@
mostlyclean-here:
rm -f FAQ.html
distclean-here:
rm -f Makefile
realclean-here:
rm -f FAQ
# ========== DEPENDENCIES FOR MAINTENANCE ==========
@@config.mk@@

203
Etc/NEWS Normal file
View File

@ -0,0 +1,203 @@
-------------------------------------
CHANGES FROM PREVIOUS VERSIONS OF ZSH
-------------------------------------
New features in zsh version 3.1 (beta version)
----------------------------------------------
On most operating systems zsh can load binary modules dynamically at
run-time. ZLE and the compctl builtin are now reside in a separate
module which is loaded automatically on demand.
for ((expr; expr; expr)) do ... done loop syntax from AT&T ksh93 is
now supported.
POSIX globbing character classes ([:alnum:] etc.) are now supported.
ksh's case fall-through feature (;&) is supported.
ksh93's $'' quoting syntax is supported.
Restricted mode is now supported. This is controlled by the new option
RESTRICTED (-r).
New options BARE_GLOB_QUAL, HIST_NO_FUNCTIONS (alias NO_LOG), KSH_GLOB,
PRINT_EIGHT_BIT, PROMPT_BANG, PROMPT_PERCENT, RM_STAR_WAIT.
Options ALWAYS_LAST_PROMPT, APPEND_HISTORY, AUTO_LIST, AUTO_MENU,
AUTO_PARAM_KEYS, AUTO_PARAM_SLASH, AUTO_REMOVE_SLASH, LIST_AMBIGUOUS
and LIST_TYPES are now on by default.
In ZLE, arbitrarily many keymaps can be defined. Multi-character
keybindings now work.
Completion can be performed within a brace expansion.
EMACS-like universal-argument function.
New features in zsh version 3.0
-------------------------------
Trailing "/" in a glob pattern now works like in other shell thus it
can no longer be used as a sorthand for "(/)".
Much improved sh/ksh emulation. When zsh is invoked as sh it mostly
conforms to POSIX 1003.2.
Enhanced parameter expansion features: new flags: A, @, e, W, p, f, F.
Expansions can be nested. For example,
"${${(M)${(f@)$(<builtin.pro)}:#char*}[2][(w)3]}" expands to the third
word of the second line of builtin.pro which begins with char. See
zshexpn(1) for the details.
***/foo glob does recursive directory search following symbolic links.
Traps defined by the trap builtin are now executed in the current shell
environment and not as a shell function. This means that $1 is not set
to the signal number. Of course the TRAPxxx functions continue working
as before.
Traps defined by the trap builtin are reset to their default values in
subshells.
Option names can be prefixed by `no' to unset an option.
setopt no_option_name is the same as unsetopt option_name.
This change affects the output of the setopt and unsetopt
builtins when these are invoked without arguments. See
the zshoptions manual page for more explanation.
!, {, } and [[ are now reserved words. Things like [[-z $foo]] or {foo}
should not be used. {foo} still works if the IGNORE_BRACES option is not
set but this feature may be removed in the future. [[ -z $foo ]] and
{ foo } should be used instead.
HOSTTYPE special parameter is removed. The new OSTYPE, MACHTYPE and
VENDOR parameters should be used instead.
VERSION parameter is renamed to ZSH_VERSION
exec now saves the history in interactive shells. If you do not like this
behaviour you can alias exec to 'unset HISTFILE ; exec'.
${~spec}, ${=spec} and ${^spec} used to toggle the effect of
globsubst/shwordsplit/rcexpandparam. Now these force the corresponding
option on. ~, = or ^ can be doubled to force the relevant option off for
the substitution.
Explicitly requested word splitting like ${=spec} or ${(s:delim:)spec}
will be executed even if the substitution is double quoted.
The right-hand side of assignments are no longer globbed by default hence
assignment foo=* will assign '*' as a value of foo. Use the foo=( * )
array assignment syntax to get the old behaviour. Alternatively the
GLOB_ASSIGN can be set to emulate the old behaviour but the usage of this
option is strongly discouraged and this option may be completely removed in
the future.
foo=$bar no longer creates an array even if bar is an array. Use
foo=( $bar ) or even better, foo=( "$bar[@]" ) instead.
When foo is an array parameter ${#foo} will always return the length of the
array even if the substitution is double quoted. ${(c)#foo} should be used
to get back the old behaviour.
When the prompt_subst option is set prompts are fully expanded using
parameter expansion, command substitution and arithmetic expansion.
In 2.5 backquote substitution was not performed in the prompts so this
change might cause problems in some startup scripts if ` is used literally
in prompts.
History substitution is now not performed if the history escape character
appears in a single-quoted string. This may break some interactive shell
functions which use \! in single-quoted strings.
The UID, EUID, GID, EGID parameters can be assigned now. The assignment
executes the setuid(), seteuid(), setgid(), setegid() respectively. On
systems where setuid and seteuid is not supported these functions are
emulated using setreuid or setresuid which may result in a different
behaviour.
Assigning the USERNAME parameter will call setuid(uid) where uid is the
user id of the specified user.
The privileged (-p) option is automatically set on invocation if euid != uid
or egid != gid. If this option is set no user startup files are sourced.
The shell will drop privileges when this option is unset by resetting its
euid to uid and its egid to gid.
The =number substitution for accessing the directory stack is changed to
~number to allow =command substitution when a command name begins with a
digit.
<> is a redirection operator which opens the standard input for both
reading and writing. To match a number use <->.
Option letters -1 and -C for PRINT_EXIT_VALUE and NO_CLOBBER are swapped:
`set -C' sets NO_CLOBBER and `set -1' sets PRINT_EXIT_VALUE.
AUTO_PUSHD behaviour is changed. Now cd without arguments will always go
to the $HOME directory even if AUTO_PUSHD is set and PUSHD_TO_HOME is not
set. If you preferred the old behaviour you can alias cd to pushd.
IFS word splitting with SH_WORD_SPLIT and the splitting of the input in the
read builtin has changed in cases when IFS contains characters other than
<space>, <tab>, <newline>. See the description of IFS in the zshparam
manual page for more details.
New features in zsh version 2.5
-------------------------------
Greatly expanded completion possibilities. Programmable completion
allows detailed control over what arguments of what commands can be
completed to what. See dots/zcomp in the distribution for examples.
Expand filenames with ~ and = on the right hand side of parameter
assignments. New option MAGIC_EQUAL_SUBST to do it in all
identifier=expression arguments.
${+name} becomes 1 or 0 if name is set or unset. ${~spec} toggles
GLOB_SUBST in substitution. Parameter substitution takes lots
of flags in the format ${(flags)name}.
New glob qualifiers for block/character special files, times in glob
qualifiers can be in months, weeks, days, hours, minutes. Qualifiers can
work on links or on what they point to. Qualifiers separated by commas
are or-ed.
New parameter substitution modifiers (fFwW) to repeat actions. New
option CSH_JUNKIE_HISTORY.
New line editor functions history-beginning-search-backward,
history-beginning-search-forward, expand-or-complete-prefix, push-input,
push-line-or-edit.
Assign to part of a string, use qualifiers on string subscription with
$foo[(qual)2,5]
New parameters: EGID, EUID, KEYTIMEOUT
New prompt escape sequence %_ to get constructs like for and while in
the secondary prompt. %E in prompt clears to end of screen.
Conditional expressions in PROMPT and WATCHFMT.
New options ALWAYS_LAST_PROMPT, ALWAYS_TO_END, AUTO_PARAM_KEYS,
COMPLETE_ALIASES, COMPLETE_IN_WORD, CSH_JUNKIE_HISTORY, GLOB_SUBST,
LIST_AMBIGUOUS, MAGIC_EQUAL_SUBST, NO_FLOW_CONTROL, PROMPT_SUBST
New option -m to many builtins makes arguments subject to pattern
matching.
Bindkey can now bind both key sequences and prefixes of those. You can
for example bind ESC and function keys sending ESC sequences.
Additional options to read builtin to use in functions called by
completion.
New options to print to sort arguments and print them in columns.
Some additional resource limits can be specified.
Some editor functions now work in the minibuffer.

150
Etc/pubring.pgp Normal file
View File

@ -0,0 +1,150 @@
Type Bits KeyID Created Expires Algorithm Use
pub 2048 0x8E1E1EC1 1997-05-15 ---------- RSA Sign & Encrypt
uid Andrew Main <zefram@fysh.org>
pub 2048 0x0FD2FDD5 1998-04-22 ---------- RSA Sign & Encrypt
uid Geoff C. Wing <gcw@pobox.com>
pub 1024 0xEE305E20 1998-04-22 ---------- DSS Sign & Encrypt
sub 2048 0xB1A6D227 1998-04-22 ---------- Diffie-Hellman
uid Geoff C. Wing <mason@primenet.com.au>
pub 1024 0x71FB29E1 1994-10-10 ---------- RSA Sign & Encrypt
uid Richard J. Coleman <coleman@math.gatech.edu>
pub 1024 0x8B37BE3D 1995-11-20 ---------- RSA Sign & Encrypt
uid Zoltan Hidvegi <hzoli@cs.elte.hu>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 5.0i for non-commercial use
mQCNAzCw9pkAAAEEAKzybIrP6bvoDF7kJjTVgErU59QOsDQuQAFyPYxx9TrGST9Y
5kVtimMFiHmOaePtLzEMlJvAqHNnYGQge2WmH7V/jC678wdTlSouBoPN/6U8qq5N
+9BsW/pVvFOEJ4vhEXdOnj5Jcmp4+M6/Tb4c/rS5SdyZPP9yhQupSCiLN749AAUR
tCFab2x0YW4gSGlkdmVnaSA8aHpvbGlAY3MuZWx0ZS5odT6JAJUDBRAwv1zNC6lI
KIs3vj0BAaObA/9nFIIRGrP9wlCAuxQDwqGTuNKVUeKVyzuaj9zwsUULABGITZGT
tASMEb0X1HA2I822PZ8b6m1xj7idlwOSmCrO9gNgWr2VblynZo9LAZflwcTxr/9e
0oC+3owLFXadg7zUrYeRc9EJrhQ299nNoqkjOZbUQtZ97xcRfoMs0brpHpkAjQMu
mbisAAABBADshMnQari3rUDdHrxfSUlCO/nWJ4E/pcKPOnft2SUWaTC5q6IzaTUK
FauLy0DxRSIgO3w2Cd7ynm8rwtSXIvUvJg3X+fO1lm8MwePazh3A0DQxqSV2IsXb
I7yLq5IUWHSFIEZkQ9+hR7mi1Sx0dJ3WfnEh8LA/glkOAgIJcfsp4QAFEbQsUmlj
aGFyZCBKLiBDb2xlbWFuIDxjb2xlbWFuQG1hdGguZ2F0ZWNoLmVkdT6JAJUDBRAw
sPeuC6lIKIs3vj0BAZNeA/4pezBr5xMV/HX1P/u1YZMkFE/XV33svOggOUOhui0F
m1MD64D6oofjO2j0L8cV/YWwzT+pNB0JANH67MPaeK/zPffFDeq1yVumR6jmBoWR
L2IgTS5t2+5oC7T7lXRKu1JF0F8lY+jfDc+ZnjwL/WIcZqf0PYoLwWBcA3bES1T/
yIkAlQMFEC8TK1KxPDjWo/GviQEBGgwEAJvnaxkio5hj4I55NSDVFlvr98OttR5C
awR/TmWoAPUumpJ4QfErnnS7Ucv8thGRb62Mj+nF+T9/Tyj2piv1yHYPdyWqlhps
L3oxU7WG4dqv1KrfaxvLulHyrveYTdW1BQ+WzD7tQ4DOxpCUcfTxAwZ61cAQEiVd
JepcOUVes+SjiQCVAwUQLw9QuQ4CAglx+ynhAQGi9gQAxBOzT2OwGu7Ri9NuIk47
BfONzb0mPIrEPG6ztKNN0h5m/VZxqKh0kQSXTk4QCt5LCBqdunZY86DJxHckHYd0
l5Tt22gALhmJL0+pi7t6A5YOonW83LXxYlxpCPxoElxerE/gfb5xiXZ9qgL1GGvO
HD8l8WTImMGlkGDdRqNYn0GZAaIENT3vPBEEANHaBoXO7hHxcynHhNPxG+4NvPb9
RhINSM1t+yC9GFKWNXv4mSbGqEIcFo0jsOQQFd3m5ETMBHbFy2hwlzxOYQTSzgGO
b5ULWJeGCYQ1tsZwAAdyFFh5hwOWiB9+KM5NXT8WcvF8KLZbvY3cFVSGJFnxtRn4
olWhtdzMx1WRa+4/AKD/+KLMt958vS/YWxeKC+wt822GgwP+PpW2NeAHpheDoNnP
P/wpPjuYytdc2M+XwNaq1bcxJXfrOqT6ZY1QnwxzHIeGCgZ78XR5kduRJHDkq7/X
zYaEooCuuKZf8+raJ+egycYS/Oqc9fQitsQbvetzvGDJUIBYXrePwKpK9QxMh77+
OeaOV8n+MjA8RA4nPWmhw7540twEAIzn42webcFtUbTWy+zXCp7fPw4lBDAXMRPZ
D8wIjzzn4z/c9o0ypiwAjKVu5V8aWwjcVJICyvCU4H34yoUb3xFg2UL/VGa72LbY
sccmuGdAsqkn1nCVnjV/IACVVZLfYZMBGQQdAmkKBDQ040itSse2Z3+ND9OlN1d/
DnCGa4cwtCVHZW9mZiBDLiBXaW5nIDxtYXNvbkBwcmltZW5ldC5jb20uYXU+iQBL
BBARAgALBQI1Pe88BAsDAQIACgkQs67qk+4wXiA3+wCfWwTNkmLlcR8amztHk6Nu
KA4LPusAoIkx+pq8j7762htEs6tGfyscJqFGiQEVAwUQNT3vnw8wSIEP0v3VAQHs
nQf8CzJbDpKHSYSUf12dsJdLa6ewcacf9OKVobl3EIbpNdov+1C6QgAQsWogPrcA
z/2bzLPCJ+CilxcK4Rk4vywi8riuJm7ROEiBSsdhIDY0nBQHL4rqFFGlnq5/DzXO
jyLmJs4X6noWKJ1rFWxPFGzy8kICuKAXuQvzX0a1VqgKgIovCgbUJJg8Et1MHZsS
LeHhenNLAT0lNRbEyizDgxkZWvTqsmkLtlKkVxEyGjtl2l+2hSLgT6zuaSWNqQjB
XFyo4wzQLy+zmqTEseI3bVqYVsQv8LCkLNn8dCDqysbTd1bIbOzcGIxBlZYML2a6
MxAebh2GTfkRnJE+2fQ7Tw6GKrkCDQQ1Pe9AEAgA9kJXtwh/CBdyorrWqULzBej5
UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1
WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01ue
jaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJ
I8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaG
xAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwAC
AggA9d0Df2yhKHDKkEejKtPIDlgaAcHMOzNekpzLwiRYv9C/mpTtbcWg4wMcP2WX
7rbkhsqXrQdcSqGtRDR83bt2ku1wu+bWyjcXeoR5azGjl5as/0oqD9qhl0yANnia
F+LwSrpjf8fn/Xor3TIQIOkNIUsYndVlsSws+OlWzZNsuT5leuL2ULIkf3IkkaxN
QuoZJfb5t+MHGzTmPr+nv2aufoIsgrMkYIjRU66jfaB+8t9dec8dusXDbxYdzkMw
rZ2FopY555yWGa35gIqlR0vLicqMVCxKlBGdVywgm88ivvRM0zIsQeKrDwjVX+72
c6DpgGsUewyCVTcKrg6uAoxT24kAPwMFGDU970CzruqT7jBeIBEC8XoAoI+NzBGk
7TyKFeRu6cs9QanAlxd5AKDImBDYzuBL6Emr96VkyNXTMtOPK5kBDQM1PexvAAAB
CAC85eki1QHZQTQ10nYQ9Obu436/limVDqgCcefn7863bUFveY8uYhdB+rmd0+wa
ltUYHWrA4e7Tt0v/2V40KDB9xQeQlU4rXVGVSg9ffzuVHhBObvzCbyAQWVRezv8S
p4b7e/9nJSthy/Sovy/WE6svuwbiL2y3mFyYYE3z5WUCIXwpNXnTmmwyExduNtvy
GzLhiieVsQKLFnGiRgadzJxPu3bXxomJTbqeC91s5vtTL2X5pmFNVL+jWL2O4sev
E66XFPFdHSDnj9jnXBc051TGmemuyRsukAknXQCApRTc3nyiK8rVQP27OwEmy4rq
xe8MgnDTWq6QiQ8wSIEP0v3VAAURtB1HZW9mZiBDLiBXaW5nIDxnY3dAcG9ib3gu
Y29tPokBFQMFEDU97G8PMEiBD9L91QEBn74H/3e6mzIU5oIljf6Ycs00HP0MRHqh
pSvOeDR7oHZOVJTIWy/qkQ8QxCw9zyA+GQ/zWc/Db9VlUZvdYZbnHJG19WyVB3Y/
nVYwP6TQqq/sfgweHhFlUvRJStbGXYdTjGPWxpd6Qn+G8XwCr9/4tS23rM9VPd4I
gMUbQH6ruCzrHI+G5BJE1IHShbK7i2RmZfdB6Yv06PpddB1BetJO77E/fwPneTvk
A7dD3s5El2RHTM2c0Z1Jpvg8YHLrUcXmfNKXa8hD8wRRavyIoHfvPtmjHj+dt1lE
T8B0o6bH/DPT027nT7Qo5k6rmHg3Qk1398794vhpBgwxpEC77OVUzMwOPhqJAD8D
BRA1Pe+0s67qk+4wXiARAoXsAJ9DYXxh0GN9FbE7Z2U5beFf37BPGgCeJPVD9rSr
gGtuca/4DEhDAGSAfn+ZAQ0DM3r8XAAAAQgApHzqec/wFmjoEDIX93y8L4fvVs13
qzKFvdsGeTSiPAjKfEyw9rELlzAwtqWdkDUBeU6tld342GjcDCVKKY5snun1746Z
Ui6rkjnFdPimv8fwJc6tAC4NoWerVC9bbpdsDbbzdaxf1RATmB8B81vY7+3NNegk
WuxTBwl/QV7aS5qZ+kFpsP5ANYnjcBQeL2ejzmmLMU9ntdRa7XAHUvsUobV3bgP7
8fdz6w+LEs5wHcD5FGBEOrmr5rk9AYErds/i2vCOKB66QrqzfXSg8AfY9CqfVn8p
o3os/GiXtLYS86vg44S8P9Vel2ajW8kWwjQhXLxjBB422B6ZpPRnjh4ewQAFEbQd
QW5kcmV3IE1haW4gPHplZnJhbUBmeXNoLm9yZz6JAJUDBRA0Ygop5kcdJXa50hkB
ARugBACiuBehrCsCJ9eskOIGYijVyOkw0ds+Rl/f491CoK4At7oAQzESR4sfBKRo
PpnCLGVen01dgshcf00lM+Yp8qrjT/BSrD58L98aaig7pBD5t5KwePjwhS+kB/tc
41SiCsXhcuzsacqsUhhZ0SoUtD7Dq901KCrhvmSLK0DGrI+dr4kAlQMFEDRfSDpL
2cze8VY7wQEBt0AD/06seQfvtDwduYd9xoUc9EHFmtJH1RkR4fn+KKngyKPZVUwn
38cHa5CfbEUhF2bD0ADFHcOMiaO2k6yHT9EG3FWRyGsF6lAAlUK6NqtTymA2sFig
R7VTbq25V4CjOFRSti8d2yeDPJ5nyj5YzTzkx0XHl2//hF6QrROIv3YYh16wiQCV
AgUQNF9FqnCjAd4lTWyNAQGAzgQAguA8BzjPfca6TDJbuj5fQdTwEJuMHZ9asQQf
zy43q9qHUINRy0LlyqiIEQtggQIbp20pvHtnUwBaK00y2wOToe3kprCym4NEuT/g
wMRXGiGF2cBJzWNXWn7aNXnGp1UP1Yb9C9zHIgCApFHd8d0qzQNQONN5vYTa6BRS
UzkCvkqJARUDBRAzhKKK1b5+4POEA70BASZqB/49jNe6xRyUe+3u3IiOiYjLRRLz
VkyA4x9xIURHsKE3oUa0vI6wyGhQzHWFuKom9mqQKDR12T9LYoVvNi94qixTgBlD
Fw+Tm+FfxmguQCTPgY9MRGGS6A9fuSd/kbyjn+w1HY9nVM4B2Nrn0xPQ/7uUZ0a1
7cUBi5+jk6r9xDTfRkP7wn+LEA3rg6tNkn6apfsDyHOSHPr8GZKBdmqthAJQP6eF
im3k6pPzv+232XyejDBlHiPloGrX4bA6C69pqazyoH4YD5knZU0gYsF6DJfRsruB
lw9YIKj+lw6AwYRAO+2PgHjIY9sEFDuCZn2IFr/gwGSAVBRVtG9YZkA+l23ziQCV
AwUQM4HINSV6yMkAhfdJAQFBYQQAsu0G4HUtlUM92p4qxAVjG9mmdZRmb9YNfr1G
AQX9vgx7R2oJ+CwiGfmO1lUtvhJUQNbjZTCmF3n14/5gbJ1loOh7KUGE/wJHqeUJ
n6ziMkpR4Rzff6LmCr5zDsW8ZjTz+B8Cfar+SFWuNbue35tFmqVOvxv724eSCb47
aHwlMkOJAJUDBRAzg6nxc4ScsTlXuf0BAST+A/4vQUMaVFYuKyNcgOkilcSOLHYE
g+jIlGoBBi6Khi+P0iFVUde0xr61WiSxsbTSTYLmHnGi7fQ+iqPBFzb6NuyJ4R3t
96SiFeD3Oe3znN11gF1AtR86wc3m3cymvwrMOzfK0vkN7iudv9jkrtbk4x8JAPTL
MfT6adD4NkFr7pZA6IkBFQMFEDOC9G+ZamtmIJq5/QEBN6wH/3isXVyHRue7uKDA
vsGnb4GmTazwuK1lmREaZ1ZL/609VCp0zo0osrjrDsWiqnU9zve1ZHrImr3BELCG
LrkaE+mjoK80reGc0hdQF0/mwBZrIkT8Pcncjv8vE6b9IuacWJf+S/HpFnfv+RxB
k57A7uAOJLP1vhI/Mq9B/TARdkmqDmKcTpYGIxYjhvRPV07aD/K7fRivhNBibCgm
n97sSBEdf4Nq3NTbByetTuktUoPEn3MpqnUjxnqrmt7HztRq96XXjz/gZdYVtI9o
nzuP92H6YKJcCUVZMt4zzhEOw8iDsrIGfGcje5UW3qSHI6JUOTmyGCd1mzLDsqMK
kaElcWiJAJUDBRAzgYq2TQiMTNnrYBEBAS1OBACOdN3qf88fl7bJtsZNqY6jQEQ3
GPJrtUroP7vWSxnV8jKO2egxfAbmp+UGZoD6imoH89TU9Ny/E1/nsRWriWx4hZOJ
hUDA4TOUOX0nhfeeC43u2t+D/v36JDjUzipWL2mGe6B8jrElgqb71gT/qgT/yV81
wPuHDO9zih/m69p2rokBFQMFEDOAxoyGWkrM32Hp2QEBGnMIAJ4k3kL3xVOxa+bM
5uXe57leOX6dsut4QKnrsQ862VYHhF7N4ZYQs3lv4ygLguqTZ02fcZyr6l9q102s
87AoY8RfE/ESewepTcqLT4Dm5K7EAoRdGZ/2yWrA8fHdVGKHl7UO5IqcTLQ5AOOg
lhAgy+GPx3UcN+EPNgLNd3pMvIG2NnBGwhP88sa4R9JfvK0eGAE9ElbTdbR6xBKn
JneuAQPUIdO0GVgowrDfiSlupjFhW+CeKfDix3isJEnRbohNq4BawSL2aC88UOIE
X7osbVd8nFufPlEKaN6EhaIWiixF1W3LI/wiF5HV0u3nwaN4Qy15OXjcD/7urbuQ
cU+B2yCJAJUDBRAzgN6EolKYYFEYdpEBAZc2BAClMzFxU50TN54jp444QicsjtlS
IioqQMchFq30WSwxkeZOE7QGAqX9pBxSoCjbK0mf2UXM/V+8dhIfl0Y/EQchNFyL
qv01GnMiW5r/pXm4eZoMw9atpXx+kuvEO7N5VgvdrBgix3PUSX9pYHSxeNVhrV9M
YZMzMaPoB36t1B+rkokBFQMFEDOA3nnZ/s5HNAtHpQEBXxcH/RoVXW1jg9PoJhTh
Ab4xO95QKPILKwNGUBTdMOZbwDKFmbfjAxOU0VSJqp7U5aQeHCHsm3lLCF/4gWE/
FDEq7goNj/COivg6egB1ZTfgBFdpHbGqQhPJgvUoh7uufPIqNej2h0Vi4JeLyyp/
Pdw8i7lvaMRp8W8q9votJ6ma3Nm8zNOXbr7hNl9LBLNrL6928s9RCT8GbrPoZqDZ
vs5AUhUxOuVgLmqxsw2jjQp9grqkIPsC46ANlyyGe+Iyfhnyc2EGuF0TpBSjJC8e
uQKmLagjGaW5qBZPqnut24z2YAyPxpPffQbkKmNuy0DCYM1vMeW3/5uPvHPsIA7w
/Tp++UiJAJUDBRAze0HFa/97sSWYQUUBAUp5A/9Ae02CVK2dTO2uNWE5V4DgFIcq
85xTd2LFw3lWs8dP5wNCINo+FYaxhQxlj7uzE7InVSMTmO1nOlHo/SB4DmwIRSEh
q2mZCMABjbQW1AyU0q8VRgtY3y/wfGpzeXTKNsf7ab2BkjLf63XeZcIY3UDjoJts
XHO8K5Z8CnUu8e4HMYkAlQMFEDN6/Yxw//hyU6VP4QEBvWsD+wWXB8Xtu0DPIvoy
ZvgjuhLcmibLcUNeD7piEh5WrXdjiUIJxwkw4X7eMqirvqCQLaKEoN6XJob+8KT9
NCOB4ErTPGnzWM2vYApy8sra833xP3evOmN4bT5DuZpkN+RVRAGLa95RU4Q4eZnY
MSxtEk/f09l5pWyuPvDJUCZdzYD/iQEVAwUQM3r8XJmk9GeOHh7BAQEUmAgAly7y
5pNJBs24zzr46fGBLLwhrkzTRyhwIkgEI9cYMpRbV1E5XgqaOjS11vKnmSu+pEql
XMJUV7MlM5p52YtaEx7C5u+WK6eK6hIP0eFi6kehuegqdRfIKfAz6aeu80Zutu/K
i2vOA0O2+hRJnDRsqGBlx8KRQl5c8Vo2OkK8kxk+PVbbgYf5HZRF0yGxdaE4kxG2
F14sL0DKmY99b+RPeu4v3Gz1rPz8lTetlIXaXJoFrgF8gCk+IDNB5aen69WoAQeP
yHE6uCn6a1RC+rM8Jhv/PI/lKEQabekGYC5gP7QEIYqcmwdKTv0pzP1FY9/tmVsB
C4+RT5QRIxKJMxXh6Q==
=/T9G
-----END PGP PUBLIC KEY BLOCK-----

5
Functions/.distfiles Normal file
View File

@ -0,0 +1,5 @@
DISTFILES_SRC='
.distfiles
acx cat cdmatch cdmatch2 checkmail cx harden mere multicomp proto
pushd randline run-help yp yu zed zls
'

6
Functions/acx Executable file
View File

@ -0,0 +1,6 @@
#! /bin/sh
#
# zsh shell function to make its arguments 755
# also works as an sh script
#
chmod 755 $*

16
Functions/cat Normal file
View File

@ -0,0 +1,16 @@
#! /usr/local/bin/zsh -f
local file
if ((! ARGC)) then
set -- -
fi
for file
do
if [[ "$file" == - ]] then
while read -u0ek 4096; do ; done
else
while read -u0ek 4096; do ; done < "$file"
fi
done

23
Functions/cdmatch Executable file
View File

@ -0,0 +1,23 @@
# Start of cdmatch.
# Save in your functions directory and autoload, then do
# compctl -x 'S[/][~][./][../]' -g '*(-/)' - \
# 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
#
# Completes directories for cd, pushd, ... anything which knows about cdpath.
# You do not have to include `.' in your cdpath.
#
# It works properly only if $ZSH_VERSION > 3.0-pre4. Remove `emulate -R zsh'
# for all other values of $ZSH_VERSION > 2.6-beta2. For earlier versions
# it still works if RC_EXPAND_PARAM is not set or when cdpath is empty.
emulate -R zsh
setopt localoptions
local narg pref cdp
read -nc narg
read -Ac pref
cdp=(. $cdpath)
reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) )
return
# End of cdmatch.

15
Functions/cdmatch2 Normal file
View File

@ -0,0 +1,15 @@
# This function should be called from compctl to complete the
# second argument of cd and pushd.
emulate -R zsh # Requires zsh 3.0-pre4 or later
setopt localoptions
local from
read -Ac from
from="${from[2]}"
eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )"
reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" )
[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''"
return

26
Functions/checkmail Normal file
View File

@ -0,0 +1,26 @@
#! /usr/local/bin/zsh
#
# This autoloadable function checks the folders specified as arguments
# for new mails. The arguments are interpeted in exactly the same way
# as the mailpath special zsh parameter (see zshparam(1)).
#
# If no arguments are given mailpath is used. If mailpath is empty, $MAIL
# is used and if that is also empty, /var/spool/mail/$LOGNAME is used.
# This function requires zsh-3.0.1 or newer.
#
local file message
for file in "${@:-${mailpath[@]:-${MAIL:-/var/spool/mail/$LOGNAME}}}"
do
message="${${(M)file%%\?*}#\?}"
file="${file%%\?*}"
if [[ -d "$file" ]] then
file=( "$file"/**/*(.ND) )
if (($#file)) then
checkmail "${^file}\?$message"
fi
elif test -s "$file" -a -N "$file"; then # this also sets $_ to $file
print -r -- "${(e)message:-You have new mail.}"
fi
done

6
Functions/cx Executable file
View File

@ -0,0 +1,6 @@
#! /bin/sh
#
# zsh shell function to make its arguments executable
# also works as a sh script
#
chmod +x $*

6
Functions/harden Executable file
View File

@ -0,0 +1,6 @@
#! /bin/sh
# harden a link (convert it to a singly linked file)
cp $1 $1.foo
rm $1
mv $1.foo $1

3
Functions/mere Executable file
View File

@ -0,0 +1,3 @@
#! /bin/sh
# read a man page in the current directory
nroff -man -Tman $1 | less -s

80
Functions/multicomp Executable file
View File

@ -0,0 +1,80 @@
# multicomp() {
# Completes all manner of files given prefixes for each path segment.
# e.g. s/z/s -> src/zsh-2.4/src
#
# Usage: e.g.
# compctl -D -f + -U -Q -S '' -K multicomp
#
# Note that exactly matched directories are not expanded, e.g.
# s/zsh-2.4/s<TAB> will not expand to src/zsh-2.4old/src.
# Will expand glob patterns already in the word, but use complete-word,
# not TAB (expand-or-complete), or you will get ordinary glob expansion.
# Requires the -U option to compctl.
# Menucompletion is highly recommended for ambiguous matches.
# Liable to screw up escaped metacharacters royally.
# $fignore is not used: feel free to add your own bit.
emulate -R zsh # Requires zsh 3.0-pre4 or later
local pref head sofar origtop newtop globdir="(-/)" wild
setopt localoptions nullglob rcexpandparam globdots
unsetopt markdirs globsubst shwordsplit nounset
pref="${1}$2"
# Hack to allow programmable completion to select multicomp after a :
# (e.g.
# compctl -D -f -x 's[:]' -U -Q -S '' -K multicomp
# )
pref="${pref#:}"
sofar=('')
reply=('')
if [[ "$pref" = \~* ]]; then
# If the string started with ~, save the head and what it will become.
origtop="${pref%%/*}"
eval "newtop=$origtop"
# Save the expansion as the bit matched already
sofar=($newtop)
pref="${pref#$origtop}"
fi
while [[ -n "$pref" ]]; do
[[ "$pref" = /* ]] && sofar=(${sofar}/) && pref="${pref#/}"
head="${pref%%/*}"
pref="${pref#$head}"
if [[ -n "$pref" && -z $sofar[2] && -d "${sofar}$head" ]]; then
# Exactly matched directory: don't try to glob
reply=("${sofar}$head")
else
[[ -z "$pref" ]] && globdir=
# if path segment contains wildcards, don't add another.
if [[ "$head" = *[\[\(\*\?\$\~]* || -z "$head" ]]; then
wild=$head
else
# Simulate case-insensitive globbing for ASCII characters
wild="[${(j(][))${(s())head:l}}]*" # :gs/a/[a]/ etc.
# The following could all be one expansion, but for readability:
wild=$wild:gs/a/aA/:gs/b/bB/:gs/c/cC/:gs/d/dD/:gs/e/eE/:gs/f/fF/
wild=$wild:gs/g/gG/:gs/h/hH/:gs/i/iI/:gs/j/jJ/:gs/k/kK/:gs/l/lL/
wild=$wild:gs/m/mM/:gs/n/nN/:gs/o/oO/:gs/p/pP/:gs/q/qQ/:gs/r/rR/
wild=$wild:gs/s/sS/:gs/t/tT/:gs/u/uU/:gs/v/vV/:gs/w/wW/:gs/x/xX/
wild=$wild:gs/y/yY/:gs/z/zZ/:gs/-/_/:gs/_/-_/:gs/[]//
# Expand on both sides of '.' (except when leading) as for '/'
wild="${${wild:gs/[.]/*.*/}#\*}"
fi
reply=(${sofar}"${wild}${globdir}")
reply=(${~reply})
fi
[[ -z $reply[1] ]] && reply=() && break
[[ -n $pref ]] && sofar=($reply)
done
# Restore ~'s in front if there were any.
# There had better not be anything funny in $newtop.
[[ -n "$origtop" ]] && reply=("$origtop"${reply#$newtop})
# }

8
Functions/proto Executable file
View File

@ -0,0 +1,8 @@
#! /bin/sh
# generate prototypes, if your style is the same as mine
for i
do
rm $i:r.pro 2>/dev/null
grep -v '[{};:#]' $i | grep '^[A-Za-z]' |
grep -v static | sed 's/$/;/' >! $i:r.pro
done

13
Functions/pushd Normal file
View File

@ -0,0 +1,13 @@
# pushd function to emulate the old zsh behaviour. With this function
# pushd +/-n just lifts the selected element to the top of the stack
# instead of just cycling the stack.
emulate -R zsh
setopt localoptions
if [[ ARGC -eq 1 && "$1" == [+-]<-> ]] then
setopt pushdignoredups
builtin pushd ~$1
else
builtin pushd "$@"
fi

3
Functions/randline Executable file
View File

@ -0,0 +1,3 @@
# get a random line from a file
integer z=$(wc -l <$1)
sed -n $[RANDOM%z+1]p $1

72
Functions/run-help Executable file
View File

@ -0,0 +1,72 @@
#!/usr/local/bin/zsh
#
# Figure out where to get the best help, and get it.
#
# Install this function by placing it in your FPATH and then
# adding to your .zshrc the lines:
# unalias run-help
# autoload run-help
#
emulate -R zsh
setopt localoptions
# Check whether Util/helpfiles has been used to generate zsh help
if [[ $1 == "-l" ]]
then
if [[ -n "${HELPDIR:-}" ]]
then
echo 'Here is a list of topics for which help is available:'
echo ""
print -rc $HELPDIR/*(:t)
else
echo 'There is no list of help topics available at this time'
fi
return 0
elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]]
then
${=PAGER:-more} $HELPDIR/$1
return $?
fi
# No zsh help, use "whence" to figure out where else we might look
local what places newline='
'
integer i=0 didman=0
places=( "${(@f)$(builtin whence -va $1)}" )
while ((i++ < $#places))
do
what=$places[$i]
builtin print -r $what
case $what in
(*( is an alias)*)
[[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t}
;;
(*( is a * function))
builtin functions ${what[(w)1]} | ${=PAGER:-more}
;;
(*( is a * builtin))
case ${what[(w)1]} in
(compctl) man zshcompctl;;
(bindkey) man zshzle;;
(*setopt) man zshoptions;;
(*) man zshbuiltins;;
esac
;;
(*( is hashed to *))
man ${what[(w)-1]:t}
;;
(*)
((! didman++)) && man $1
;;
esac
if ((i < $#places && ! didman))
then
builtin print -nP "%SPress any key for more help or q to quit%s"
builtin read -k what
[[ $what != $newline ]] && echo
[[ $what == [qQ] ]] && break
fi
done

2
Functions/yp Executable file
View File

@ -0,0 +1,2 @@
#! /bin/sh
ypmatch $1 passwd

2
Functions/yu Executable file
View File

@ -0,0 +1,2 @@
#! /bin/sh
ypmatch $1 passwd.byuid

65
Functions/zed Executable file
View File

@ -0,0 +1,65 @@
#
# zed
#
# No other shell could do this.
# Edit small files with the command line editor.
# Use ^X^W to save, ^C to abort.
# Option -f: edit shell functions. (Also if called as fned.)
#
# Completion: use
# compctl -f -x 'w[1,-f]' -F -- zed
#
local var fun cleanup
# We do not want timeout while we are editing a file
integer TMOUT=0
[[ $1 = -f || $0 = fned ]] && fun=1
[[ $1 = -(|-|f) ]] && shift
[[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1
# catch interrupts
cleanup="$(bindkey -L "^M"; bindkey -L -M emacs "^X^W"; bindkey -aL "ZZ"
echo "trap - INT EXIT"; trap)"
trap "return 130" INT
trap "$cleanup" EXIT
# don't mangle !'s
setopt localoptions nobanghist
bindkey "^M" self-insert-unmeta
# Depending on your stty's, you may be able to use ^J as accept-line, else:
bindkey -M emacs "^X^W" accept-line
bindkey -a "ZZ" accept-line
if ((fun)) then
var="$(functions $1)"
# If function is undefined but autoloadable, load it
if [[ $var = undefined* ]] then
local dir
for dir in $fpath; do
if [[ -f $dir/$1 ]] then
var="$1() {
$(<$dir/$1)
}"
break
fi
done
elif [[ -z $var ]] then
var="$1() {
}"
fi
vared var && eval function "$var"
else
[[ -f $1 ]] && var="$(<$1)"
while vared var
do
(print -r -- "$var" >| $1) && break
echo -n -e '\a'
done
fi
return 0
# End of zed

55
Functions/zls Normal file
View File

@ -0,0 +1,55 @@
# zls () {
# simple internal ls using the stat module
zmodload -i stat || return 1
emulate -R zsh
setopt localoptions
local f stat opts='' L=L mod=: dirs list
dirs=()
list=()
while getopts ailLFd f
do
opts=$opts$f
if [[ $f == '?' ]] then
echo Usage: $0 [ -ailLFd ] [ filename ... ]
return 1
fi
done
shift OPTIND-1
[[ $opts == *L* ]] && L=''
[[ $opts == *F* ]] && mod=T$mod
[[ $opts == *a* ]] && setopt globdots
if ((! ARGC)) then
set *
opts=d$opts
fi
for f in $*
do
stat -s$L -A stat -F "%b %e %H:%M" - $f || continue
if [[ $opts != *d* && $stat[3] == d* ]] then
dirs=( $dirs $f )
elif [[ $opts == *l* ]] then
[[ $opts == *i* ]] && print -n "${(l:7:)stat[2]} "
[[ -n $stat[14] ]] && f=( $f '->' $stat[14] ) || f=( $f($mod) )
print -r -- "$stat[3] ${(l:3:)stat[4]} ${(r:8:)stat[5]} " \
"${(r:8:)stat[6]} ${(l:8:)stat[8]} $stat[10] $f"
else
f=( $f($mod) )
list=( "$list[@]" "${${(M)opts:%*i*}:+${(l:7:)stat[2]} }$f" )
fi
done
(($#list)) && print -cr -- "$list[@]"
while (($#dirs)) do
((ARGC > $#dirs)) && echo
((ARGC > 1)) && echo $dirs[1]:
(cd $dirs[1] && $0 -d$opts)
shift dirs
done
# }

242
INSTALL Normal file
View File

@ -0,0 +1,242 @@
--------------
INSTALLING ZSH
--------------
Check MACHINES File
-------------------
Check the file MACHINES in the subdirectory Etc to see the architectures
that zsh is known to compile on, as well as any special instructions
for your particular architecture. Most architectures will not require any
special instructions.
Configuring Zsh
---------------
To configure zsh, from the top level directory, do the command:
./configure
Configure accepts several options (explained below). To display
currently available options, do the command:
./configure --help
Most of the interesting configuration options can be added after running
configure by editing the user configuration section of config.h and the
top level Makefile.
Dynamic loading
---------------
Zsh-3.1 has support for dynamically loadable modules. To enable this run
configure with the --enable-dynamic option. Note that dynamic loading
does not work on all systems. On these systems this option will have no
effect, so it is always safe to use --enable-dynamic. When dynamic
loading is enabled, major parts of zsh (including the Zsh Line Editor) are
compiled into modules and not included into the main zsh binary. Zsh
autoloads these modules when they are required. This means that you have
to execute make install.modules before you try the newly compiled zsh
executable.
Adding more modules
-------------------
The zsh distribution contains several modules, in the Src/Builtins,
Src/Modules and Src/Zle directories. If you have any additional zsh
modules that you wish to compile for this version of zsh, create another
subdirectory of the Src directory and put them there. You can create
as many extra subdirectory hierarchies as you need. The subdirectories
must be actual directories; symbolic links will not work.
If you wish to add or remove modules or module directories after you
have already run make, then after adding or removing the modules run:
make prep
Controlling what is compiled into the main zsh binary
-----------------------------------------------------
By default the comp1, compctl, zle, sched and rlimits modules are compiled
into non-dynamic zsh and no modules are compiled into the main binary if
dynamic loading is available. This can be overridden by creating the
Src/modules-bltin file with the list of modules which are to be compiled
into the main binary. See the zshmodules manual page for the list of
available modules.
Compiler Options or Using a Different Compiler
----------------------------------------------
By default, configure will use the "gcc" compiler if found. You can use a
different compiler, or add unusual options for compiling or linking that
the "configure" script does not know about, by either editing the user
configuration section of the top level Makefile (after running configure)
or giving "configure" initial values for these variables by setting them
in the environment. Using a Bourne-compatible shell (such as sh,ksh,zsh),
you can do that on the command line like this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the "env" program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Check Generated Files
---------------------
Configure will probe your system and create a "config.h" header file.
You should check the user configuration section at the beginning of
this include file. You should also examine the values (determined by
configure) of HOSTTYPE, OSTYPE, MACHTYPE, and VENDOR to make sure they
are correct. The value of these #defines's is used only to initialize
the corresponding default shell parameters. Since these shell parameters
are only for informational purposes, you can change them to whatever
you feel is appropriate.
Also configure will create a Makefile in the top level directory as well
as in the various subdirectories. You should check the user configuration
section of the top level Makefile.
Compiling Zsh
-------------
After configuring, to build zsh, do the command:
make
Installing Zsh
--------------
If no make/compilation errors occur, then to install the zsh binary, do
the command:
make install.bin
Any previous copy of zsh will be renamed "zsh.old"
To install the dynamically-loadable modules, do the command:
make install.modules
To install the zsh man page, do the command:
make install.man
To install the zsh info files, do the command:
make install.info
Or alternatively, you can install all the above with the command:
make install
"make install.info" will only move the info files into the info directory.
You will have to edit the topmost node of the info tree "dir" manually
in order to have the zsh info files available to your info reader.
Building Zsh On Additional Architectures
----------------------------------------
To build zsh on additional architectures, you can do a "make distclean".
This should restore the zsh source distribution back to its original
state. You can then configure zsh as above on other architectures in
which you wish to build zsh. Or alternatively, you can use a different
build directory for each architecture.
Using A Different Build Directory
---------------------------------
You can compile the zsh in a different directory from the one containing
the source code. Doing so allows you to compile it on more than one
architecture at the same time. To do this, you must use a version of
"make" that supports the "VPATH" variable, such as GNU "make". "cd" to
the directory where you want the object files and executables to go and
run the "configure" script. "configure" automatically checks for the
source code in the directory that "configure" is in. For example,
cd /usr/local/SunOS/zsh
/usr/local/src/zsh-3.0/configure
make
Memory Routines
---------------
Included in this release are alternate malloc and associated functions
which reduce memory usage on some systems. To use these, add the option
--enable-zsh-mem
when invoking "configure".
You should check Etc/MACHINES to see if there are specific recommendations
about using the zsh malloc routines on your particular architecture.
Debugging Routines
------------------
You can turn on various debugging options when invoking "configure".
To turn on some extra checking in the memory management routines, you
can use the following options when invoking "configure".
--enable-zsh-mem-warning # turn on warnings of memory allocation errors
--enable-zsh-secure-free # turn on memory checking of free()
If you are using zsh's memory allocation routines (--enable-zsh-mem), you
can turn on debugging of this code. This enables the builtin "mem".
--enable-zsh-mem-debug # debug zsh's memory allocators
You can turn on some debugging information of zsh's internal hash tables.
This enables the builtin "hashinfo".
--enable-zsh-hash-debug # turn on debugging of internal hash tables
To add some sanity checks and generate debugging information for debuggers
you can use the following option. This also disables optimization.
--enable-zsh-debug # use it if you want to debug zsh
Startup/shutdown files
----------------------
Zsh has several startup/shutdown files which are in /etc by default. This
can be overriden using one of the options below when invoking "configure".
--enable-etcdir=directory # default directory for global zsh scripts
--enable-zshenv=pathname # the full pathname of the global zshenv script
--enable-zshrc=pathname # the full pathname of the global zshrc script
--enable-zlogin=pathname # the full pathname of the global zlogin script
--enable-zprofile=pathname # the full pathname of the global zprofile script
--enable-zlogout=pathname # the full pathname of the global zlogout script
Any startup/shutdown script can be disabled by giving the
--disable-scriptname option to "configure". The --disable-etcdir option
disables all startup/shutdown files which are not explicitely enabled.
Options For Configure
---------------------
The `configure' program accepts many options, not all of which are useful
or relevant to zsh. To get the complete list of configure options, run
"./configure --help". The following list should contain most of the
options of interest for configuring zsh.
Configuration:
--cache-file=FILE # cache test results in FILE
--help # print a help message
--version # print the version of autoconf that create configure
--quiet, --silent # do not print `checking...' messages
--no-create # do not create output files
Directories:
--prefix=PREFIX # install host independent files in PREFIX [/usr/local]
--exec-prefix=EPREFIX # install host dependent files in EPREFIX [same as prefix]
--bindir=DIR # install user executables in DIR [EPREFIX/bin]
--infodir=DIR # install info documentation in DIR [PREFIX/info]
--mandir=DIR # install man documentation in DIR [PREFIX/man]
--srcdir=DIR # find the sources in DIR [configure dir or ..]
Features:
--enable-FEATURE # enable use of this feature
--disable-FEATURE # disable use of this feature
The FEATURES currently supported are:
zsh-debug # use it if you want to debug zsh
zsh-mem # use zsh's memory allocators
zsh-mem-debug # debug zsh's memory allocators
zsh-mem-warning # turn on warnings of memory allocation errors
zsh-secure-free # turn on memory checking of free()
zsh-hash-debug # turn on debugging of internal hash tables
etcdir=directory # default directory for global zsh scripts
zshenv=pathname # the full pathname of the global zshenv script
zshrc=pathname # the full pathname of the global zshrc script
zlogin=pathname # the full pathname of the global zlogin script
zprofile=pathname # the full pathname of the global zprofile script
zlogout=pathname # the full pathname of the global zlogout script
dynamic # allow dynamically loaded binary modules

124
Makefile.in Normal file
View File

@ -0,0 +1,124 @@
#
# Makefile for top level of zsh distribution
#
# Copyright (c) 1995-1997 Richard Coleman
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Richard Coleman or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Richard Coleman and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Richard Coleman and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Richard Coleman and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
subdir = .
dir_top = .
SUBDIRS = Doc Etc Src
@@version.mk@@
@@defs.mk@@
# ========== DEPENDENCIES FOR BUILDING ==========
# default target
all: config.h
@for subdir in Src Doc; do \
(cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
done
check test:
@echo zsh test suite not available yet
# prepare module configuration
prep:
@cd Src && $(MAKE) $(MAKEDEFS) $@
META-FAQ: FORCE
@cd Doc && $(MAKE) $(MAKEDEFS) ../META-FAQ
# ========== DEPENDENCIES FOR INSTALLING ==========
# install/uninstall everything
install: install.bin install.modules install.man install.info
uninstall: uninstall.bin uninstall.modules uninstall.man uninstall.info
# install/uninstall just the binary
install.bin uninstall.bin:
@cd Src && $(MAKE) $(MAKEDEFS) $@
# install/uninstall just the modules
install.modules uninstall.modules:
@cd Src && $(MAKE) $(MAKEDEFS) $@
# install/uninstall just the man pages
install.man uninstall.man:
@cd Doc && $(MAKE) $(MAKEDEFS) $@
# install/uninstall just the info pages
install.info uninstall.info:
@cd Doc && $(MAKE) $(MAKEDEFS) $@
# ========== DEPENDENCIES FOR CLEANUP ==========
@@clean.mk@@
distclean-here:
rm -f Makefile config.h config.status config.log config.cache stamp-h
realclean-here:
cd $(sdir) && rm -f config.h.in stamp-h.in configure
# ========== DEPENDENCIES FOR MAINTENANCE ==========
@@config.mk@@
config: config.h
config.status: configure
./config.status --recheck
configure: configure.in aclocal.m4 aczsh.m4
cd $(sdir) && autoconf
config.h: stamp-h
stamp-h: config.h.in config.status
cd $(dir_top) && \
CONFIG_FILES= CONFIG_HEADERS=$(subdir)/config.h ./config.status
config.h.in: stamp-h.in
stamp-h.in: configure.in acconfig.h aclocal.m4 aczsh.m4
cd $(sdir) && autoheader
echo > $@
# ========== DEPENDENCIES FOR DISTRIBUTION ==========
DISTNAME = zsh-$(VERSION)
targz-src: $(DISTNAME).tar.gz
$(DISTNAME).tar.gz: FORCE
@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \
$(MAKE) $(MAKEDEFS)
tar cf - $(DISTNAME) | gzip -9 > $@
rm -rf $(DISTNAME)
targz-doc: $(DISTNAME)-doc.tar.gz
$(DISTNAME)-doc.tar.gz: FORCE
@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) DOC \
$(MAKE) $(MAKEDEFS)
tar cf - $(DISTNAME) | gzip -9 > $@
rm -rf $(DISTNAME)
FORCE:

4
Misc/.distfiles Normal file
View File

@ -0,0 +1,4 @@
DISTFILES_SRC='
.distfiles
c2z compctl-examples globtests globtests.ksh lete2ctl
'

2
Misc/.lastloc Normal file
View File

@ -0,0 +1,2 @@
(("/home/user2/pws/src/zsh-3.1.5/Misc/globtests.ksh" . 2763)
("/home/user2/pws/src/zsh-3.1.5/Misc/globtests" . 3123))

128
Misc/c2z Executable file
View File

@ -0,0 +1,128 @@
#! /bin/sh
#
# c2z - environment conversion tool
# Contributed by Bart Schaefer
# (Tweaked a bit by Paul Falstad)
#
# This is a quick script to convert csh aliases to zsh aliases/functions.
# It also converts the csh environment and local variables to zsh. c2z
# uses the csh to parse its own dot-files, then processes csh output to
# convert the csh settings to zsh.
#
# When run as a zsh fuction, c2z runs csh as if it were an interactive
# shell whenever the parent zsh is interactive. When run as a shell
# script, the -i switch can be used to force this behavior.
#
# The -l (login) switch causes csh to run as if it were a login shell.
# This is done "properly" if c2z is used as a zsh function, otherwise
# it's faked by explicitly sourcing .login. Use with caution if your
# .login initializes an X server or does other one-time-only startup
# procedures.
#
# usage:
# c2z [-i | -l | filename]
#
# You can use this script in your .zshrc or .zlogin files to load your
# regular csh environment into zsh; for example, in .zlogin:
#
# . =(c2z -l)
#
# This is not perfect, but it gets most common aliases and variables.
# It's also rather time-consuming to do this every time you log in.
# However, if you're moving from csh to zsh for the first time, this
# can get you started with a familiar environment right away.
#
# In case your mailer eats tabs, $T is set to expand to a tab.
#
T="`echo x | tr x '\011'`"
# If we're zsh, we can run "- csh" to get the complete environment.
#
MINUS=""
LOADFILE=""
INTERACT=""
CSH=csh
case "$ZSH_NAME$ZSH_VERSION$VERSION" in
zsh*)
case $1 in
-l*) MINUS="-" ;;
-i*) INTERACT="-i" ;;
*) LOADFILE="source $1" CSH="csh -f";;
esac
if [[ -o INTERACTIVE ]]; then INTERACT="-i"; fi
setopt nobanghist
;;
*)
case $1 in
-l*) LOADFILE="source ~/.login" ;;
-i*) INTERACT="-i" ;;
*) LOADFILE="source $1" CSH="csh -f";;
esac
;;
esac
( eval $MINUS $CSH $INTERACT ) <<EOF 2>&1 >/dev/null
$LOADFILE
alias >! /tmp/cz$$.a
setenv >! /tmp/cz$$.e
set >! /tmp/cz$$.v
EOF
# save stdin
exec 9<&0
# First convert aliases
exec < /tmp/cz$$.a
# Taken straight from ctoz except for $T and "alias --"
sed -e 's/'"$T"'(\(.*\))/'"$T"'\1/' >/tmp/cz$$.1
grep ! /tmp/cz$$.1 >/tmp/cz$$.2
grep -v ! /tmp/cz$$.1 >/tmp/cz$$.3
sed -e "s/'/'"\\\\"''"/g \
-e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/alias -- \1='"'\2'/" \
/tmp/cz$$.3
sed -e 's/![:#]*/$/g' \
-e 's/\$cwd/$PWD/' \
-e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/\1 () { \2 }/' \
/tmp/cz$$.2
# Next, convert environment variables
exec < /tmp/cz$$.e
# Would be nice to deal with embedded newlines, e.g. in TERMCAP, but ...
sed -e '/^SHLVL/d' \
-e '/^PWD/d' \
-e "s/'/'"\\\\"''"/g \
-e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \
-e "s/$/'/"
# Finally, convert local variables
exec < /tmp/cz$$.v
sed -e 's/'"$T"'/=/' \
-e "s/'/'"\\\\"''"/g \
-e '/^[A-Za-z0-9_]*=[^(]/{
s/=/='"'/"'
s/$/'"'/"'
}' |
sed -e '/^argv=/d' -e '/^cwd=/d' -e '/^filec=/d' -e '/^status=/d' \
-e '/^autolist=/s/.*/setopt autolist/' \
-e '/^correct=all/s//setopt correctall/' \
-e '/^correct=/s//setopt correct/' \
-e '/^histchars=/s//HISTCHARS=/' \
-e '/^history=/s//HISTSIZE=/' \
-e '/^home=/s//HOME=/' \
-e '/^ignoreeof=/s/.*/setopt ignoreeof/' \
-e '/^noclobber=/s/.*/setopt noclobber/' \
-e '/^notify=/d' \
-e '/^prompt=/s/!/%h/' \
-e 's/^prompt/PROMPT/' \
-e '/^showdots=/s/.*/setopt globdots/' \
-e '/^savehist=/s//HISTFILE=\~\/.zhistory SAVEHIST=/' \
-e '/^who=/s//WATCHFMT=/'
exec 0<&9
rm /tmp/cz$$.?
exit

716
Misc/compctl-examples Normal file
View File

@ -0,0 +1,716 @@
#
# This file gives examples of possible programmable completions (compctl).
# You can either put the compctl commands in your .zshrc file, or put them
# in a separate file (say .zcompctl) and source it from your .zshrc file.
#
# These are just examples. Use and modify to personal taste. Copying
# this file without thought will needlessly increase zsh's memory usage
# and startup time.
#
# For a detailed description of how these work, check the zshcompctl man
# page.
#
#------------------------------------------------------------------------------
hosts=("${${(s: :)${(s: :)${${(f)$(</etc/hosts)}%%\#*}#*[ ]*}}:#}")
ports=( "${${${(f)$(</etc/services)}:#\#*}%%[ ]*}" )
# groups=( $(cut -d: -f1 /etc/group) )
# groups=( $(ypcat group.byname | cut -d: -f1) ) # if you use NIS
# It can be done without forking, but it used too much memory in old zsh's:
groups=( "${${(f)$(</etc/group)}%%:*}" )
#groups=( "${${(f)$(ypcat groups)}%%:*}" ) # if you use NIS
# Completion for zsh builtins.
compctl -z -P '%' bg
compctl -j -P '%' fg jobs disown
compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' wait
compctl -A shift
compctl -c type whence where which
compctl -m -x 'W[1,-*d*]' -n - 'W[1,-*a*]' -a - 'W[1,-*f*]' -F -- unhash
compctl -m -q -S '=' -x 'W[1,-*d*] n[1,=]' -/ - \
'W[1,-*d*]' -n -q -S '=' - 'n[1,=]' -/g '*(*)' -- hash
compctl -F functions unfunction
compctl -k '(al dc dl do le up al bl cd ce cl cr
dc dl do ho is le ma nd nl se so up)' echotc
compctl -a unalias
compctl -v getln getopts read unset vared
compctl -v -S '=' -q declare export integer local readonly typeset
compctl -eB -x 'p[1] s[-]' -k '(a f m r)' - \
'C[1,-*a*]' -ea - 'C[1,-*f*]' -eF - 'C[-1,-*r*]' -ew -- disable
compctl -dB -x 'p[1] s[-]' -k '(a f m r)' - \
'C[1,-*a*]' -da - 'C[1,-*f*]' -dF - 'C[-1,-*r*]' -dw -- enable
compctl -k "(${(j: :)${(f)$(limit)}%% *})" limit unlimit
compctl -l '' -x 'p[1]' -f -- . source
# Redirection below makes zsh silent when completing unsetopt xtrace
compctl -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' + -o + -x 's[no]' -o -- unsetopt
compctl -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' + -o + -x 's[no]' -o -- setopt
compctl -s '${^fpath}/*(N:t)' autoload
compctl -b -x 'W[1,-*[DAN]*],C[-1,-*M]' -s '$(bindkey -l)' -- bindkey
compctl -c -x 'C[-1,-*k]' -A - 'C[-1,-*K]' -F -- compctl
compctl -x 'C[-1,-*e]' -c - 'C[-1,-[ARWI]##]' -f -- fc
compctl -x 'p[1]' - 'p[2,-1]' -l '' -- sched
compctl -x 'C[-1,[+-]o]' -o - 'c[-1,-A]' -A -- set
compctl -b -x 'w[1,-N] p[3]' -F -- zle
compctl -s '${^module_path}/*(N:t:r)' -x \
'W[1,-*(a*u|u*a)*],W[1,-*a*]p[3,-1]' -B - \
'W[1,-*u*]' -s '$(zmodload)' -- zmodload
# Anything after nohup is a command by itself with its own completion
compctl -l '' nohup noglob exec nice eval - time rusage
compctl -l '' -x 'p[1]' -eB -- builtin
compctl -l '' -x 'p[1]' -em -- command
compctl -x 'p[1]' -c - 'p[2,-1]' -k signals -- trap
#------------------------------------------------------------------------------
# kill takes signal names as the first argument after -, but job names after %
# or PIDs as a last resort
compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' + \
-x 's[-] p[1]' -k "($signals[1,-3])" -- kill
#------------------------------------------------------------------------------
compctl -s '$(groups)' + -k groups newgrp
compctl -f -x 'p[1], p[2] C[-1,-*]' -k groups -- chgrp
compctl -f -x 'p[1] n[-1,.], p[2] C[-1,-*] n[-1,.]' -k groups - \
'p[1], p[2] C[-1,-*]' -u -S '.' -q -- chown
compctl -/g '*.x' rpcgen
compctl -u -x 's[+] c[-1,-f],s[-f+]' -W ~/Mail -f - \
's[-f],c[-1,-f]' -f -- mail elm
compctl -x 'c[-1,-f]' -W ~/Mail -f -- pine
#------------------------------------------------------------------------------
compctl -s "\$(awk '/^[a-zA-Z0-9][^ ]+:/ {print \$1}' FS=: [mM]akefile)" -x \
'c[-1,-f]' -f -- make gmake pmake
#------------------------------------------------------------------------------
# tar
tarnames () {
# Completion function for use with tar:
# get the names of files in the tar archive to extract.
#
# The main claim to fame of this particular function is that it
# completes directories in the tar-file in a manner very roughly
# consistent with `compctl -f'. There are two bugs: first, the whole
# path prefix up to the present is listed with ^D, not just the new
# part to add; second, after a unique completion a space is always
# inserted, even if the completion ends with a slash. These are
# currently limitations of zsh.
#
# This only works for the (fairly common) tar argument style where
# the arguments are bunched into the first argument, and the second
# argument is the name of the tarfile. For example,
# tar xvzf zsh-3.1.2.tar.gz ...
# You can only use compressed/gzipped files if tar is GNU tar,
# although the correct name for the tar programme will be inferred.
local line list=tf
read -cA line
# $line[2] is the first argument: check for possible compression args.
# (This is harmless when used with non-GNU tar, but then the file must
# be uncompressed to be able to use it with tar anyway.)
[[ $line[2] = *[Zz]* ]] && list=tfz
# $line[1] is the command name: something like tar or gnutar.
# $line[3] is the name of the tar archive.
# cache contents for multiple completion: note tar_cache_name
# and tar_cache_list are not local. Assumes all files with the
# same name are the same file, even if in different directories:
# you can trick it with $PWD/file on the command line.
if [[ $line[3] != $tar_cache_name ]]; then
tar_cache_list=($($line[1] $list $line[3]))
tar_cache_name=$line[3]
fi
# Now prune the list to include only appropriate directories.
local file new
reply=()
if [[ $1 = */* ]]; then
local sofar=${1%/*}/
for file in $tar_cache_list; do
if [[ $file = $sofar* ]]; then
new=${file#$sofar}
if [[ $new = */* ]]; then
new=$sofar${new%%/*}/
else
new=$file
fi
if [[ $1 != */ || $new != $1 ]]; then
reply=($reply $new)
fi
fi
done
else
for file in $tar_cache_list; do
if [[ $file = */* ]]; then
new=${file%%/*}/
else
new=$file
fi
reply=($reply $new)
done
fi
}
compctl -f \
-x 'p[2] C[-1,*(z*f|f*z)*]' -/g '*.(taz|tar.(gz|z|Z)|tgz)' \
- 'p[2] C[-1,*(Z*f|f*Z)*]' -/g '*.(tar.Z|taz)' \
- 'p[2] C[-1,*f*]' -/g '*.tar' \
- 'p[1] N[-1,ctxvzZ]' -k "(v z f)" \
- 'p[1] s[]' -k "(c t x)" -S '' \
- 'p[3,-1] W[1,*x*]' -K tarnames \
-- tar gtar gnutar
#------------------------------------------------------------------------------
# rmdir only real directories
compctl -/g '*(/)' rmdir dircmp
#------------------------------------------------------------------------------
# cd/pushd only directories or symbolic links to directories
compctl -/ cd chdir dirs pushd
# Another possibility for cd/pushd is to use it in conjunction with the
# cdmatch function (in the Functions subdirectory of zsh distribution).
compctl -K cdmatch -S '/' -q -x 'p[2]' -Q -K cdmatch2 - \
'S[/][~][./][../]' -g '*(-/)' + -g '*(-/D)' - \
'n[-1,/]' -K cdmatch -S '/' -q -- cd chdir pushd
#------------------------------------------------------------------------------
# If the command is rsh, make the first argument complete to hosts and treat the
# rest of the line as a command on its own.
compctl -k hosts -x 'p[2,-1]' -l '' -- rsh
# rlogin takes hosts and users after `-l'
compctl -k hosts -x 'c[-1,-l]' -u -- rlogin
# rcp: match users, hosts and files initially. Match files after a :, or hosts
# after an @. If one argument contains a : then the other matches files only.
# Not quite perfect; compctl just isn't up to it yet.
compctl -u -k hosts -f -x 'n[1,:]' -f - 'n[1,@]' -k hosts -S ':' - \
'p[1] W[2,*:*]' -f - 'p[1] W[2,*?*]' -u -k hosts -S ':' - \
'p[2] W[1,*:*]' -f - 'p[2] W[1,*?*]' -u -k hosts -S ':' -- rcp
compctl -k hosts host rup rusers ping
#------------------------------------------------------------------------------
# strip, profile, and debug only executables. The compctls for the
# debuggers could be better, of course.
compctl -/g '*(*)' strip gprof adb dbx xdbx ups
compctl -/g '*.[ao]' -/g '*(*)' nm
#------------------------------------------------------------------------------
# shells: compctl needs some more enhancement to do -c properly.
compctl -f -x 'C[-1,-*c]' -c - 'C[-1,[-+]*o]' -o -- bash ksh sh zsh
#------------------------------------------------------------------------------
# su takes a username and args for the shell.
compctl -u -x 'w[1,-]p[3,-1]' -l sh - 'w[1,-]' -u - 'p[2,-1]' -l sh -- su
#------------------------------------------------------------------------------
# Run ghostscript on postscript files, but if no postscript file matches what
# we already typed, complete directories as the postscript file may not be in
# the current directory.
compctl -/g '*.(e|E|)(ps|PS)' \
gs ghostview nup psps pstops psmulti psnup psselect
#------------------------------------------------------------------------------
# Similar things for tex, texinfo and dvi files.
compctl -/g '*.tex*' {,la,gla,ams{la,},{g,}sli}tex texi2dvi
compctl -/g '*.dvi' xdvi dvips
#------------------------------------------------------------------------------
# For rcs users, co and rlog from the RCS directory. We don't want to see
# the RCS and ,v though.
compctl -g 'RCS/*(:s@RCS/@@:s/,v//)' co rlog rcs rcsdiff
#------------------------------------------------------------------------------
# gzip uncompressed files, but gzip -d only gzipped or compressed files
compctl -x 'R[-*[dt],^*]' -/g '*.(gz|z|Z|t[agp]z|tarZ|tz)' + -f - \
's[]' -/g '^*(.(tz|gz|t[agp]z|tarZ|zip|ZIP|jpg|JPG|gif|GIF|[zZ])|[~#])' \
+ -f -- gzip
compctl -/g '*.(gz|z|Z|t[agp]z|tarZ|tz)' gunzip gzcat zcat
compctl -/g '*.Z' uncompress zmore
compctl -/g '*.F' melt fcat
#------------------------------------------------------------------------------
# ftp takes hostnames
ftphosts=(prep.ai.mit.edu wuarchive.wustl.edu ftp.uu.net ftp.math.gatech.edu)
compctl -k ftphosts ftp
# Some systems have directories containing indices of ftp servers.
# For example: we have the directory /home/ftp/index/INDEX containing
# files of the form `<name>-INDEX.Z', this leads to:
#compctl -g '/home/ftp/index/INDEX/*-INDEX.Z(:t:r:s/-INDEX//)' ftp tftp
#------------------------------------------------------------------------------
# Change default completion (see the multicomp function in the Function
# subdirectory of the zsh distribution).
#compctl -D -f + -U -K multicomp
# If completion of usernames is slow for you, you may want to add something
# like
# -x 'C[0,*/*]' -f - 's[~]' -S/ -k users + -u
# where `users' contains the names of the users you want to complete often.
# If you want to use this and to be able to complete named directories after
# the `~' you should add `+ -n' at the end
#------------------------------------------------------------------------------
# This is to complete all directories under /home, even those that are not
# yet mounted (if you use the automounter).
# This is for NIS+ (e.g. Solaris 2.x)
#compctl -Tx 's[/home/] C[0,^/home/*/*]' -S '/' -s '$(niscat auto_home.org_dir | \
# awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
# And this is for YP (e.g. SunOS4.x)
#compctl -Tx 's[/home/] C[0,^/home/*/*]' -S '/' -s '$(ypcat auto.home | \
# awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
#------------------------------------------------------------------------------
# Find is very system dependent, this one is for GNU find.
# Note that 'r[-exec,;]' must come first
if [[ -r /proc/filesystems ]]; then
# Linux
filesystems='"${${(f)$(</proc/filesystems)}#* }"'
else
filesystems='ufs 4.2 4.3 nfs tmp mfs S51K S52K'
fi
compctl -x 'r[-exec,;][-ok,;]' -l '' - \
's[-]' -s 'daystart {max,min,}depth follow noleaf version xdev
{a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links
{i,}{l,}name {no,}{user,group} path perm regex size true uid used
exec {f,}print{f,0,} ok prune ls' - \
'p[1]' -g '. .. *(-/)' - \
'C[-1,-((a|c|)newer|fprint(|0|f))]' -f - \
'c[-1,-fstype]' -s $filesystems - \
'c[-1,-group]' -k groups - \
'c[-1,-user]' -u -- find
#------------------------------------------------------------------------------
# Generic completion for C compiler.
compctl -/g "*.[cCoa]" -x 's[-I]' -/ - \
's[-l]' -s '${(s.:.)^LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' -- cc
#------------------------------------------------------------------------------
# GCC completion, by Andrew Main
# completes to filenames (*.c, *.C, *.o, etc.); to miscellaneous options after
# a -; to various -f options after -f (and similarly -W, -g and -m); and to a
# couple of other things at different points.
# The -l completion is nicked from the cc compctl above.
# The -m completion should be tailored to each system; the one below is i386.
compctl -/g '*.([cCmisSoak]|cc|cxx|ii|k[ih])' -x \
's[-l]' -s '${(s.:.)^LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' - \
'c[-1,-x]' -k '(none c objective-c c-header c++ cpp-output
assembler assembler-with-cpp)' - \
'c[-1,-o]' -f - \
'C[-1,-i(nclude|macros)]' -/g '*.h' - \
'C[-1,-i(dirafter|prefix)]' -/ - \
's[-B][-I][-L]' -/ - \
's[-fno-],s[-f]' -k '(all-virtual cond-mismatch dollars-in-identifiers
enum-int-equiv external-templates asm builtin strict-prototype
signed-bitfields signd-char this-is-variable unsigned-bitfields
unsigned-char writable-strings syntax-only pretend-float caller-saves
cse-follow-jumps cse-skip-blocks delayed-branch elide-constructors
expensive-optimizations fast-math float-store force-addr force-mem
inline-functions keep-inline-functions memoize-lookups default-inline
defer-pop function-cse inline peephole omit-frame-pointer
rerun-cse-after-loop schedule-insns schedule-insns2 strength-reduce
thread-jumps unroll-all-loops unroll-loops)' - \
's[-g]' -k '(coff xcoff xcoff+ dwarf dwarf+ stabs stabs+ gdb)' - \
's[-mno-][-mno][-m]' -k '(486 soft-float fp-ret-in-387)' - \
's[-Wno-][-W]' -k '(all aggregate-return cast-align cast-qual
char-subscript comment conversion enum-clash error format id-clash-6
implicit inline missing-prototypes missing-declarations nested-externs
import parentheses pointer-arith redundant-decls return-type shadow
strict-prototypes switch template-debugging traditional trigraphs
uninitialized unused write-strings)' - \
's[-]' -k '(pipe ansi traditional traditional-cpp trigraphs pedantic
pedantic-errors nostartfiles nostdlib static shared symbolic include
imacros idirafter iprefix iwithprefix nostdinc nostdinc++ undef)' \
-X 'Use "-f", "-g", "-m" or "-W" for more options' -- gcc g++
#------------------------------------------------------------------------------
# There are (at least) two ways to complete manual pages. This one is
# extremely memory expensive if you have lots of man pages
man_var() {
man_pages=( ${^manpath}/man*/*(N:t:r) )
compctl -k man_pages -x 'C[-1,-P]' -m - \
'R[-*l*,;]' -/g '*.(man|[0-9](|[a-z]))' -- man
reply=( $man_pages )
}
compctl -K man_var -x 'C[-1,-P]' -m - \
'R[-*l*,;]' -/g '*.(man|[0-9](|[a-z]))' -- man
# This one isn't that expensive but somewhat slower
man_glob () {
local a
read -cA a
if [[ $a[2] = -s ]] then # Or [[ $a[2] = [0-9]* ]] for BSD
reply=( ${^manpath}/man$a[3]/$1*$2(N:t:r) )
else
reply=( ${^manpath}/man*/$1*$2(N:t:r) )
fi
}
#compctl -K man_glob -x 'C[-1,-P]' -m - \
# 'R[-*l*,;]' -/g '*.(man|[0-9nlpo](|[a-z]))' -- man
#------------------------------------------------------------------------------
# xsetroot: gets possible colours, cursors and bitmaps from wherever.
# Uses two auxiliary functions. You might need to change the path names.
Xcolours() {
reply=( ${(L)$(awk '{ if (NF = 4) print $4 }' \
< /usr/openwin/lib/X11/rgb.txt)} )
}
Xcursor() {
reply=( $(sed -n 's/^#define[ ][ ]*XC_\([^ ]*\)[ ].*$/\1/p' \
< /usr/include/X11/cursorfont.h) )
}
compctl -k '(-help -def -display -cursor -cursor_name -bitmap -mod -fg -bg
-grey -rv -solid -name)' -x \
'c[-1,-display]' -s '$DISPLAY' -k hosts -S ':0' - \
'c[-1,-cursor]' -f - 'c[-2,-cursor]' -f - \
'c[-1,-bitmap]' -g '/usr/include/X11/bitmaps/*' - \
'c[-1,-cursor_name]' -K Xcursor - \
'C[-1,-(solid|fg|bg)]' -K Xcolours -- xsetroot
#------------------------------------------------------------------------------
# dd
compctl -k '(if of conv ibs obs bs cbs files skip file seek count)' \
-S '=' -x 's[if=], s[of=]' -f - 'C[0,conv=*,*] n[-1,,], s[conv=]' \
-k '(ascii ebcdic ibm block unblock lcase ucase swap noerror sync)' \
-q -S ',' - 'n[-1,=]' -X '<number>' -- dd
#------------------------------------------------------------------------------
# Various MH completions by Peter Stephenson
# You may need to edit where it says *Edit Me*.
# The following three functions are best autoloaded.
# mhcomp completes folders (including subfolders),
# mhfseq completes sequence names and message numbers,
# mhfile completes files in standard MH locations.
function mhcomp {
# Completion function for MH folders.
# Works with both + (rel. to top) and @ (rel. to current).
local nword args pref char mhpath
read -nc nword
read -cA args
pref=$args[$nword]
char=$pref[1]
pref=$pref[2,-1]
# The $(...) here accounts for most of the time spent in this function.
if [[ $char = + ]]; then
# mhpath=$(mhpath +)
# *Edit Me*: use a hard wired value here: it's faster.
mhpath=~/Mail
elif [[ $char = @ ]]; then
mhpath=$(mhpath)
fi
eval "reply=($mhpath/$pref*(N-/))"
# I'm frankly amazed that this next step works, but it does.
reply=(${reply#$mhpath/})
}
mhfseq() {
# Extract MH message names and numbers for completion. Use of the
# correct folder, if it is not the current one, requires that it
# should be the previous command line argument. If the previous
# argument is `-draftmessage', a hard wired draft folder name is used.
local folder foldpath words pos nums
read -cA words
read -cn pos
# Look for a folder name.
# First try the previous word.
if [[ $words[$pos-1] = [@+]* ]]; then
folder=$words[$pos-1]
# Next look and see if we're looking for a draftmessage
elif [[ $words[$pos-1] = -draftmessage ]]; then
# *Edit Me*: shortcut -- hard-wire draftfolder here
# Should really look for a +draftfolder argument.
folder=+drafts
fi
# Else use the current folder ($folder empty)
if [[ $folder = +* ]]; then
# *Edit Me*: use hard-wired path with + for speed.
foldpath=~/Mail/$folder[2,-1]
else
foldpath=$(mhpath $folder)
fi
# Extract all existing message numbers from the folder.
nums=($foldpath/<->(N:t))
# If that worked, look for marked sequences.
# *Edit Me*: if you never use non-standard sequences, comment out
# or delete the next three lines.
if (( $#nums )); then
nums=($nums $(mark $folder | awk -F: '{print $1}'))
fi
# *Edit Me*: `unseen' is the value of Unseen-Sequence, if it exists;
set -A reply next cur prev first last all unseen $nums
}
mhfile () {
# Find an MH file; for use with -form arguments and the like.
# Use with compctl -K mhfile.
local mhfpath file
# *Edit Me*: Array containing all the places MH will look for templates etc.
mhfpath=(~/Mail /usr/local/lib/MH)
# Emulate completeinword behaviour as appropriate
local wordstr
if [[ -o completeinword ]]; then
wordstr='$1*$2'
else
wordstr='$1$2*'
fi
if [[ $1$2 = */* ]]; then
# path given: don't search MH locations
eval "reply=($wordstr(.N))"
else
# no path: only search MH locations.
eval "reply=(\$mhfpath/$wordstr(.N:t))"
fi
}
# Note: you must type the initial + or @ of a folder name to get
# completion, even in places where only folder names are allowed.
# Abbreviations for options are not recognised. Hit tab to complete
# the option name first.
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \
's[-]' -k "(all fast nofast header noheader help list nolist \
pack nopack pop push recurse norecurse total nototal)" -- folder
compctl -K mhfseq -x 's[+][@],c[-1,-draftfolder] s[+][@]' \
-K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq - \
'C[-1,-(editor|whatnowproc)]' -c - \
's[-]' -k "(draftfolder draftmessage nodraftfolder editor noedit \
file form use nouse whatnowproc nowhatnowproc help)" - \
'c[-1,-form]' -K mhfile -- comp
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \
's[-]' -k "(audit noaudit changecur nochangecur form format \
file silent nosilent truncate notruncate width help)" - \
'C[-1,-(audit|form)]' -K mhfile - 'c[-1,-file]' -f + -- inc
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \
's[-]' -k "(sequence add delete list public nopublic zero nozero help)" -- \
mark
compctl -K mhfseq -x 's[+][@]' \
-K mhcomp -S / -q - 'c[-1,-file]' -f - 'c[-1,-rmmprov]' -c - \
's[-]' -k "(draft link nolink preserve nopreserve src file \
rmmproc normmproc help)" -- refile
compctl -K mhfseq -x 's[+][@]' \
-K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq -\
's[-]' -k "(annotate noannotate cc nocc draftfolder nodraftfolder \
draftmessage editor noedit fcc filter form inplace noinplace query \
noquery width whatnowproc nowhatnowproc help)" - 'c[-1,(cc|nocc)]' \
-k "(all to cc me)" - 'C[-1,-(filter|form)]' -K mhfile - \
'C[-1,-(editor|whatnowproc)]' -c -- repl
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \
's[-]' -k "(clear noclear form format header noheader reverse noreverse \
file help width)" - 'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile -- scan
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \
's[-]' -k "(draft form moreproc nomoreproc header noheader \
showproc noshowproc length width help)" - 'C[-1,-(show|more)proc]' -c - \
'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile - \
'c[-1,-length]' -s '$LINES' - 'c[-1,-width]' -s '$COLUMNS' -- show next prev
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' \
-k "(help)" -- rmm
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \
's[-]' -k "(after before cc date datefield from help list nolist \
public nopublic search sequence subject to zero nozero not or and \
lbrace rbrace)" -- pick
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' \
-k "(alias check draft draftfolder draftmessage help nocheck \
nodraftfolder)" -- whom
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' \
-k "(file part type list headers noheaders realsize norealsize nolist \
show serialonly noserialonly form pause nopause noshow store auto noauto \
nostore cache nocache rcache wcache check nocheck ebcdicsafe noebcdicsafe \
rfc934mode norfc934mode verbose noverbose help)" - \
'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile - \
'C[-1,-[rw]cache]' -k '(public private never ask)' -- mhn
compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' -k '(help)' -- mhpath
#------------------------------------------------------------------------------
# CVS
#
cvscmds=(add admin rcs checkout commit diff rdiff export history import log rlog
release remove status tag rtag update annotate)
cvsignore="*~ *# .#* *.o *.a CVS . .."
compctl -k cvscmds \
-x "c[-1,-D]" -k '(today yesterday 1\ week\ ago)' \
- "c[-1,-m]" -k '(bugfix cosmetic\ fix ... added\ functionality foo)' \
- "c[-1,-F]" -f \
- "c[-1,-r]" -K cvsrevisions \
- "c[-1,-I]" -f \
- "R[add,;]" -K cvsaddp \
- "R[(admin|rcs),;]" -/K cvstargets \
- "R[(checkout|co),;]" -K cvsrepositories \
- "R[(commit|ci),;]" -/K cvstargets \
- "R[(r|)diff,;]" -/K cvstargets \
- "R[export,;]" -f \
- "R[history,;]" -/K cvstargets \
- "R[history,;] c[-1,-u]" -u \
- "R[import,;]" -K cvsrepositories \
- "R[(r|)log,;]" -/K cvstargets \
- 'R[(r|)log,;] s[-w] n[-1,,],s[-w]' -u -S , -q \
- "R[rel(|ease),;]" -f \
- "R[(remove|rm),;] R[-f,;]" -/K cvstargets \
- "R[(remove|rm),;]" -K cvsremovep \
- "R[status,;]" -/K cvstargets \
- "R[(r|)tag,;]" -/K cvstargets \
- "R[up(|date),;]" -/K cvstargets \
- "R[annotate,;]" -/K cvstargets \
-- cvs
compctl -/K cvstargets cvstest
cvsprefix() {
local nword args f
read -nc nword; read -Ac args
pref=$args[$nword]
if [[ -d $pref:h && ! -d $pref ]]; then
pref=$pref:h
elif [[ $pref != */* ]]; then
pref=
fi
[[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
}
cvsentries() {
setopt localoptions nullglob unset
if [[ -f ${pref}CVS/Entries ]]; then
reply=( "${pref}${^${${${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}" )
fi
}
cvstargets() {
local pref
cvsprefix
cvsentries
}
cvsrevisions() {
reply=( "${${${(M)${(f)$(cvs -q status -vl .)}:# *}##[ ]##}%%[ ]*}" )
}
cvsrepositories() {
local root=$CVSROOT
[[ -f CVS/Root ]] && root=$(<CVS/Root)
reply=(
$root/^CVSROOT(:t)
"${${(M)${(f)$(<$root/CVSROOT/modules)}:#[^#]*}%%[ ]*}"
)
}
cvsremovep() {
local pref
cvsprefix
cvsentries
setopt localoptions unset
local omit
omit=( ${pref}*(D) )
eval 'reply=( ${reply:#('${(j:|:)omit}')} )'
}
cvsaddp() {
local pref
cvsprefix
cvsentries
setopt localoptions unset
local all omit
all=( ${pref}*(D) )
omit=( $reply ${pref}${^${=cvsignore}} )
[[ -r ~/.cvsignore ]] && omit=( $omit ${pref}${^$(<~/.cvsignore)} )
[[ -r ${pref}.cvsignore ]] && omit=( $omit ${pref}${^$(<${pref}.cvsignore)} )
eval 'reply=( ${all:#('${(j:|:)omit}')} )'
}
#------------------------------------------------------------------------------
# RedHat Linux rpm utility
#
compctl -s '$(rpm -qa)' \
-x 's[--]' -s 'oldpackage percent replacefiles replacepkgs noscripts
root excludedocs includedocs test upgrade test clean
short-circuit sign recompile rebuild resign querytags
queryformat version help quiet rcfile force hash' - \
's[ftp:]' -P '//' -s '$(</u/zsh/ftphosts)' -S '/' - \
'c[-1,--root]' -/ - \
'c[-1,--rcfile]' -f - \
'p[1] s[-b]' -k '(p l c i b a)' - \
'c[-1,--queryformat] N[-1,{]' \
-s '"${${(f)$(rpm --querytags)}#RPMTAG_}"' -S '}' - \
'W[1,-q*] C[-1,-([^-]*|)f*]' -f - \
'W[1,-i*], W[1,-q*] C[-1,-([^-]*|)p*]' \
-/g '*.rpm' + -f -- rpm
#------------------------------------------------------------------------------
compctl -u -x 'c[-1,-w]' -f -- ac
compctl -/g '*.m(.)' mira
#------------------------------------------------------------------------------
# talk completion: complete local users, or users at hosts listed via rwho
compctl -K talkmatch talk ytalk ytalk3
function talkmatch {
local u
reply=($(users))
for u in "${${(f)$(rwho 2>/dev/null)}%%:*}"; do
reply=($reply ${u%% *}@${u##* })
done
}
#------------------------------------------------------------------------------
# Linux mount
comp_fsmount () {
local tmp; if [[ $UID = 0 ]]; then tmp=""; else tmp="user"; fi
sed -n -e "s|^[^# ][^ ]*[ ][ ]*\(/[^ ]*\)[ ].*$tmp.*|\1|p" /etc/fstab
}
comp_nfsmount () {
local cmd args host
read -Ac cmd; read -cn where
host=${${cmd[$where]}%%:*}
reply=("${(@f)$(showmount -e $host | sed -n -e "s|^/\([^ ]*\) .*|$host:/\1|p")}")
}
compctl -s '$(mount | \
sed -e "s/^[^ ]* on \\([^ ]*\\) type.*/\\1/"'"$(
if [[ ! $UID = 0 ]]; then
echo ' | egrep "^${(j:|:)$(comp_fsmount)}\$"'
fi)"')' umount
compctl -s '$(comp_fsmount)' + \
-x 'S[/]' -f -- + \
-x 'C[0,*:*]' -K comp_nfsmount -- + \
-s '$(< /etc/hosts)' \
mount
#------------------------------------------------------------------------------
# Lynx (web browser)
compctl -k '(http:// file: ftp:// gopher:// news://)' -S '' \
-x 's[ftp://]' -k ftphosts -S/ \
- 'n[1,://]' -k hosts -S/ \
- 's[file:/]' -/g '*.html' -W/ \
- 's[file:]' -s '~+' -S '/' \
- 's[-]' -k '(anonymous auth base book buried_news cache case
cfg child cookies crawl display dump editor emacskeys
enable_scrollback error_file fileversions force_html
from ftp get_data head help historical homepage
image_links index link localhost locexec mime_header
minimal newschunksize newsmaxchunk nobrowse noexec
nofilereferer nofilereferer nolist nolog nopause
noprint noredir noreferer nosocks nostatus number_links
popup post_data print pseudo_inlines raw realm reload
restrictions resubmit_posts rlogin selective show_cursor
source startfile_ok telnet term trace traversal underscore
validate version vikeys)' \
-- lynx
#------------------------------------------------------------------------------
# ssh (secure shell)
compctl -k hosts \
-x "c[-1,-l]" -u \
- "c[-1,-i]" -f \
- "c[-1,-e]" -k "(~ none)" \
- "c[-1,-c]" -k "(idea des 3des tss arcfour none)" \
- "c[-1,-p]" -k ports \
- "c[-1,-L] c[-1,-R] c[-1,-o]" -k "()" \
-- ssh
#------------------------------------------------------------------------------
# network stuff
compctl -k hosts \
-x "s[-class=]" -k "(any in chaos hesiod)" \
- "s[-query=]" -k "(a cname hinfo md mx mb mg minfo ns ptr soa txt uinfo wks any)" \
- "s[-]" -Q -S '' -k "(query= all\ class= d2\ nod2\ debug\ nodebug\ defname\ nodefname\ domain= ignoretc\ noignoretc\ )" \
-- nslookup
compctl -k hosts \
-x "C[-1,[^-]*] p[2,-1]" -k ports \
-- telnet
compctl -x 'N[-1,@]' -k hosts - 's[]' -u -qS '@' -- finger
#------------------------------------------------------------------------------
# gdb
compctl -/g "*(*)" \
-x "s[-]" -k "(help nx q batch cd f b tty exec se core symbols c x d)" \
- "C[-1,(-cd|-directory)]" -/ \
- "C[-1,(-core|-c)]" -/g 'core*' \
- "C[-1,(-se|-exec)]" -f \
- "C[-1,(-symbols|-command|-x)]" -f \
- "p[2,-1] C[-1,[^-]*]" -/g "core*" \
-- gdb

Some files were not shown because too many files have changed in this diff Show More