[comp.sources.misc] v18i084: zsh2.00 - The Z shell, Part01/15

pfalstad@phoenix.princeton.edu (Paul Falstad) (04/24/91)

Submitted-by: Paul Falstad <pfalstad@phoenix.princeton.edu>
Posting-number: Volume 18, Issue 84
Archive-name: zsh2.00/part01

The Z shell functionality highlights...

from (t)csh:
- command line editing, bindkey, command/filename completion
- spelling correction
- history saving
- precmd, periodic, sched, echotc
- escape sequences in prompts
- login/logout watching
- autolist, fignore, histlit
- ! history substitution (can be turned off, though)
- arrays
- repeat, pushd, popd
- job control, brace expansion, aliases, globbing, etc.

from ksh:
- for, select, case, if, [[...]], ((...)), time [pipeline]
- command substitution, process substitution (no /dev/fd required)
- ${...%%...}, ${...##...}
- FPATH, MAILPATH, TMOUT
- alias name=value, cd old new, fc, getopts, print, set -A, set -o
- typeset -LRZfilrtux, trap, times, ulimit, type, whence
- autoload shell functions
- shell function local vars

from CWRU bash:
- ! pipeline, SHLVL, LINENO, OLDPWD, MAIL_WARNING
- history ignorespace, history ignoredups, autoresume
- $[...]
- #! interpretation for systems that don't have it

other stuff:
- improved globbing (better than v1)
- global aliases
- a line editor that adjusts the frequency of refreshes to the speed of your
  connection
- in your prompt, prints other people's directories like "~fubar" instead 
  of "/n/uffda/b/tmp_mnt/homes/students/fubar"
- vared (edit the value of a variable using the line editor)

Paul Falstad  pfalstad@phoenix.princeton.edu
--------------------------------
#!/bin/sh
# This is zsh2.00.00, a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 04/17/1991 01:43 UTC by pfalstad@phoenix
# Source directory /scratch/zshar
#
# existing files will NOT be overwritten unless -c is specified
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#  12488 -rw-r--r-- zsh2.00/COPYING
#   1230 -rw-r--r-- zsh2.00/README
#   1156 -rw-r--r-- zsh2.00/dots/zlogin
#   2979 -rw-r--r-- zsh2.00/dots/zshrc
#    104 -rwxr-xr-x zsh2.00/func/acx
#    109 -rwxr-xr-x zsh2.00/func/cx
#     97 -rwxr-xr-x zsh2.00/func/harden
#     84 -rwxr-xr-x zsh2.00/func/mere
#    412 -rwxr-xr-x zsh2.00/func/namedir
#    194 -rwxr-xr-x zsh2.00/func/proto
#     80 -rwxr-xr-x zsh2.00/func/randline
#     29 -rwxr-xr-x zsh2.00/func/yp
#     35 -rwxr-xr-x zsh2.00/func/yu
#  97988 -rw-r--r-- zsh2.00/man/man1/zsh.1
#    761 -rw-r--r-- zsh2.00/scripts/aproto
#    173 -rw-r--r-- zsh2.00/scripts/fproto
#   7127 -rwxr-xr-x zsh2.00/src/buildzsh
#  49817 -rw-r--r-- zsh2.00/src/builtin.c
#   3432 -rw-r--r-- zsh2.00/src/builtin.pro
#   4322 -rw-r--r-- zsh2.00/src/cond.c
#    191 -rw-r--r-- zsh2.00/src/cond.pro
#  31640 -rw-r--r-- zsh2.00/src/exec.c
#   2101 -rw-r--r-- zsh2.00/src/exec.pro
#    682 -rw-r--r-- zsh2.00/src/funcs.h
#  21953 -rw-r--r-- zsh2.00/src/glob.c
#   1492 -rw-r--r-- zsh2.00/src/glob.pro
#  23645 -rw-r--r-- zsh2.00/src/hist.c
#   1700 -rw-r--r-- zsh2.00/src/hist.pro
#  10131 -rw-r--r-- zsh2.00/src/init.c
#    431 -rw-r--r-- zsh2.00/src/init.pro
#  14909 -rw-r--r-- zsh2.00/src/jobs.c
#    824 -rw-r--r-- zsh2.00/src/jobs.pro
#  13477 -rw-r--r-- zsh2.00/src/lex.c
#    246 -rw-r--r-- zsh2.00/src/lex.pro
#   4832 -rw-r--r-- zsh2.00/src/loop.c
#    206 -rw-r--r-- zsh2.00/src/loop.pro
#  10042 -rw-r--r-- zsh2.00/src/math.c
#    398 -rw-r--r-- zsh2.00/src/math.pro
#   5039 -rw-r--r-- zsh2.00/src/mem.c
#    515 -rw-r--r-- zsh2.00/src/mem.pro
#  23076 -rw-r--r-- zsh2.00/src/params.c
#   3316 -rw-r--r-- zsh2.00/src/params.pro
#   1032 -rw-r--r-- zsh2.00/src/parse.pro
#  13927 -rw-r--r-- zsh2.00/src/parse.y
#  14939 -rw-r--r-- zsh2.00/src/subst.c
#    622 -rw-r--r-- zsh2.00/src/subst.pro
#   6472 -rw-r--r-- zsh2.00/src/table.c
#    844 -rw-r--r-- zsh2.00/src/table.pro
#   8635 -rw-r--r-- zsh2.00/src/text.c
#    330 -rw-r--r-- zsh2.00/src/text.pro
#  26480 -rw-r--r-- zsh2.00/src/utils.c
#   2683 -rw-r--r-- zsh2.00/src/utils.pro
#   7467 -rw-r--r-- zsh2.00/src/watch.c
#    371 -rw-r--r-- zsh2.00/src/watch.pro
#   1541 -rw-r--r-- zsh2.00/src/y.tab.h
#   6151 -rw-r--r-- zsh2.00/src/zle.h
#   1203 -rw-r--r-- zsh2.00/src/zle_basic.pro
#  16336 -rw-r--r-- zsh2.00/src/zle_bindings.c
#      0 -rw-r--r-- zsh2.00/src/zle_bindings.pro
#  14805 -rw-r--r-- zsh2.00/src/zle_emacs.c
#   2441 -rw-r--r-- zsh2.00/src/zle_emacs.pro
#  12554 -rw-r--r-- zsh2.00/src/zle_main.c
#    659 -rw-r--r-- zsh2.00/src/zle_main.pro
#  12036 -rw-r--r-- zsh2.00/src/zle_refresh.c
#    596 -rw-r--r-- zsh2.00/src/zle_refresh.pro
#  11826 -rw-r--r-- zsh2.00/src/zle_tricky.c
#   1019 -rw-r--r-- zsh2.00/src/zle_tricky.pro
#   4217 -rw-r--r-- zsh2.00/src/zle_utils.c
#    634 -rw-r--r-- zsh2.00/src/zle_utils.pro
#   7561 -rw-r--r-- zsh2.00/src/zle_vi.c
#   1349 -rw-r--r-- zsh2.00/src/zle_vi.pro
#  97988 -rw-r--r-- zsh2.00/src/zsh.1
#  25361 -rw-r--r-- zsh2.00/src/zsh.h
#   1927 -rw-r--r-- zsh2.00/src/ztype.h
#
if test -r _shar_seq_.tmp; then
	echo 'Must unpack archives in sequence!'
	echo Please unpack part `cat _shar_seq_.tmp` next
	exit 1
fi
# ============= zsh2.00/COPYING ==============
if test ! -d 'zsh2.00'; then
    echo 'x - creating directory zsh2.00'
    mkdir 'zsh2.00'
fi
if test -f 'zsh2.00/COPYING' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/COPYING (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/COPYING (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/COPYING' &&
X
X		    GNU GENERAL PUBLIC LICENSE
X		     Version 1, February 1989
X
X Copyright (C) 1989 Free Software Foundation, Inc.
X                    675 Mass Ave, Cambridge, MA 02139, USA
X Everyone is permitted to copy and distribute verbatim copies
X of this license document, but changing it is not allowed.
X
X			    Preamble
X
X  The license agreements of most software companies try to keep users
Xat the mercy of those companies.  By contrast, our General Public
XLicense is intended to guarantee your freedom to share and change free
Xsoftware--to make sure the software is free for all its users.  The
XGeneral Public License applies to the Free Software Foundation's
Xsoftware and to any other program whose authors commit to using it.
XYou can use it for your programs, too.
X
X  When we speak of free software, we are referring to freedom, not
Xprice.  Specifically, the General Public License is designed to make
Xsure that you have the freedom to give away or sell copies of free
Xsoftware, that you receive source code or can get it if you want it,
Xthat you can change the software or use pieces of it in new free
Xprograms; and that you know you can do these things.
X
X  To protect your rights, we need to make restrictions that forbid
Xanyone to deny you these rights or to ask you to surrender the rights.
XThese restrictions translate to certain responsibilities for you if you
Xdistribute copies of the software, or if you modify it.
X
X  For example, if you distribute copies of a such a program, whether
Xgratis or for a fee, you must give the recipients all the rights that
Xyou have.  You must make sure that they, too, receive or can get the
Xsource code.  And you must tell them their rights.
X
X  We protect your rights with two steps: (1) copyright the software, and
X(2) offer you this license which gives you legal permission to copy,
Xdistribute and/or modify the software.
X
X  Also, for each author's protection and ours, we want to make certain
Xthat everyone understands that there is no warranty for this free
Xsoftware.  If the software is modified by someone else and passed on, we
Xwant its recipients to know that what they have is not the original, so
Xthat any problems introduced by others will not reflect on the original
Xauthors' reputations.
X
X  The precise terms and conditions for copying, distribution and
Xmodification follow.
X
X		    GNU GENERAL PUBLIC LICENSE
X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
X
X  0. This License Agreement applies to any program or other work which
Xcontains a notice placed by the copyright holder saying it may be
Xdistributed under the terms of this General Public License.  The
X"Program", below, refers to any such program or work, and a "work based
Xon the Program" means either the Program or any work containing the
XProgram or a portion of it, either verbatim or with modifications.  Each
Xlicensee is addressed as "you".
X
X  1. You may copy and distribute verbatim copies of the Program's source
Xcode as you receive it, in any medium, provided that you conspicuously and
Xappropriately publish on each copy an appropriate copyright notice and
Xdisclaimer of warranty; keep intact all the notices that refer to this
XGeneral Public License and to the absence of any warranty; and give any
Xother recipients of the Program a copy of this General Public License
Xalong with the Program.  You may charge a fee for the physical act of
Xtransferring a copy.
X
X  2. You may modify your copy or copies of the Program or any portion of
Xit, and copy and distribute such modifications under the terms of Paragraph
X1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating that
X    you changed the files and the date of any change; and
X
X    b) cause the whole of any work that you distribute or publish, that
X    in whole or in part contains the Program or any part thereof, either
X    with or without modifications, to be licensed at no charge to all
X    third parties under the terms of this General Public License (except
X    that you may choose to grant warranty protection to some or all
X    third parties, at your option).
X
X    c) If the modified program normally reads commands interactively when
X    run, you must cause it, when started running for such interactive use
X    in the simplest and most usual way, to print or display an
X    announcement including an appropriate copyright notice and a notice
X    that there is no warranty (or else, saying that you provide a
X    warranty) and that users may redistribute the program under these
X    conditions, and telling the user how to view a copy of this General
X    Public License.
X
X    d) You may charge a fee for the physical act of transferring a
X    copy, and you may at your option offer warranty protection in
X    exchange for a fee.
X
XMere aggregation of another independent work with the Program (or its
Xderivative) on a volume of a storage or distribution medium does not bring
Xthe other work under the scope of these terms.
X
X  3. You may copy and distribute the Program (or a portion or derivative of
Xit, under Paragraph 2) in object code or executable form under the terms of
XParagraphs 1 and 2 above provided that you also do one of the following:
X
X    a) accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    b) accompany it with a written offer, valid for at least three
X    years, to give any third party free (except for a nominal charge
X    for the cost of distribution) a complete machine-readable copy of the
X    corresponding source code, to be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    c) accompany it with the information you received as to where the
X    corresponding source code may be obtained.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form alone.)
X
XSource code for a work means the preferred form of the work for making
Xmodifications to it.  For an executable file, complete source code means
Xall the source code for all modules it contains; but, as a special
Xexception, it need not include source code for modules which are standard
Xlibraries that accompany the operating system on which the executable
Xfile runs, or for standard header files or definitions files that
Xaccompany that operating system.
X
X  4. You may not copy, modify, sublicense, distribute or transfer the
XProgram except as expressly provided under this General Public License.
XAny attempt otherwise to copy, modify, sublicense, distribute or transfer
Xthe Program is void, and will automatically terminate your rights to use
Xthe Program under this License.  However, parties who have received
Xcopies, or rights to use copies, from you under this General Public
XLicense will not have their licenses terminated so long as such parties
Xremain in full compliance.
X
X  5. By copying, distributing or modifying the Program (or any work based
Xon the Program) you indicate your acceptance of this license to do so,
Xand all its terms and conditions.
X
X  6. Each time you redistribute the Program (or any work based on the
XProgram), the recipient automatically receives a license from the original
Xlicensor to copy, distribute or modify the Program subject to these
Xterms and conditions.  You may not impose any further restrictions on the
Xrecipients' exercise of the rights granted herein.
X
X  7. The Free Software Foundation may publish revised and/or new versions
Xof the General Public License from time to time.  Such new versions will
Xbe similar in spirit to the present version, but may differ in detail to
Xaddress new problems or concerns.
X
XEach version is given a distinguishing version number.  If the Program
Xspecifies a version number of the license which applies to it and "any
Xlater version", you have the option of following the terms and conditions
Xeither of that version or of any later version published by the Free
XSoftware Foundation.  If the Program does not specify a version number of
Xthe license, you may choose any version ever published by the Free Software
XFoundation.
X
X  8. If you wish to incorporate parts of the Program into other free
Xprograms whose distribution conditions are different, write to the author
Xto ask for permission.  For software which is copyrighted by the Free
XSoftware Foundation, write to the Free Software Foundation; we sometimes
Xmake exceptions for this.  Our decision will be guided by the two goals
Xof preserving the free status of all derivatives of our free software and
Xof promoting the sharing and reuse of software generally.
X
X			    NO WARRANTY
X
X  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
XREPAIR OR CORRECTION.
X
X  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
XPOSSIBILITY OF SUCH DAMAGES.
X
X		     END OF TERMS AND CONDITIONS
X
X	Appendix: How to Apply These Terms to Your New Programs
X
X  If you develop a new program, and you want it to be of the greatest
Xpossible use to humanity, the best way to achieve this is to make it
Xfree software which everyone can redistribute and change under these
Xterms.
X
X  To do so, attach the following notices to the program.  It is safest to
Xattach them to the start of each source file to most effectively convey
Xthe exclusion of warranty; and each file should have at least the
X"copyright" line and a pointer to where the full notice is found.
X
X    <one line to give the program's name and a brief idea of what it does.>
X    Copyright (C) 19yy  <name of author>
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X
XAlso add information on how to contact you by electronic and paper mail.
X
XIf the program is interactive, make it output a short notice like this
Xwhen it starts in an interactive mode:
X
X    Gnomovision version 69, Copyright (C) 19xx name of author
X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
X    This is free software, and you are welcome to redistribute it
X    under certain conditions; type `show c' for details.
X
XThe hypothetical commands `show w' and `show c' should show the
Xappropriate parts of the General Public License.  Of course, the
Xcommands you use may be called something other than `show w' and `show
Xc'; they could even be mouse-clicks or menu items--whatever suits your
Xprogram.
X
XYou should also get your employer (if you work as a programmer) or your
Xschool, if any, to sign a "copyright disclaimer" for the program, if
Xnecessary.  Here a sample; alter the names:
X
X  Yoyodyne, Inc., hereby disclaims all copyright interest in the
X  program `Gnomovision' (a program to direct compilers to make passes
X  at assemblers) written by James Hacker.
X
X  <signature of Ty Coon>, 1 April 1989
X  Ty Coon, President of Vice
X
XThat's all there is to it!
SHAR_EOF
chmod 0644 zsh2.00/COPYING ||
echo 'restore of zsh2.00/COPYING failed'
Wc_c="`wc -c < 'zsh2.00/COPYING'`"
test 12488 -eq "$Wc_c" ||
	echo 'zsh2.00/COPYING: original size 12488, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/README ==============
if test -f 'zsh2.00/README' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/README (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/README' &&
Xzsh is free software.  See the file COPYING for copying permission.
X
XTo get this shell running, cd into the src directory and type
X"buildzsh".  I tested it on the following machines, where it compiled
Xjust by running this script:
X
XSun SPARCServer 4/490 running SunOS 4.1.1
XSun 3/60C running SunOS 4.1.1
XSun 4-something running SunOS 4.0.3
XNeXTstation running Mach 2.0
XSGI-4D/25 running IRIX 3.3.1
Xhp9000 running a variant of BSD4.3
X
XIf it doesn't work, either complain to me, or tweak config.h, Makefile, and
Xsignals.h until it does.
X
XTabstops are 3 spaces.  If you're going to look at my code, run it
Xthough "expand -3" first, or set your tab stops to the same as mine.
X
XIf anyone has any questions, suggestions, comments, bugs, flames, or
Xany other mail of any kind, send it to pfalstad@phoenix.princeton.edu.
XI did not supply any patches or bug fixes for version 1, because I junked
Xmost of it as soon as I released it.  This version will be more permanent,
Xhopefully, so I'll be able to fix bugs quickly as soon as they're found.
X
XThanks to the following people for help, ideas, comments, patches, etc.:
X _
XGoran Larsson
XByron Rakitzis
XGreg A. Woods
XKartik Subbarao
XMichael Marucheck
XKennedy Lemke
XPaul E. Maisano
XKazuo Itoh
X
SHAR_EOF
chmod 0644 zsh2.00/README ||
echo 'restore of zsh2.00/README failed'
Wc_c="`wc -c < 'zsh2.00/README'`"
test 1230 -eq "$Wc_c" ||
	echo 'zsh2.00/README: original size 1230, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/dots/zlogin ==============
if test ! -d 'zsh2.00/dots'; then
    echo 'x - creating directory zsh2.00/dots'
    mkdir 'zsh2.00/dots'
fi
if test -f 'zsh2.00/dots/zlogin' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/dots/zlogin (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/dots/zlogin (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/dots/zlogin' &&
X#
X# login file for zsh 2.0
X#
Xclear
Xcd
Xstty dec new cr0
X
X# find out where I logged in from
XFROM=$(who said that | sed 's/^.*(\([^.:]*\).*).*$/\1/')
X
X# find out what kind of host it is
Xcase "$FROM" in
X	learning*) FROMTYPE=SUNOS-4.1; stty rows 40; ;;
X	*) FROMTYPE="$(host -t hinfo $FROM | sed 's/^.*HINFO//')" ;;
Xesac
X
Xcase "$FROMTYPE" in
X	*CISCO*)	eval $(tset -s vt100)
X				FROM=comserv
X				export PRINTER=madlw
X				48
X				BAUD=1800
X				unset RPROMPT ;;
X	*MAC-OS*|*MS-DOS*|*IBM*)	eval $(tset -s vt100)
X										export PRINTER=madlw
X										FROM=madison ;;
X	*SUNOS-4.1*)	eval $(tset -s xterm)
X						export DISPLAY=$FROM:0.0
X						FROM=sun
X						stty erase 
X						export PRINTER=ps1 ;;
X	*SGI*)	eval $(tset -s iris-ansi)
X				export PRINTER=disney
X				export DISPLAY=$FROM:0.0
X				FROM=iris
X				stty erase  ;;
X	*) eval $(tset -s -Q '?vt100') ;;
Xesac
X
X# set up termcap for less
XLESSTERM=$(print -r $TERMCAP | sed 's/:ti=[^:]*:te=[^:]*:/:ti=:te=:/')
X
Xstty -tabs
Xumask 022
Xexport MAIL=/usr/spool/mail/$USER
XMAILCHECK=60
X# biff y
Xmesg y
Xuptime
Xfortune
X
X# see who's logged on
Xlog
X
X# add myself to $watch
Xwatch=($watch pfalstad)
X
Xfrom 2>/dev/null
X< notes
Xmsgs -q
SHAR_EOF
chmod 0644 zsh2.00/dots/zlogin ||
echo 'restore of zsh2.00/dots/zlogin failed'
Wc_c="`wc -c < 'zsh2.00/dots/zlogin'`"
test 1156 -eq "$Wc_c" ||
	echo 'zsh2.00/dots/zlogin: original size 1156, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/dots/zshrc ==============
if test -f 'zsh2.00/dots/zshrc' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/dots/zshrc (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/dots/zshrc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/dots/zshrc' &&
X#
X# my rc file for zsh 2.0
X#
Xpath=(~/scr ~/bin/$HOSTTYPE /usr/princeton/bin /usr/ucb /usr/bin /bin \
X~maruchck/scr ~subbarao/bin ~maruchck/bin \
X/usr/hosts /usr/princeton/bin/X11 /./usr/lang /./usr/etc /./etc \
X~/src/zsh/bin ~presotto/bin)
X
Xcdpath=(~ ~/src/cs320 ~/src)
X
X# search path for functions
Xfpath=(~/func)
X
X# commonly used directory
Xcsrc=/usr/princeton/common/src
X
Xunlimit
Xlimit stack 8192
X
X# turn on core dumps for the shell, but not child processes
Xlimit -s
Xlimit core 0
X
Xumask 022
X
Xalias a=alias
Xa '<<'=more
Xa -g 'GF'='| fgrep -f ~/.friends' G='| grep' M='| less' cex='/u/pup/centrex'
Xa -g cpz=cpirazzi gun=egsirer me=pfalstad mjm=maruchck paswd='<(ypcat passwd)'
Xa -g sub=subbarao 'suk*=sukthnkr' tike=teichbrg
Xa a.out=./a.out sendmail=/usr/lib/sendmail c=cp 0=vi 09='vi -t' 00=r
Xa d=dirs en='enscript -2rGh' fm='finger -m' grep=egrep h=history
Xa hide='ARGV0="$(randline ~/pub/strings)                     " '
Xa hinfo='host -t hinfo' j=jobs l='ls -AF' lock='lock -p -60000'
Xa lsd='ls -d */' m=make make=gmake main=./main man=woman mm=less more=less
Xa nrable='ls -AFltrd *(^R)' sz='ls -l | sort -n +3 | tail -20'
Xa sn='sed -n' nw='l -ltr | tail' pd=pushd pop=popd ps=sps
Xa rable='ls -AFltrd *(R)' rn='hide /usr/princeton/bin/rn.4.1'
Xa rtfm='ARGV0=rtfm man' strings='strings -' t=cat talk='hide talk'
Xa v=mv where='hostname; echo >/dev/null' k9='kill -9'
Xa find='noglob find' bindkey='noglob bindkey' dh='dirs -v'
X
Xcpz=~cpirazzi gun=~egsirer mjm=~maruchck sub=~subbarao 
X
X# for csh junkies (including tset)
Xsetenv() { export $1=$2 }
X
Xexport MANPATH=/usr/man:/usr/princeton/man:/u/cad/man:/usr/lang/man
X
X# if this is not an interactive shell, skip the rest of this script
Xif [[ ! -o interactive ]]
Xthen
X	return
Xfi
X
X# suffixes to ignore for filename completion
Xfignore=(.o .pro .old .log)
Xzsh=~/src/zsh
X
X# name some directories
X: ~zsh ~csrc ~cpz ~gun ~mjm ~sub
X
X# load the history
XHISTFILE=~/.zhistory SAVEHIST=100 DIRSTACKSIZE=50
X
XPROMPT='ZZ %l %U%T%u %S%m%s[%h] '
XRPROMPT=' %~'
XFCEDIT=vi
X!" export MAILCALL='NEW MAIL! '
Xexport NAME='Paul Falstad'
Xexport ORGANIZATION='League For Fighting Chartered Accountancy'
Xexport YOUSAID='In %C you wrote:'
Xexport ATTRIBUTION='%f wrote:'
Xexport SHELL=/u/pfalstad/bin/sun4/zsh
Xexport RNINIT=/u/pfalstad/.rninit
Xa less='hide TERMCAP="$LESSTERM" /usr/princeton/bin/less'
Xautoload cx acx mere yu yp randline proto namedir
XMAIL=/usr/spool/mail/pfalstad
XMAILCHECK=30
XHISTSIZE=600
Xsetopt notify globdots correct pushdtohome cdablevars autolist \
X	sunkeyboardhack correctall autocd recexact longlistjobs mailwarning \
X	autoresume histignorespace histignoredups pushdsilent noclobber \
X	autopushd
X
Xunsetopt bgnice
X
X# watch for some friends
Xwatch=($(cat ~/.friends))
XWATCHFMT='%n %a %l from %m at %t.'
XLOGCHECK=0
X
Xexport LESS=-ainx3
X
X# do some bindings
Xbindkey '^X^Z' universal-argument ' ' magic-space
Xbindkey '^X^A' vi-find-prev-char-skip
Xbindkey -s '^X^S' 'sub
X'
X
X# for losing NeXT keyboards
Xbindkey -s '\M-/' '\\'
Xbindkey -s '\M-=' '|'
X
SHAR_EOF
chmod 0644 zsh2.00/dots/zshrc ||
echo 'restore of zsh2.00/dots/zshrc failed'
Wc_c="`wc -c < 'zsh2.00/dots/zshrc'`"
test 2979 -eq "$Wc_c" ||
	echo 'zsh2.00/dots/zshrc: original size 2979, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/acx ==============
if test ! -d 'zsh2.00/func'; then
    echo 'x - creating directory zsh2.00/func'
    mkdir 'zsh2.00/func'
fi
if test -f 'zsh2.00/func/acx' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/acx (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/acx (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/acx' &&
X#! /bin/sh
X#
X# zsh shell function to make its arguments 755
X# also works as an sh script
X#
Xchmod 755 $*
SHAR_EOF
chmod 0755 zsh2.00/func/acx ||
echo 'restore of zsh2.00/func/acx failed'
Wc_c="`wc -c < 'zsh2.00/func/acx'`"
test 104 -eq "$Wc_c" ||
	echo 'zsh2.00/func/acx: original size 104, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/cx ==============
if test -f 'zsh2.00/func/cx' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/cx (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/cx (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/cx' &&
X#! /bin/sh
X#
X# zsh shell function to make its arguments executable
X# also works as a sh script
X#
Xchmod +x $*
SHAR_EOF
chmod 0755 zsh2.00/func/cx ||
echo 'restore of zsh2.00/func/cx failed'
Wc_c="`wc -c < 'zsh2.00/func/cx'`"
test 109 -eq "$Wc_c" ||
	echo 'zsh2.00/func/cx: original size 109, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/harden ==============
if test -f 'zsh2.00/func/harden' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/harden (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/harden (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/harden' &&
X#! /bin/sh
X# harden a link (convert it to a singly linked file)
Xcp $1 $1.foo
Xrm $1
Xmv $1.foo $1
X
SHAR_EOF
chmod 0755 zsh2.00/func/harden ||
echo 'restore of zsh2.00/func/harden failed'
Wc_c="`wc -c < 'zsh2.00/func/harden'`"
test 97 -eq "$Wc_c" ||
	echo 'zsh2.00/func/harden: original size 97, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/mere ==============
if test -f 'zsh2.00/func/mere' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/mere (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/mere (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/mere' &&
X#! /bin/sh
X# read a man page in the current directory
Xnroff -man -Tman $1 | less -s
SHAR_EOF
chmod 0755 zsh2.00/func/mere ||
echo 'restore of zsh2.00/func/mere failed'
Wc_c="`wc -c < 'zsh2.00/func/mere'`"
test 84 -eq "$Wc_c" ||
	echo 'zsh2.00/func/mere: original size 84, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/namedir ==============
if test -f 'zsh2.00/func/namedir' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/namedir (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/namedir (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/namedir' &&
X# give a name to a directory
X
X$1=~+
X: ~$1
X
X# for example, if we say: namedir foo
X# where the current directory is /usr/princeton/common/src/news/nntp/inews
X# this will do:
X#
X# foo=/usr/princeton/common/src/news/nntp/inews
X# : ~foo
X#
X# The : ~foo just evaluates ~foo, which declares foo as a named directory.
X# The first time a parameter is used with tilde expansion, it is declared
X# as the name of a named dir.
SHAR_EOF
chmod 0755 zsh2.00/func/namedir ||
echo 'restore of zsh2.00/func/namedir failed'
Wc_c="`wc -c < 'zsh2.00/func/namedir'`"
test 412 -eq "$Wc_c" ||
	echo 'zsh2.00/func/namedir: original size 412, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/proto ==============
if test -f 'zsh2.00/func/proto' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/proto (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/proto (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/proto' &&
X#! /bin/sh
X# generate prototypes, if your style is the same as mine
Xfor i
Xdo
X	rm $i:r.pro 2>/dev/null
X	grep -v '[{};:#]' $i | grep '^[A-Za-z]' |
X		grep -v static | sed 's/$/;/' >! $i:r.pro
Xdone
SHAR_EOF
chmod 0755 zsh2.00/func/proto ||
echo 'restore of zsh2.00/func/proto failed'
Wc_c="`wc -c < 'zsh2.00/func/proto'`"
test 194 -eq "$Wc_c" ||
	echo 'zsh2.00/func/proto: original size 194, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/randline ==============
if test -f 'zsh2.00/func/randline' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/randline (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/randline (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/randline' &&
X# get a random line from a file
Xinteger z=$(wc -l <$1)
Xsed -n $[RANDOM%z+1]p $1
SHAR_EOF
chmod 0755 zsh2.00/func/randline ||
echo 'restore of zsh2.00/func/randline failed'
Wc_c="`wc -c < 'zsh2.00/func/randline'`"
test 80 -eq "$Wc_c" ||
	echo 'zsh2.00/func/randline: original size 80, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/yp ==============
if test -f 'zsh2.00/func/yp' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/yp (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/yp (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/yp' &&
X#! /bin/sh
Xypmatch $1 passwd
SHAR_EOF
chmod 0755 zsh2.00/func/yp ||
echo 'restore of zsh2.00/func/yp failed'
Wc_c="`wc -c < 'zsh2.00/func/yp'`"
test 29 -eq "$Wc_c" ||
	echo 'zsh2.00/func/yp: original size 29, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/func/yu ==============
if test -f 'zsh2.00/func/yu' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/func/yu (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/func/yu (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/func/yu' &&
X#! /bin/sh
Xypmatch $1 passwd.byuid
SHAR_EOF
chmod 0755 zsh2.00/func/yu ||
echo 'restore of zsh2.00/func/yu failed'
Wc_c="`wc -c < 'zsh2.00/func/yu'`"
test 35 -eq "$Wc_c" ||
	echo 'zsh2.00/func/yu: original size 35, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= zsh2.00/man/man1/zsh.1 ==============
if test ! -d 'zsh2.00/man'; then
    echo 'x - creating directory zsh2.00/man'
    mkdir 'zsh2.00/man'
fi
if test ! -d 'zsh2.00/man/man1'; then
    echo 'x - creating directory zsh2.00/man/man1'
    mkdir 'zsh2.00/man/man1'
fi
if test -f 'zsh2.00/man/man1/zsh.1' -a X"$1" != X"-c"; then
	echo 'x - skipping zsh2.00/man/man1/zsh.1 (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting zsh2.00/man/man1/zsh.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/man/man1/zsh.1' &&
X.\"
X.TH ZSH 1 "1991 April 14"
X.SH NAME
Xzsh \- the Z shell
X.SH SYNOPSIS
X\fBzsh\fP [ \(+-\fIoptions\fP ] [ \(+-\fBo\fP \fIoption\fP ] ...  [ \-\fBc\fP \fIstring\fP ] [ \fIarg\fP ... ]
X.SH "SHELL GRAMMAR"
XA \fIsimple command\fP is a sequence of optional parameter
Xassignments followed by blank-separated words,
Xwith optional redirections interspersed.
XThe first word is the command to be executed, and the remaining
Xwords, if any, are arguments to the command.
XIf a command name is given, the parameter assignments modify
Xthe environment of the command when it is executed.
XThe value of a simple command is its exit status,
Xor 128 plus the signal number if terminated by a signal.
X.PP
XIf a simple command is preceded by the word \fBexec\fP,
Xit is executed in the parent shell without forking.
XIf preceded by \fBcommand\fP, the command word is taken
Xto be the name of an external command, rather than a
Xshell function or builtin.
XIf preceded by \fBnoglob\fP, filename generation is not performed
Xon any of the words.  If preceded by a \-, the command
Xis executed with a \- prepended to its \fBargv[0]\fP string.
X.PP
XA \fIpipeline\fP is a sequence of one or more commands
Xseparated by \fB|\fP or \fB|&\fP.  \fB|&\fP is shorthand
Xfor \fB2>&1 |\fP.  The standard output of each command is
Xconnected to the standard input of the next command in the
Xpipeline.
X.PP
XThe value of a pipeline is the value of the last command.
XIf a pipeline is preceded by a \fB!\fP, the value
Xof that pipeline is the logical NOT of the value of the last
Xcommand.
X.PP
XIf a pipeline is preceded by \fBcoproc\fP, it is
Xexecuted as a coprocess; a two-way pipe is established
Xbetween it and the parent shell.  The shell can read from or write to
Xthe coprocess by means of the \fB>&p\fP and \fB<&p\fP
Xredirection operators.
X.PP
XA \fIsublist\fP is a sequence of one or more pipelines
Xseparated by \fB&&\fP or \fB||\fP.  If two pipelines
Xare separated by \fB&&\fP, the second pipeline is executed
Xonly if the first is successful (returns a zero value).
XIf two pipelines are separated by \fB||\fP, the second is executed
Xonly if the first is unsuccessful (returns a nonzero value).
X.PP
XA \fIlist\fP is a sequence of one or more sublists
Xseparated by, and optionally terminated by, \fB;\fP, \fB&\fP,
Xor a newline.
XNormally the shell waits for each list to finish before executing
Xthe next one.
XIf a list is terminated by a \fB&\fP, the shell executes
Xit in the background, and does not wait for it to finish.
X.PP
XA \fIcomplex command\fP is one of the following:
X.PP
X.RS
X.PD 0
X.TP
X\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ... ]
X.TP
X\fBdo\fP \fIlist\fP
X.TP
X\fBdone\fP
X.PD
XExpand the list of \fIword\fPs, and set the parameter
X\fIname\fP to each of them in turn, executing
X\fIlist\fP each time.  If the \fBin\fP \fIword\fP is omitted,
Xuse the positional parameters instead of the \fIword\fPs.
X.TP
X\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fIsublist\fP
XThis is a shorthand for \fBfor\fP.
XThough it may cause confusion, it is included for convenience;
Xits use in scripts is discouraged,
Xunless \fIsublist\fP is a command of the form { \fIlist\fP }.
X.PP
X.PD 0
X.TP
X\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ... ]
X.TP
X\fBdo\fP \fIlist\fP
X.TP
X\fBdone\fP
X.PD
XPrint the set of \fIword\fPs, each preceded by a number.
XIf the \fBin\fP \fIword\fP is omitted, use the positional parameters.
XThe \fBPROMPT3\fP prompt is printed and a line is read from standard
Xinput.  If this line consists of the number of one of the listed
X\fIword\fPs, then the parameter \fIname\fP
Xis set to the \fIword\fP corresponding to this number.
XIf this line is empty, the selection list is printed again.
XOtherwise, the value of the parameter \fIname\fP is set to null.
XThe contents of the line read from standard input is saved
Xin the parameter \fBREPLY\fP.  \fIlist\fP is executed
Xfor each selection until a break or end-of-file is encountered.
X.TP
X\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fIsublist\fP
XA short form of \fBselect\fP.
X.TP
X\fBcase\fP \fIword\fP \fBin\fP [ \fIpattern\fP ) \fIlist\fP ;; ] ...  \fBesac\fP
XExecute the \fIlist\fP associated with the first \fIpattern\fP
Xthat matches \fIword\fP, if any.  The form of the patterns
Xis the same as that used for filename generation.  See
X\fIFilename Generation\fP below.
X.TP
X.PD 0
X\fBif\fP \fIlist\fP
X.TP
X\fBthen\fP \fIlist\fP
X.TP
X[ \fBelif\fP \fIlist\fP ; \fBthen\fP \fIlist\fP ] ...
X.TP
X[ \fBelse\fP \fIlist\fP ]
X.TP
X\fBfi\fP
X.PD
XThe \fBif\fP \fIlist\fP is executed, and,
Xif it returns a zero exit status,
Xthe \fBthen\fP \fIlist\fP is executed.
XOtherwise, the \fBelif\fP \fIlist\fP is
Xexecuted and, if its value is zero,
Xthe \fBthen\fP \fIlist\fP is executed.
XIf each \fBelif\fP \fIlist\fP returns
Xnonzero, the \fBelse\fP \fIlist\fP is executed.
X.TP
X.PD 0
X\fBwhile\fP \fIlist\fP
X.TP
X\fBdo\fP \fIlist\fP
X.TP
X\fBdone\fP
X.PD
XExecute the \fBdo\fP \fIlist\fP as long as the \fBwhile\fP \fIlist\fP
Xreturns a zero exit status.
X.TP
X.PD 0
X\fBuntil\fP \fIlist\fP
X.TP
X\fBdo\fP \fIlist\fP
X.TP
X\fBdone\fP
X.PD
XExecute the \fBdo\fP \fIlist\fP as long as \fBuntil\fP \fIlist\fP
Xreturns a nonzero exit status.
X.TP
X.PD 0
X\fBrepeat\fP \fIword\fP
X.TP
X\fBdo\fP \fIlist\fP
X.TP
X\fBdone\fP
X.PD
X\fIword\fP is expanded and treated as an arithmetic expression,
Xwhich must evaluate to a number \fIn\fP.
X\fIlist\fP is then executed \fBn\fP times.
X.TP
X\fBrepeat\fP \fIword\fP \fIsublist\fP
XThis is a short form of \fBrepeat\fP.
X.TP
X( \fIlist\fP )
XExecute \fIlist\fP in a subshell.
X.TP
X{ \fIlist\fP }
XExecute \fIlist\fP.
X.TP
X.PD 0
X\fBfunction\fP \fIword\fP ... { \fIlist\fP }
X.TP
X\fIword\fP ... (\|) { \fIlist\fP }
X.PD
XDefine a function which is referenced by any one of \fIword\fP.
XNormally, only one \fIword\fP is provided; multiple \fIword\fPs
Xare usually only useful for setting traps.
XThe body of the function is the \fIlist\fP between
Xthe { and }.
XSee \fBFUNCTIONS\fP below.
X.TP
X\fBtime\fP \fIpipeline\fP
XThe \fIpipeline\fP is executed, and timing statistics are
Xreported on the standard error in the form specified
Xby the \fBTIMEFMT\fP parameter.
X.TP
X[[ \fIexp\fP ]]
XEvaluates the conditional expression \fIexp\fP
Xand return a zero exit status if it is true.
XSee \fBConditional Expressions\fP below for a description
Xof \fIexp\fP.
X.SH "RESERVED WORDS"
XThe following words are recognized as the first word of a command
Xunless quoted or removed using the \fBunalias\fP builtin:
X.RS
X.PP
X\fBdo done esac then elif else fi for case
Xif while function repeat time until exec command
Xselect coproc noglob \-\fP
X.RE
X.SH COMMENTS
XIn noninteractive shells, or in interactive shells with the
X\fBINTERACTIVE_COMMENTS\fP option set, a word beginning
Xwith the third character of the \fBHISTCHARS\fP parameter
X(`#' by default) causes that word and all the following
Xcharacters up to a newline to be ignored.
X.SH ALIASING
XEvery token in the shell input is checked to see if there
Xis an alias defined for it.
XIf so, it is replaced by the text of the alias if it is in command
Xposition (if it could be the first word of a simple command),
Xor if the alias is global.
XIf the text ends with a space, the next word in the shell input
Xis treated as though it were in command position for purposes of alias
Xexpansion.
XAn alias is defined using the \fBalias\fP builtin; global aliases
Xmay be defined using the \-\fBg\fP option to that bulitin.
X.PP
XAlias substitution is done on the shell input before any
Xother substitution except history substitution.  Therefore,
Xif an alias is defined for the word \fBfoo\fP, alias substitution
Xmay be avoided by quoting part of the word, e.g. \fB\efoo\fP.
XBut there is nothing to prevent an alias being defined
Xfor \fB\efoo\fP as well.
X.SH QUOTING
XA character may be \fIquoted\fP (that is, made
Xto stand for itself) by preceding it with a \e\|.
X\e followed by a newline is ignored.
XAll characters enclosed between a pair of single quotes ('')
Xare ignored.
XA single quote cannot appear within single quotes.
XInside double quotes (""), parameter and command substitution
Xoccurs, and \e quotes the characters \e\|, `, ", and $.
X.SH EXPANSION
XExpansion is performed on the command line after it has been
Xparsed.  The types of expansions performed are
X\fIfilename expansion\fP, 
X\fIprocess substitution\fP,
X\fIparameter expansion\fP,
X\fIcommand substitution\fP,
X\fIarithmetic expansion\fP,
X\fIbrace expansion\fP,
Xand \fIfilename generation\fP.
X.SS Filename Expansion
XEach word is checked to see if it begins with an unquoted ~.
XIf it does, then the word up to a / is checked to see if it matches
Xthe name of a named directory.  If so, then the ~ and the matched portion
Xare replaced with the value of the named directory.
XA ~ by itself or followed by a / is replaced by the value of the
X\fBHOME\fP parameter.
XA ~ followed by a + or a \- is replaced by the value of 
X\fBPWD\fP or \fBOLDPWD\fP, respectively.
X.PP
XNamed directories are typically login directories for users on the system.
XThey may also be defined if the text after the ~ is the name
Xof a shell parameter whose value begins with a /.
XIn certain circumstances (in prompts, for instance), when the shell
Xprints a path, the path is checked to see if it has a named
Xdirectory as its prefix.  If so, then the prefix portion
Xis replaced with a ~ followed by the name of the directory.
XThe longest match is preferred.
X.PP
XIf a word begins with an unquoted \fB=\fP,
Xthe remainder of the word is taken as the
Xname of a command or alias.  If a command
Xexists by that name, the word is replaced
Xby the full pathname of the command.
XIf an alias exists by that name, the word
Xis replaced with the text of the alias.
XOtherwise the word is checked up to a /
Xto see if it is a number or a \-.  If so,
Xthe matched portion is replaced with
Xthe \fIn\fPth directory in the directory stack,
Xwhere \fIn\fP is the number matched, or
Xthe last directory in the directory stack
Xif a \- is matched.
X.SS Process Substitution
XEach command argument of the form
X\fB<(\fIlist\^\fB)\fR
Xor
X\fB>(\fIlist\^\fB)\fR
Xor
X\fB=(\fIlist\^\fB)\fR
Xis subject to process substitution.
XIn the case of the
X.B <
Xor
X.B >
Xforms, the shell will run process
X.I list
Xasynchronously connected to a named pipe (FIFO).
XThe name of this pipe will become the argument to the command.
XIf the form with
X.B >
Xis selected then writing on this file will provide input for
X.IR list .
XIf
X.B <
Xis used,
Xthen the file passed as an argument will
Xbe a named pipe connected to the output of the
X.I list
Xprocess.
XFor example,
X.RS
X.PP
X\fBpaste <(cut \-f1\fP \fIfile1\fB) <(cut \-f3\fP \fIfile2\fB) | tee >(\fIprocess1\fB) >(\fIprocess2\fB)\fR >/dev/null
X.RE
X.PP
X.BR cut s
Xfields 1 and 3 from
Xthe files
X.I file1
Xand
X.I file2
Xrespectively,
X.BR paste s
Xthe results together, and sends it to the processes
X.I process1
Xand
X.IR process2 .
XNote that the file, which is passed as an argument to the command,
Xis a system
Xpipe 
Xso programs that expect to
X.BR lseek (2)
Xon the file will not work.
XAlso note that the previous example can be more compactly and
Xefficiently written as:
X.RS
X.PP
X\fBpaste <(cut \-f1\fP \fIfile1\fB) <(cut \-f3\fP \fIfile2\fB) > >(\fIprocess1\fB) > >(\fIprocess2\fB)\fR
X.RE
X.PP
Xthe shell uses pipes instead of a FIFOs to implement the latter
Xtwo process substitutions in the above example.
X.PP
XIf
X.B =
Xis used,
Xthen the file passed as an argument will be the name
Xof a temporary file containing
Xthe output of the
X.I list
Xprocess.  This may be used instead of the
X.B <
Xform for a program that expects to \fBlseek\fP(2) on the input file.
X.SS Parameter Expansion
XThe character \fB$\fP is used to introduce parameter expansions.
XSee \fBPARAMETERS\fP below for a description of parameters.
X.PD
X.RS
X.TP
X\fB${\fIname\fB}\fR
XThe value, if any, of the parameter \fIname\fP is substituted.
XThe braces are required with \fIname\fP is followed by
Xa letter, digit, or underscore that is not to be interpreted
Xas part of its name.
XIf \fIname\fP is an array parameter, then the values of each
Xelement of \fIname\fP is substituted, one element per word.
XOtherwise, the expansion results in one word only; no
Xword splitting is done on the result.
X.TP
X\fB${\fIname\fB:\-\fIword\fB}\fR
XIf \fIname\fP is set and is non-null then substitute its
Xvalue; otherwise substitute \fIword\fP.
X.TP
X\fB${\fIname\fB:=\fIword\fB}\fR
XIf \fIname\fP is unset and is null then
Xset it to \fIword\fP; the value of the parameter is then
Xsubstituted.
X.TP
X\fB${\fIname\fB:?\fIword\fB}\fR
XIf \fIname\fP is set and is non-null, then substitute
Xits value; otherwise, print \fIword\fP and exit from the shell.
XIf \fIword\fP is omitted, then a standard message is printed.
X.TP
X\fB${\fIname\fB:+\fIword\fB}\fR
XIf \fIname\fP is set and is non-null then substitute
X\fIword\fP; otherwise substitute nothing.
X.PD 0
X.TP
X\fB${\fIname\fB#\fIpattern\fB}\fR
X.TP
X\fB${\fIname\fB##\fIpattern\fB}\fR
X.PD
XIf the \fIpattern\fP matches the beginning of the value of
X\fIname\fP, then substitute the value of \fIname\fP with
Xthe matched portion deleted; otherwise, just
Xsubstitute the value of \fIname\fP.  In the first
Xform, the smallest matching pattern is preferred;
Xin the second form, the largest matching pattern is preferred.
X.PD 0
X.TP
X${\fIname\fB%\fIpattern\fR}
X.TP
X${\fIname\fB%%\fIpattern\fR}
X.PD
XIf the \fIpattern\fP matches the end of the value of
X\fIname\fP, then substitute the value of \fIname\fP with
Xthe matched portion deleted; otherwise, just
Xsubstitute the value of \fIname\fP.  In the first
Xform, the smallest matching pattern is preferred;
Xin the second form, the largest matching pattern is preferred.
X.TP
X${\fB#\fIspec\fR}
XIf \fIspec\fP is one of the above substitutions, substitute
Xthe length in characters of the result instead of
Xthe result itself.  If \fIspec\fP is an array expression,
Xsubstitute the number of elements of the result.
X.TP
X${\fB^\fIspec\fR}
XToggle the value of the \fBRC_EXPAND_PARAM\fP option for the
Xevaluation of \fIspec\fP.
XWhen this option is set, array expansions of the form
X\fIfoo\fB${\fIxx\fB}\fIbar\fR, where the parameter
X\fIxx\fP is set to (\fIa b c\fP), are substituted with
X\fIfooabar foobbar foocbar\fP instead of the default
X\fIfooa b cbar\fP.
X.TP
X${\fB=\fIspec\fR}
XToggle the value of the \fBSH_WORD_SPLIT\fP option for the
Xevaluation of \fIspec\fP.
XWhen this option is set, parameter values are split into
Xseparate words using \fBIFS\fP as a delimiter
Xbefore substitution.
XThis is done by default in most other shells.
X.PD
X.RE
X.PP
XIf the colon is omitted from one of the above expressions
Xcontaining a colon, then the shell only checks whether
X\fIname\fP is set or not, not whether it is null.
X.SS Command Substitution
XA command enclosed in parentheses
Xpreceded by a dollar sign, like so: $(...) or quoted with grave
Xaccents: `...` is replaced with its standard output.
XIf the substitution is not enclosed in double quotes, the
Xoutput is broken into words using the \fBIFS\fP parameter.
XThe substitution \fB$(cat foo)\fP may be replaced
Xby the equivalent but faster \fB$(<foo)\fP.
X.SS Arithmetic Expansion
XA string of the form \fB$[\fIexp\fB]\fR is substituted
Xwith the value of the arithmetic expression \fIexp\fP.
X\fIexp\fP is treated as if it were within single quotes.
XSee \fBARITHMETIC EVALUATION\fP below.
X.SS Brace Expansion
XA string of the form
X\fIfoo\fB{\fIxx\fB,\fIyy\fB,\fIzz\fB}\fIbar\fR
Xis expanded to the individual words
X\fIfooxxbar\fP, \fIfooyybar\fP, and \fIfoozzbar\fP.
XLeft-to-right order is preserved.  This construct
Xmay be nested.  Malformed brace expansion expressions,
Xincluding expressions without a comma, are left unchanged
Xby the shell.
X.SS Filename Generation
XIf a word contains an unquoted instance of one of the characters
X#, ^, *, |, <, [, or ?, or the string "..../", it is regarded
Xas a pattern for filename generation, unless the \fBNOGLOB\fP option is set.
XThe word is replaced with a list of sorted filenames that match
Xthe pattern.  If no matching pattern is found, the shell gives
Xan error message, unless the \fBNULLGLOB\fP option is set,
Xin which case the word is deleted; or unless the \fBNO_NOMATCH\fP
Xoption is set, in which case the word is left unchanged.
XIn filename generation,
Xthe character / must be matched explicitly; also, a . must be matched
Xexplicitly at the beginning of a pattern or after a /, unless the
X\fBGLOBDOTS\fP option is set.  No filename generation pattern
Xmatches the files "." or "..".  In other instances of pattern
Xmatching, the / and . are not treated specially.
X.PP
X.RS
X.PD 0
X.TP
X.B *
Xmatches any string, including the null string.
X.TP
X.B ?
Xmatches any character.
X.TP
X\fB[ ... ]\fP
Xmatches any of the enclosed characters.
X.TP
X\fB[^ ... ]\fP
Xmatches any character except the enclosed characters.
X.TP
X\fB<x\-y>\fP
Xmatches any number in the range x to y, inclusive.
XIf x is omitted, the number must be less than or equal to y.
XIf y is omitted, the number must be greater than or equal to x.
XA pattern of the form \fB<\->\fP or
Xsimply \fB<>\fP matches any number.
X.TP
X\fB^x\fP
Xmatches anything except the pattern x.
X.TP
X\fBx|y\fP
Xmatches either x or y.
X.TP
X\fBx#\fP
Xmatches zero or more occurences of the pattern x.
X.TP
X\fBx##\fP
Xmatches one or more occurences of the pattern x.
X.RE
X.PD
X.PP
XParentheses may be used for grouping.  Note that the \fB|\fP character
Xmust be within parentheses, so that the lexical analyzer does
Xnot think it is a pipe character.  Also note that "/" has a
Xhigher precedence than "^"; that is:
X.RS
X.PP
Xls
X.BI ^ foo / bar
X.RE
X.PP
Xwill search directories in "." except "./foo" for a file named bar.
X.PP
XA pathname component of the form
X.BI ( foo /)#
Xmatches a path consisting of zero or more directories
Xmatching the pattern foo.
XAs a shorthand,
X.B ..../
Xis equivalent to
X.BR (*/)# .
XThus:
X.RS
X.PP
Xls
X.BI (*/)# bar
X.RE
X.PP
Xor
X.RS
X.PP
Xls
X.BI ..../ bar
X.RE
X.PP
Xdoes a recursive directory search for files named bar.
X.PP
XIf used for filename generation, a pattern may end in a
Xlist of qualifiers enclosed in parentheses.
XThe qualifiers
Xspecify which filenames that otherwise match the given pattern
Xwill be inserted in the argument list.
XA qualifier may be any one of the following:
X.PD 0
X.RS
X.TP
X.B /
Xdirectories
X.TP
X.B .
Xplain files
X.TP
X.B @
Xsymbolic links
X.TP
X.B =
Xsockets
X.TP
X.B p
Xnamed pipes (FIFOs)
X.TP
X.B *
Xexecutable files (0100)
X.TP
X.B %
Xdevice files (character or block special)
X.TP
X.B r
Xreadable files (0400)
X.TP
X.B w
Xwriteable files (0200)
X.TP
X.B x
Xexecutable files (0100, same as *)
X.TP
X.B R
Xworld-readable files (0004)
X.TP
X.B W
Xworld-writeable files (0002)
X.TP
X.B X
Xworld-executable files (0001)
X.TP
X.B s
Xsetuid files (04000)
X.TP
X.B S
Xsetgid files (02000)
X.TP
X\fBd\fIdev\fR
Xfiles on the device \fIdev\fP
X.TP
X\fBl\fIct\fR
Xfiles having a link count of \fIct\fP
X.TP
X\fBU\fP
Xfiles owned by the effective user id
X.TP
X\fBG\fP
Xfiles owned by the effective group id
X.TP
X\fBu\fInum\fR
Xfiles owned by user id \fInum\fP
X.TP
X\fBg\fInum\fR
Xfiles owned by group id \fInum\fP
X.TP
X\fB^\fP
Xnegates all qualifiers following it
SHAR_EOF
true || echo 'restore of zsh2.00/man/man1/zsh.1 failed'
fi
echo 'End of zsh2.00.00 part 1'
echo 'File zsh2.00/man/man1/zsh.1 is continued in part 2'
echo 2 > _shar_seq_.tmp
exit 0
--
              Paul Falstad  pfalstad@phoenix.princeton.edu
         And on the roads, too, vicious gangs of KEEP LEFT signs!
     If Princeton knew my opinions, they'd have expelled me long ago.

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.