1 <!-- Creator : groff version 1.18.1 -->
2 <!-- CreationDate: Sun Jun 19 12:12:12 2005 -->
5 <meta name="generator" content="groff -Thtml, see www.gnu.org">
6 <meta name="Content-Style" content="text/css">
7 <title>zsh−lovers</title>
11 <h1 align=center>zsh−lovers</h1>
12 <a href="#NAME">NAME</a><br>
13 <a href="#OVERVIEW">OVERVIEW</a><br>
14 <a href="#EXAMPLES">EXAMPLES</a><br>
15 <a href="#OPTIONS">OPTIONS</a><br>
16 <a href="#LINKS">LINKS</a><br>
17 <a href="#AUTHORS">AUTHORS</a><br>
18 <a href="#SEE ALSO">SEE ALSO</a><br>
19 <a href="#BUGS">BUGS</a><br>
20 <a href="#COPYRIGHT">COPYRIGHT</a><br>
26 <table width="100%" border=0 rules="none" frame="void"
27 cols="2" cellspacing="0" cellpadding="0">
28 <tr valign="top" align="left">
31 <p>zsh−lovers − tips, tricks and examples for
35 <a name="OVERVIEW"></a>
38 <table width="100%" border=0 rules="none" frame="void"
39 cols="2" cellspacing="0" cellpadding="0">
40 <tr valign="top" align="left">
43 <p>Whenever we look at the zsh manual we wonder why there
44 are no examples for those simply things in (shell) life. The
45 zsh contains many features, but there was no manpage with
46 some examples (like procmailex(5)). That’s why we
47 wrote this manpage.</p>
49 <p>Most of the tricks and oneliner come from the
50 mailinglists zsh−users, zsh−workers, google,
51 newsgroups and from ourself. See section <b>LINKS</b> for
54 <p><b>Note:</b> This manpage (zsh-lovers(1)) is <b>not</b>
55 an offical part of the Z shell! It’s just a just for
56 fun − manpage ;) For comments, bugreports and feedback
57 take a quick look at the section <b>BUGS.</b></p>
60 <a name="EXAMPLES"></a>
63 <table width="100%" border=0 rules="none" frame="void"
64 cols="2" cellspacing="0" cellpadding="0">
65 <tr valign="top" align="left">
68 <p><b>REDIRECTION</b></p></td>
71 <table width="100%" border=0 rules="none" frame="void"
72 cols="2" cellspacing="0" cellpadding="0">
73 <tr valign="top" align="left">
76 <p>See also <i>man 1 zshmisc</i>.</p>
78 <p>null command shorthands:</p>
80 <pre> "< file" is like "$READNULLCMD <file"
81 "> file" is like "cat >file"
82 ">> file" is like "cat >>file"
85 <p>Append ‘exit 1’ at the end of all *.sh
88 <pre> $ echo "exit 1" >> *.sh
91 <p>Append /etc/services at the end of file ‘foo’
92 and ‘bar’:</p>
94 <pre> $ cat /etc/services >> foo >> bar
99 <pre> $ echo An error >&2 2>&1 | sed -e ’s/A/I/’
105 <table width="100%" border=0 rules="none" frame="void"
106 cols="2" cellspacing="0" cellpadding="0">
107 <tr valign="top" align="left">
110 <p><b>MULTIPLE I/O REDIRECTION</b></p></td>
113 <table width="100%" border=0 rules="none" frame="void"
114 cols="2" cellspacing="0" cellpadding="0">
115 <tr valign="top" align="left">
116 <td width="10%"></td>
118 <p>Requires <i>setopt multios</i>! Some examples:</p>
120 <p>Print output of ’ls’ into files
121 ’foo’ and ’bar’:</p>
123 <pre> $ ls >foo >bar
126 <p>Send standard output of one process to standard input of
127 several processes in the pipeline:</p>
129 <pre> $ process1 > >(process1) > >(process2)
132 <p>Redirection to file as well as send on to pipe:</p>
134 <pre> $ make install > /tmp/logfile | grep -i error
137 <p>Redirect stderr to a command like xless without
138 redirecting stdout as well:</p>
140 <pre> $ foo 2>>(xless)
141 ... but this executes the command asynchronously. To do it synchronously:
142 $ { { foo 1>&3 } 2>&1 | xless } 3>&1
145 <p>Redirect stderr two times:</p>
147 <pre> $ setopt multios ; program 2> file2 > file1 2>&1
150 <p>More fun with stderr:</p>
152 <pre> $ ./my-script.sh 2> >(grep -v geek >error.log) | process-output > output.log
153 echo "Thats STDOUT" >>(sed ’s/stdout/another example/’ > foobar)
159 <table width="100%" border=0 rules="none" frame="void"
160 cols="2" cellspacing="0" cellpadding="0">
161 <tr valign="top" align="left">
164 <p><b>MODIFIERS USAGE</b></p></td>
167 <table width="100%" border=0 rules="none" frame="void"
168 cols="2" cellspacing="0" cellpadding="0">
169 <tr valign="top" align="left">
170 <td width="10%"></td>
172 <p>Modifiers are a powerful mechanism that lets you modify
173 the results returned by parameter, filename and history
174 expansion. See zshexpn(1) for details.</p>
176 <p>Remove a trailing pathname component, leaving the head.
177 This works like ‘dirname’:</p>
183 <p>Remove all leading pathname components, leaving the tail.
184 This works like ‘basename’.</p>
190 <p>Remove a filename extension of the form
191 ‘.xxx’, leaving the root name.</p>
199 <p>Remove all but the extension.</p>
208 <p>Print the new command but do not execute it. Only works
209 with history expansion.</p>
217 <p>Quote the substituted words, escaping further
220 <pre> $ bar="23’42"
227 <p>Convert the words to all lowercase.</p>
236 <p>Convert the words to all uppercase.</p>
245 <p>Variables can be modified by modifiers, too. That makes
246 modification of variables possible without using any
247 external program.</p>
249 <pre> sentence="beginning and some words of a sentence with end."
252 <p>Now lets split this sentence-var by using the (s| |)
253 modifier which modifies words by splitting at "
256 <pre> words=${(s| |)sentence}
257 print $words[1] -> "beginning"
258 print $words[-1] ->"end."
261 <p>Now if one wants to have the beginning of a sentence with
262 a Capital, it’s as easy as doing:</p>
264 <pre> print "${(C)words[1]} $words[2,-1]"
267 <p>which capitalizes the first word of the list words and
268 then adds with " " second to last word of words.
269 It’s possible to join these words as a colon separated
272 <pre> colonlist=${(j|,|)words} # (j|,|) joins with ",".
275 <p>You can see that it’s a scalar by testing with
278 <pre> print ${(t)colonlist} prints "scalar".
279 print ${(t)words} prints "array".
282 <p>It’s possible to sort arrays with o and O:</p>
284 <pre> print ${(o)words} # lists the words-array sorted (forwards)
285 print ${(O)words} # lists the words-array sorted (backwards)
291 <table width="100%" border=0 rules="none" frame="void"
292 cols="2" cellspacing="0" cellpadding="0">
293 <tr valign="top" align="left">
296 <p><b>COMPLETITION</b></p></td>
299 <table width="100%" border=0 rules="none" frame="void"
300 cols="2" cellspacing="0" cellpadding="0">
301 <tr valign="top" align="left">
302 <td width="10%"></td>
304 <p>See also <i>man 1 zshcompctl zshcompsys zshcompwid</i>.
305 zshcompctl is the old style of zsh programmable completion,
306 zshcompsys is the new completion system, zshcompwid are the
307 zsh completion widgets.</p>
309 <p>Some functions, like _apt and _dpkg, are very slow. You
310 can use a cache in order to proxy the list of results (like
311 the list of available debian packages) Use a cache:</p>
313 <pre> zstyle ’:completion:*’ use-cache on
314 zstyle ’:completion:*’ cache-path ~/.zsh/cache
317 <p>Prevent CVS files/directories from being completed :</p>
319 <pre> zstyle ’:completion:*:(all-|)files’ ignored-patterns ’(|*/)CVS’
320 zstyle ’:completion:*:cd:*’ ignored-patterns ’(*/)#CVS’
323 <p>Fuzzy matching of completions for when you mistype
326 <pre> zstyle ’:completion:*’ completer _complete _match _approximate
327 zstyle ’:completion:*:match:*’ original only
328 zstyle ’:completion:*:approximate:*’ max-errors 1 numeric
331 <p>And if you want the number of errors allowed by
332 _approximate to increase with the length of what you have
335 <pre> zstyle -e ’:completion:*:approximate:*’ max-errors ’reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )’
338 <p>Ignore completion functions for commands you don’t
341 <pre> zstyle ’:completion:*:functions’ ignored-patterns ’_*’
344 <p>With helper functions like:</p>
346 <pre> xdvi() { command xdvi ${*:-*.dvi(om[1])} }
349 <p>you can avoid having to complete at all in many cases,
350 but if you do, you might want to fall into menu selection
351 immediately and to have the words sorted by time:</p>
353 <pre> zstyle ’:completion:*:*:xdvi:*’ menu yes select
354 zstyle ’:completion:*:*:xdvi:*’ file-sort time
357 <p>Completing process IDs with menu selection:</p>
359 <pre> zstyle ’:completion:*:*:kill:*’ menu yes select
360 zstyle ’:completion:*:kill:*’ force-list always
363 <p>If you end up using a directory as argument, this will
364 remove the trailing slash (usefull in ln)</p>
366 <pre> zstyle ’:completion:*’ squeeze-slashes true
369 <p>cd will never select the parent directory (e.g.: cd
372 <pre> zstyle ’:completion:*:cd:*’ ignore-parents parent pwd
378 <table width="100%" border=0 rules="none" frame="void"
379 cols="2" cellspacing="0" cellpadding="0">
380 <tr valign="top" align="left">
383 <p><b>ADVANCED GLOBBING</b></p></td>
386 <table width="100%" border=0 rules="none" frame="void"
387 cols="2" cellspacing="0" cellpadding="0">
388 <tr valign="top" align="left">
389 <td width="10%"></td>
391 <p>See <i>man zshexpn | less -p ’Glob
392 Qualifiers’</i></p>
394 <p>List file ’foobar’ via recursiv search in
400 <p>List files file20, file30, file100, etc:</p>
402 <pre> $ ls file<20->
405 <p>List files with suffix c and pro (e.g. foo.c,
411 <p>List files which are word-readable:</p>
416 <p>List all .c-files except ’lex.c’:</p>
421 <p>List all ‘README’ - files case-insensitive
422 with max. one typo (e.g. RADME, REEME, RAEDME):</p>
424 <pre> $ ls (#a1)README
427 <p>List files named README but accept one spelling error
428 including case-insensitive (e.g. RADME, REEME, RAEDME):</p>
430 <pre> $ ls (#ia1)README
433 <p>List executable files, directories and symlinks:</p>
438 <p>List dangling symlinks:</p>
443 <p>List all zero-length-files which are not group- or
446 <pre> $ ls *(L0f.go-w.)
449 <p>List all .c-files for which there doesn’t exist a
452 <pre> $ c=(*.c) o=(*.o(N)) eval ’ls ${${c:#(${~${(j:|:)${o:r}}}).c}:?done}’
455 <p>Find (and print) all symbolic links without a target
456 within the current dirtree:</p>
458 <pre> $ file **/*(D@) | fgrep broken
459 $ for i in **/*(D@); [[ -f $i || -d $i ]] || echo $i
460 $ echo **/*(@-^./=%p)
464 <p>Rename all MP3-files from name with spaces.mp3 to Name
467 <pre> $ for i in *.mp3; do
468 mv $i ${${(C)i}:s/Mp3/mp3/}
472 <p>Rename all PDF-files from name.mp3 to Name.mp3 (lowercase
473 to uppercase of first letter) without touching the rest of
476 <pre> $ zmv ’([a-z])(*).pdf’ ’${(C)1}$2.pdf’
479 <p>Substitutions in strings can be done by
482 <pre> $ a="doh.";a[1]=’d’;a[-1]=’. (Bart Simpson)’
487 <p>Associative arrays:</p>
489 <pre> $ typeset -A ass_array; ass_array=(one 1 two 2 three 3 four 4)
490 $ print ${(k)ass_array} # prints keys
492 $ print ${(v)ass_array} # prints values
494 $ print $ass_array[one]
498 <p>Extract parts of a string. Print first word of output of
499 ’date’:</p>
501 <pre> $ print ${$( date )[1]}
504 <p>Extract parts of a string. Print ip-address of loopback
507 <pre> $ print ${${$( LC_ALL=C /sbin/ifconfig lo )[6]}#addr:}
510 <p>Print specific line of a file. E.g. print line 5 of
513 <pre> $ print -l ${"$( < file )"[(f)5]}
516 <p>Print line containing string ’root’ of file
519 <pre> $ print ${"$( < /etc/passwd )"[(fr)*root*]}
522 <p>Print words two to four of output of
523 ’date’:</p>
525 <pre> $ print ${$( date )[2,4]}
528 <p>Use of two-dimensional indizes. Print time via date but
531 <pre> $ print ${$(date)[4][1,5]}
534 <p>Calculate floating point numbers:</p>
536 <pre> $ printf "%.0f0 $[ 2.8*15 ]
539 <p>Convert images from foo.gif to foo.png:</p>
541 <pre> $ for i in **/*.gif; convert $i $i:r.png
544 <p>Download files created with LaTeX2HTML (e.g. the
547 <pre> $ for f in http://zsh.sunsite.dk/Guide/zshguide{,{01..08}}.html; do
548 lynx -source $f >${f:t}
552 <p>Make with dpkg a master-list of everyfile that it has
555 <pre> $ diff <(find / | sort) <(cat /var/lib/dpkg/info/*.list | sort)
558 <p>Replace this color escape-sequences:</p>
560 <pre> $ autoload colors ; colors
561 $ print "$bg[cyan]$fg[blue]Welcome to man zsh-lovers" >> $TTY
564 <p>Get ASCII value of a character:</p>
566 <pre> $ char=N ; print $((#char))
569 <p>Filename suffix. Note: (N) activates setopt nullglob only
572 <pre> $ for i in *.o(N); do
577 <p>Rename files: ’FOO’ to ’foo’:</p>
579 <pre> $ for i in *(.); mv $i ${i:l}
582 <p>Rename files: ’bar’ to ’BAR’:</p>
584 <pre> $ for i in *(.); mv $i ${i:u}
587 <p>Show all suid-files in $PATH:</p>
589 <pre> $ ls -latg ${(s.:.)PATH} | grep ’^...s’
595 <table width="100%" border=0 rules="none" frame="void"
596 cols="2" cellspacing="0" cellpadding="0">
597 <tr valign="top" align="left">
600 <p><b>ZMV - multiple move with zsh</b></p></td>
603 <table width="100%" border=0 rules="none" frame="void"
604 cols="2" cellspacing="0" cellpadding="0">
605 <tr valign="top" align="left">
606 <td width="10%"></td>
608 <p>Requires ’autoload zmv’. Some examples:</p>
610 <p>Move serially all files (foo.foo > 1.foo, fnord.foo
614 1.c asd.foo bla.foo fnord.foo foo.fnord foo.foo
615 $ c=1 zmv ’*.foo’ ’$((c++)).foo’
617 1.c 1.foo 2.foo 3.foo 4.foo foo.fnord
620 <p>See above, but now only files with a filename >= 30
623 <pre> $ c=1 zmv "${(l:30-4::?:)}*.foo" ’$((c++)).foo’
626 <p>Replace spaces in filenames with a underline.</p>
628 <pre> $ zmv ’* *’ ’$f:gs/ /_’
631 <p>Change the suffix from *.sh to *.pl.</p>
633 <pre> $ zmv -W ’*.sh’ ’*.pl’
636 <p>Lowercase/uppercase all files and directories.</p>
638 <pre> $ zmv ’(*)’ ’${(L)1}’ for lowercase
639 $ zmv ’(*)’ ’${(U)1}’ for uppercase
642 <p>Remove the suffix *.c from all c-files.</p>
644 <pre> $ zmv ’(*).c’ ’$1’
647 <p>Uppercase only the first letter of all *.mp3 - files.</p>
649 <pre> $ zmv ’([a-z])(*).mp3’ ’${(C)1}$2.mp3’
652 <p>Copy the target ‘README’ in same directory as
653 each ‘Makefile’.</p>
655 <pre> $ zmv -C ’(**/)Makefile’ ’${1}README’
658 <p>Rename pic1.jpg, pic2.jpg,.. to pic0001.jpg,
661 <pre> $ zmv ’pic(*).jpg’ ’pic${(l:4::0:)1}.jpg’
662 $ zmv ’(**/)pic(*).jpg’ ’$1/pic${(l:4::0:)2}.jpg’ # recursive
668 <table width="100%" border=0 rules="none" frame="void"
669 cols="2" cellspacing="0" cellpadding="0">
670 <tr valign="top" align="left">
673 <p><b>MODULES</b></p></td>
676 <table width="100%" border=0 rules="none" frame="void"
677 cols="2" cellspacing="0" cellpadding="0">
678 <tr valign="top" align="left">
679 <td width="10%"></td>
681 <p>See also <i>man zshmodules</i>. Don’t forget to run
682 <i>zmodload −i MODULENAME</i> before using a module.
683 Example: <i>zmodload -i zsh/datetime</i>.</p>
687 <table width="100%" border=0 rules="none" frame="void"
688 cols="2" cellspacing="0" cellpadding="0">
689 <tr valign="top" align="left">
690 <td width="10%"></td>
692 <p><b>zsh/cap</b></p></td>
695 <table width="100%" border=0 rules="none" frame="void"
696 cols="2" cellspacing="0" cellpadding="0">
697 <tr valign="top" align="left">
698 <td width="21%"></td>
700 <p>Builtins for manipulating POSIX.1e (POSIX.6) capability
701 (privilege) sets.</p>
705 <table width="100%" border=0 rules="none" frame="void"
706 cols="2" cellspacing="0" cellpadding="0">
707 <tr valign="top" align="left">
708 <td width="10%"></td>
710 <p><b>zsh/clone</b></p></td>
713 <table width="100%" border=0 rules="none" frame="void"
714 cols="2" cellspacing="0" cellpadding="0">
715 <tr valign="top" align="left">
716 <td width="21%"></td>
718 <p>A builtin that can clone a running shell onto another
721 <p>Creates a forked instance of the current shell ($! is set
722 to zero) and execute ‘‘command’’ on
723 /dev/tty8 (for this example):</p>
725 <pre> $ zmodload zsh/clone
726 $ clone /dev/tty8 && (($! == 0)) && exec command
732 <table width="100%" border=0 rules="none" frame="void"
733 cols="2" cellspacing="0" cellpadding="0">
734 <tr valign="top" align="left">
735 <td width="10%"></td>
737 <p><b>zsh/compctl</b></p></td>
740 <table width="100%" border=0 rules="none" frame="void"
741 cols="2" cellspacing="0" cellpadding="0">
742 <tr valign="top" align="left">
743 <td width="21%"></td>
745 <p>The <b>compctl</b> builtin for controlling
750 <table width="100%" border=0 rules="none" frame="void"
751 cols="2" cellspacing="0" cellpadding="0">
752 <tr valign="top" align="left">
753 <td width="10%"></td>
755 <p><b>zsh/complete</b></p></td>
758 <table width="100%" border=0 rules="none" frame="void"
759 cols="2" cellspacing="0" cellpadding="0">
760 <tr valign="top" align="left">
761 <td width="21%"></td>
763 <p>The basic completion code.</p>
767 <table width="100%" border=0 rules="none" frame="void"
768 cols="2" cellspacing="0" cellpadding="0">
769 <tr valign="top" align="left">
770 <td width="10%"></td>
772 <p><b>zsh/complist</b></p></td>
775 <table width="100%" border=0 rules="none" frame="void"
776 cols="2" cellspacing="0" cellpadding="0">
777 <tr valign="top" align="left">
778 <td width="21%"></td>
780 <p>Completion listing extensions.</p>
784 <table width="100%" border=0 rules="none" frame="void"
785 cols="2" cellspacing="0" cellpadding="0">
786 <tr valign="top" align="left">
787 <td width="10%"></td>
789 <p><b>zsh/computil</b></p></td>
792 <table width="100%" border=0 rules="none" frame="void"
793 cols="2" cellspacing="0" cellpadding="0">
794 <tr valign="top" align="left">
795 <td width="21%"></td>
797 <p>A module with utility builtins needed for the shell
798 function based completion system.</p>
802 <table width="100%" border=0 rules="none" frame="void"
803 cols="2" cellspacing="0" cellpadding="0">
804 <tr valign="top" align="left">
805 <td width="10%"></td>
807 <p><b>zsh/datetime</b></p></td>
810 <table width="100%" border=0 rules="none" frame="void"
811 cols="2" cellspacing="0" cellpadding="0">
812 <tr valign="top" align="left">
813 <td width="21%"></td>
815 <p>Some date/time commands and parameters.</p>
817 <p>Do not have GNU date? Let’s replace it:</p>
819 <pre> $ alias datereplacement=’strftime "%Y-%m-%d" $EPOCHSECONDS’
820 $ export DATE=‘datereplacement‘
827 <table width="100%" border=0 rules="none" frame="void"
828 cols="2" cellspacing="0" cellpadding="0">
829 <tr valign="top" align="left">
830 <td width="10%"></td>
832 <p><b>zsh/deltochar</b></p></td>
835 <table width="100%" border=0 rules="none" frame="void"
836 cols="2" cellspacing="0" cellpadding="0">
837 <tr valign="top" align="left">
838 <td width="21%"></td>
840 <p>A ZLE function duplicating EMACS’
841 <b>zap−to−char</b>.</p>
845 <table width="100%" border=0 rules="none" frame="void"
846 cols="2" cellspacing="0" cellpadding="0">
847 <tr valign="top" align="left">
848 <td width="10%"></td>
850 <p><b>zsh/example</b></p></td>
853 <table width="100%" border=0 rules="none" frame="void"
854 cols="2" cellspacing="0" cellpadding="0">
855 <tr valign="top" align="left">
856 <td width="21%"></td>
858 <p>An example of how to write a module.</p>
862 <table width="100%" border=0 rules="none" frame="void"
863 cols="2" cellspacing="0" cellpadding="0">
864 <tr valign="top" align="left">
865 <td width="10%"></td>
867 <p><b>zsh/files</b></p></td>
870 <table width="100%" border=0 rules="none" frame="void"
871 cols="2" cellspacing="0" cellpadding="0">
872 <tr valign="top" align="left">
873 <td width="21%"></td>
875 <p>Some basic file manipulation commands as builtins.</p>
877 <pre># search a directory for files containing a certain string then copy those files to another directory.
878 $ IFS=$’ ’
879 $ cp $(grep -lZr foobar .) otherdirectory
885 <table width="100%" border=0 rules="none" frame="void"
886 cols="2" cellspacing="0" cellpadding="0">
887 <tr valign="top" align="left">
888 <td width="10%"></td>
890 <p><b>zsh/mapfile</b></p></td>
893 <table width="100%" border=0 rules="none" frame="void"
894 cols="2" cellspacing="0" cellpadding="0">
895 <tr valign="top" align="left">
896 <td width="21%"></td>
898 <p>Access to external files via a special associative
901 <pre># grepping for two patterns
902 $ pattern1="foo"
903 $ pattern2="bar foo"
904 $ print -l ./**/*(DN.e{’z=$mapfile[$REPLY] &&
905 [[ $z = *$pattern1* && $z = *$pattern2* ]]’})
906 # or a solution in combination with zsh/pcre
907 $ zmodload -i zsh/mapfile zsh/pcre
908 $ pattern1="foo"
909 $ pattern2="bar foo"
910 $ pcre_compile "(?s)(?=.*?$pattern1).*?$pattern2"
912 $ print -l ./**/*(DN.e{’pcre_match $mapfile[$REPLY]’})
914 # equivalent for ‘‘less /etc/passwd | grep -v root’’
916 $ print -rl -- ${${=mapfile[/etc/passwd]}:#*root*}
917 # or - for case insensitive
918 $ setopt extendedglob
919 $ print -rl -- ${${=mapfile[/etc/passwd]}:#*(#i)root*}
921 # If a XML-file contains stuff like ‘‘<TAGA/>’’ and ‘‘<TAGB/>’’, number this empty tags
922 # (ones ending in ’/>’) so if encountered in the same order, the preceeding tags would become
923 # ‘‘<TAGA/>1</TAGA>’’ and ‘‘<TAGB/>2</TAGB>’’
925 $ apfile[data.xml.new]=${(S)mapfile[data.xml]// > (#im)<TAGA>*<TAGA>/<TAGA>$((++cnt))<TAGA>}
927 # removing all files in users Maildir/new that contain ‘‘filename="gone.src’’
928 $ zmodload zsh/{files,mapfile}
929 $ rm -f /u1/??/*/Maildir/new/100*(.e{’[[ $mapfile[$REPLY] == *filename=
931 # Grep out the Title from a postscript file and append that value to the end of
934 $ zmv ’(*).ps’ ’$1-${${${mapfile[$f]##*%%Title: }%% *}//[^a-zA-Z0-9_]/}.ps’
940 <table width="100%" border=0 rules="none" frame="void"
941 cols="2" cellspacing="0" cellpadding="0">
942 <tr valign="top" align="left">
943 <td width="10%"></td>
945 <p><b>zsh/mathfunc</b></p></td>
948 <table width="100%" border=0 rules="none" frame="void"
949 cols="2" cellspacing="0" cellpadding="0">
950 <tr valign="top" align="left">
951 <td width="21%"></td>
953 <p>Standard scientific functions for use in mathematical
956 <pre>$ echo $(( sin(1/4.0)**2 + cos(1/4.0)**2 - 1 ))
957 -1.1102230246251565e-16
958 $ echo $(( pi = 4.0 * atan(1.0) ))
960 $ echo $(( f = sin(0.3) ))
962 $ print $(( rand48(seed) ))
969 <table width="100%" border=0 rules="none" frame="void"
970 cols="2" cellspacing="0" cellpadding="0">
971 <tr valign="top" align="left">
972 <td width="10%"></td>
974 <p><b>zsh/parameter</b></p></td>
977 <table width="100%" border=0 rules="none" frame="void"
978 cols="2" cellspacing="0" cellpadding="0">
979 <tr valign="top" align="left">
980 <td width="21%"></td>
982 <p>Access to internal hash tables via special associative
987 <table width="100%" border=0 rules="none" frame="void"
988 cols="2" cellspacing="0" cellpadding="0">
989 <tr valign="top" align="left">
990 <td width="10%"></td>
992 <p><b>zsh/pcre</b></p></td>
995 <table width="100%" border=0 rules="none" frame="void"
996 cols="2" cellspacing="0" cellpadding="0">
997 <tr valign="top" align="left">
998 <td width="21%"></td>
1000 <p>Interface to the PCRE library.</p>
1001 <!-- INDENTATION -->
1002 <p>Important: requires zsh compiled with pcre-support. Check
1003 whether your version supports pcre via ‘ldd =zsh |
1004 grep pcre‘. PCRE provides support for Perl’s
1005 regular expressions (regex). You have to compile a regex and
1006 can match it afterwards using error codes:</p>
1007 <!-- INDENTATION -->
1008 <pre> $ zmodload zsh/pcre
1009 $ pcre_compile ’\s\d.\d{3}.\d{3} Euro’ &&\
1010 pcre_match ’ 1.000.000 Euro’ &&\
1011 echo "matches" || echo "does not match"
1013 <!-- INDENTATION -->
1014 <p>Note: if you are using complex regular expressions you
1015 can improve speed via pcre_study.</p>
1018 <!-- INDENTATION -->
1019 <table width="100%" border=0 rules="none" frame="void"
1020 cols="2" cellspacing="0" cellpadding="0">
1021 <tr valign="top" align="left">
1022 <td width="10%"></td>
1024 <p><b>zsh/sched</b></p></td>
1026 <!-- INDENTATION -->
1027 <table width="100%" border=0 rules="none" frame="void"
1028 cols="2" cellspacing="0" cellpadding="0">
1029 <tr valign="top" align="left">
1030 <td width="21%"></td>
1032 <p>A builtin that provides a timed execution facility within
1036 <!-- INDENTATION -->
1037 <table width="100%" border=0 rules="none" frame="void"
1038 cols="2" cellspacing="0" cellpadding="0">
1039 <tr valign="top" align="left">
1040 <td width="10%"></td>
1042 <p><b>zsh/net/socket</b></p></td>
1044 <!-- INDENTATION -->
1045 <table width="100%" border=0 rules="none" frame="void"
1046 cols="2" cellspacing="0" cellpadding="0">
1047 <tr valign="top" align="left">
1048 <td width="21%"></td>
1050 <p>Manipulation of Unix domain sockets $ zmodload
1051 zsh/net/socket $ zsocket -l -d 3 #
1052 ‘‘-l’’: open a socket listening on
1053 filename # ‘‘-d’’: argument will be
1054 taken as the target file descriptor for the # connection #
1055 ‘‘3’’ : file descriptor. See
1056 ‘‘A User’s Guide to the
1057 Z-Shell’’ # (3.7.2: File descriptors) $ zsocket
1058 -a -d 4 3 # ‘‘-a’’: accept an
1059 incoming connection to the socket $ zsocket -a -d 5 3 #
1060 accept a connection $ echo foobar >&4 $ echo barfoo
1061 >&5 $ 4>&- 5>&- 3>&-</p>
1062 <!-- INDENTATION -->
1063 <p>In one shell:</p>
1064 <!-- INDENTATION -->
1065 <pre> $ zmodload zsh/net/socket
1066 $ zsocket -l -d 3 /tmp/mysocket # open listening socket
1067 $ zsocket -a -d 4 3 # accept a connection
1068 $ zsocket -a -d 5 3 # accept a connection
1069 $ echo Hi there >&4
1070 $ echo Hi there also >&5
1071 $ exec 4>&- 5>&- 3>&-
1073 <!-- INDENTATION -->
1074 <p>In another shell:</p>
1075 <!-- INDENTATION -->
1076 <pre> $ zmodload zsh/net/socket
1077 $ zsocket -d 3 /tmp/mysocket # connect to /tmp/socket
1078 $ zsocket -d 4 /tmp/mysocket # connect to /tmp/socket
1079 $ read msg <&3; echo got: "$msg on fd 3"
1080 $ read msg <&4; echo got: "$msg on fd 4"
1081 $ exec 3>&- 4>&-
1085 <!-- INDENTATION -->
1087 <table width="100%" border=0 rules="none" frame="void"
1088 cols="2" cellspacing="0" cellpadding="0">
1089 <tr valign="top" align="left">
1090 <td width="10%"></td>
1092 <p><b>zsh/stat</b></p></td>
1094 <!-- INDENTATION -->
1095 <table width="100%" border=0 rules="none" frame="void"
1096 cols="2" cellspacing="0" cellpadding="0">
1097 <tr valign="top" align="left">
1098 <td width="21%"></td>
1100 <p>A builtin command interface to the <b>stat</b> system
1102 <!-- INDENTATION -->
1103 <p>Get size of a file in bytes:</p>
1104 <!-- INDENTATION -->
1105 <pre> $ zmodload -i zsh/stat
1106 $ stat -L +size file
1108 <!-- INDENTATION -->
1109 <p>Equal to GNU’s:</p>
1110 <!-- INDENTATION -->
1111 <pre> $ stat -c %s file
1113 <!-- INDENTATION -->
1114 <p>Comparing file dates:</p>
1115 <!-- INDENTATION -->
1118 $ touch bar & sleep 5 & touch foo
1119 $ echo $file1 is $(( $(stat +mtime $file2) - $(stat +mtime $file1) )) seconds older than $file2.
1120 bar is 5 seconds older than foo
1122 <!-- INDENTATION -->
1123 <p>List the files of a disk smaller than some other
1125 <!-- INDENTATION -->
1126 <pre> $ stat -A max +size some-other-file
1127 $ print -rl ./**/*(D.L-$max)
1129 <!-- INDENTATION -->
1130 <p>List the top 100 biggest files in a disk:</p>
1131 <!-- INDENTATION -->
1132 <pre> $ ls -fld ./**/*(d‘stat +device .‘OL[1,100])
1134 <!-- INDENTATION -->
1135 <p>Get only the user name and the file names from (like ls
1136 -l * | awk ’{print $3" " $8}’):</p>
1137 <!-- INDENTATION -->
1138 <pre> $ for file; do
1139 > stat -sA user +uid -- "$file" &&
1140 > print -r -- "$user" "$file"
1143 <!-- INDENTATION -->
1144 <p>Get the difference between actual bytes of file and
1145 allocated bytes of file:</p>
1146 <!-- INDENTATION -->
1147 <pre> $ print $(($(stat +block -- file) * 512 - $(stat +size -- file)))
1149 <!-- INDENTATION -->
1150 <p>Find largest file:</p>
1151 <!-- INDENTATION -->
1152 <pre> $ stat +size ./*(DOL[1])
1153 # ‘‘D’’ : to include dot files (d lowercase is for device)
1154 # ‘‘O’’ : reverse Ordered (o lowercase for non-reverse order)
1155 # ‘‘L’’ : by file Length (l is for number of links)
1156 # ‘‘[1]’’: return only first one
1158 <!-- INDENTATION -->
1159 <p>Delete files in a directory that hasn’t been
1160 accessed in the last ten days and send ONE mail to the owner
1161 of the files informing him/her of the files’
1163 <!-- INDENTATION -->
1164 <pre> $ zmodload zsh/stat zsh/files
1165 $ typeset -A f; f=()
1166 $ rm -f /path/**/*(.a+10e{’stat -sA u +uidr $REPLY; f[$u]="$f[$u]$REPLY"’})
1167 $ for user (${(k)f}) {print -rn $f[$user]|mailx -s "..." $user}
1169 <!-- INDENTATION -->
1170 <p>Get a "ls -l" on all the files in the tree that
1171 are younger than a specified age:</p>
1172 <!-- INDENTATION -->
1173 <pre> $ for d (. ./**/*(N/m-2))
1174 > print -r -- $’0$d: && cd $d && {
1175 > for f (*(Nm-2om))
1176 > stat -F ’%b %d %H:%M’ -LsAs -- $f &&
1177 > print -r -- $s[3] ${(l:4:)s[4]} ${(l:8:)s[5]} \
1178 > ${(l:8:)s[6]} ${(l:8:)s[8]} $s[10] $f ${s[14]:+-> $s[14]}
1182 <!-- INDENTATION -->
1183 <p>Get file creation date:</p>
1184 <!-- INDENTATION -->
1185 <pre> $ stat -F ’%d %m %Y’ +mtime ~/.zshrc
1187 $ stat -F ’%D’ +mtime ~/.zshrc
1192 <!-- INDENTATION -->
1194 <table width="100%" border=0 rules="none" frame="void"
1195 cols="2" cellspacing="0" cellpadding="0">
1196 <tr valign="top" align="left">
1197 <td width="10%"></td>
1199 <p><b>zsh/system</b></p></td>
1201 <!-- INDENTATION -->
1202 <table width="100%" border=0 rules="none" frame="void"
1203 cols="2" cellspacing="0" cellpadding="0">
1204 <tr valign="top" align="left">
1205 <td width="21%"></td>
1207 <p>A builtin interface to various low−level system
1211 <!-- INDENTATION -->
1212 <table width="100%" border=0 rules="none" frame="void"
1213 cols="2" cellspacing="0" cellpadding="0">
1214 <tr valign="top" align="left">
1215 <td width="10%"></td>
1217 <p><b>zsh/net/tcp</b></p></td>
1219 <!-- INDENTATION -->
1220 <table width="100%" border=0 rules="none" frame="void"
1221 cols="2" cellspacing="0" cellpadding="0">
1222 <tr valign="top" align="left">
1223 <td width="21%"></td>
1225 <p>Manipulation of TCP sockets</p>
1228 <!-- INDENTATION -->
1229 <table width="100%" border=0 rules="none" frame="void"
1230 cols="2" cellspacing="0" cellpadding="0">
1231 <tr valign="top" align="left">
1232 <td width="10%"></td>
1234 <p><b>zsh/termcap</b></p></td>
1236 <!-- INDENTATION -->
1237 <table width="100%" border=0 rules="none" frame="void"
1238 cols="2" cellspacing="0" cellpadding="0">
1239 <tr valign="top" align="left">
1240 <td width="21%"></td>
1242 <p>Interface to the termcap database.</p>
1243 <!-- INDENTATION -->
1244 <pre> $ zmodload -ab zsh/termcap echotc
1245 $ GREEN=‘echotc AF 2‘
1246 $ YELLOW=‘echotc AF 3‘
1247 $ RED=‘echotc AF 1‘
1248 $ BRIGHTRED=‘echotc md ; echotc AF 1‘
1249 $ print -l ${GREEN}green ${YELLOW}yellow ${RED}red ${BRIGHTRED}brightred
1253 <!-- INDENTATION -->
1255 <table width="100%" border=0 rules="none" frame="void"
1256 cols="2" cellspacing="0" cellpadding="0">
1257 <tr valign="top" align="left">
1258 <td width="10%"></td>
1260 <p><b>zsh/terminfo</b></p></td>
1262 <!-- INDENTATION -->
1263 <table width="100%" border=0 rules="none" frame="void"
1264 cols="2" cellspacing="0" cellpadding="0">
1265 <tr valign="top" align="left">
1266 <td width="21%"></td>
1268 <p>Interface to the terminfo database.</p>
1271 <!-- INDENTATION -->
1272 <table width="100%" border=0 rules="none" frame="void"
1273 cols="2" cellspacing="0" cellpadding="0">
1274 <tr valign="top" align="left">
1275 <td width="10%"></td>
1277 <p><b>zsh/zftp</b></p></td>
1279 <!-- INDENTATION -->
1280 <table width="100%" border=0 rules="none" frame="void"
1281 cols="2" cellspacing="0" cellpadding="0">
1282 <tr valign="top" align="left">
1283 <td width="21%"></td>
1285 <p>A builtin FTP client.</p>
1286 <!-- INDENTATION -->
1287 <p>Write ftp scripts as though shell:</p>
1288 <!-- INDENTATION -->
1290 $ autoload -U zfinit && zfinit
1291 $ zfparams www.example.invalid myuserid mypassword
1294 $ zfls -l zsh-lovers.html
1295 $ zfput zsh-lovers.html
1296 $ zfls -l zsh-lovers.html
1298 <!-- INDENTATION -->
1299 <p>Automatically transfer files using FTP with error
1301 <!-- INDENTATION -->
1302 <pre> $ zftp open host.name.invalid user passwd || exit
1303 $ zftp get /remote/file > /local/file; r=$?
1304 $ zftp close && exit r
1306 <!-- INDENTATION -->
1307 <p>Compress and ftp on the fly:</p>
1308 <!-- INDENTATION -->
1309 <pre> $ zftp open host.name.invalid user password
1310 $ zftp get $file | bzip2 > ${file}.bz2
1313 <!-- INDENTATION -->
1314 <p>Long list of files on a ftp:</p>
1315 <!-- INDENTATION -->
1316 <pre> $ autoload -U zfinit
1319 $ zfcd /some/remote/Dir
1320 $ cd /some/local/Dir
1322 <!-- INDENTATION -->
1323 <p>If the list.txt is located on the remote host, change to
1324 $ zfget ${(f)"$(zftp get
1325 /path/to/remote/list.txt)"} $ zfget ${(f)"$(cat
1326 list.txt)"} $ zfclose</p>
1329 <!-- INDENTATION -->
1330 <table width="100%" border=0 rules="none" frame="void"
1331 cols="2" cellspacing="0" cellpadding="0">
1332 <tr valign="top" align="left">
1333 <td width="10%"></td>
1335 <p><b>zsh/zle</b></p></td>
1337 <!-- INDENTATION -->
1338 <table width="100%" border=0 rules="none" frame="void"
1339 cols="2" cellspacing="0" cellpadding="0">
1340 <tr valign="top" align="left">
1341 <td width="21%"></td>
1343 <p>The Zsh Line Editor, including the <b>bindkey</b> and
1344 <b>vared</b> builtins.</p>
1347 <!-- INDENTATION -->
1348 <table width="100%" border=0 rules="none" frame="void"
1349 cols="2" cellspacing="0" cellpadding="0">
1350 <tr valign="top" align="left">
1351 <td width="10%"></td>
1353 <p><b>zsh/zleparameter</b></p></td>
1355 <!-- INDENTATION -->
1356 <table width="100%" border=0 rules="none" frame="void"
1357 cols="2" cellspacing="0" cellpadding="0">
1358 <tr valign="top" align="left">
1359 <td width="21%"></td>
1361 <p>Access to internals of the Zsh Line Editor via
1365 <!-- INDENTATION -->
1366 <table width="100%" border=0 rules="none" frame="void"
1367 cols="2" cellspacing="0" cellpadding="0">
1368 <tr valign="top" align="left">
1369 <td width="10%"></td>
1371 <p><b>zsh/zprof</b></p></td>
1373 <!-- INDENTATION -->
1374 <table width="100%" border=0 rules="none" frame="void"
1375 cols="2" cellspacing="0" cellpadding="0">
1376 <tr valign="top" align="left">
1377 <td width="21%"></td>
1379 <p>A module allowing profiling for shell functions.</p>
1382 <!-- INDENTATION -->
1383 <table width="100%" border=0 rules="none" frame="void"
1384 cols="2" cellspacing="0" cellpadding="0">
1385 <tr valign="top" align="left">
1386 <td width="10%"></td>
1388 <p><b>zsh/zpty</b></p></td>
1390 <!-- INDENTATION -->
1391 <table width="100%" border=0 rules="none" frame="void"
1392 cols="2" cellspacing="0" cellpadding="0">
1393 <tr valign="top" align="left">
1394 <td width="21%"></td>
1396 <p>A builtin for starting a command in a
1397 pseudo−terminal.</p>
1398 <!-- INDENTATION -->
1399 <pre> $ zmodload -i zsh/zpty
1401 # ‘‘-r’’: read the output of the command name.
1402 # ‘‘z’’ : Parameter
1403 $ zpty -r PW z ’*password:’
1404 # send the to command name the given strings as input
1406 $ zpty -r PW z ’*password:’
1408 # | The second form, with the -d option, is used to delete commands
1409 # | previously started, by supplying a list of their names. If no names
1410 # | are given, all commands are deleted. Deleting a command causes the HUP
1411 # | signal to be sent to the corresponding process.
1416 <!-- INDENTATION -->
1418 <table width="100%" border=0 rules="none" frame="void"
1419 cols="2" cellspacing="0" cellpadding="0">
1420 <tr valign="top" align="left">
1421 <td width="10%"></td>
1423 <p><b>zsh/zselect</b></p></td>
1425 <!-- INDENTATION -->
1426 <table width="100%" border=0 rules="none" frame="void"
1427 cols="2" cellspacing="0" cellpadding="0">
1428 <tr valign="top" align="left">
1429 <td width="21%"></td>
1431 <p>Block and return when file descriptors are ready.</p>
1432 <!-- INDENTATION -->
1433 <pre># It’s simular to
1436 | $ stty -icanon min 0 time 50
1438 | $ stty "$sg"
1439 | $ case "$yesno" in
1440 | > yes) command1;;
1441 | > *) command2;;
1444 $ if zselect -t 500 -r 0 && read yesno && [ yes = "$yesno" ]; then
1452 <!-- INDENTATION -->
1454 <table width="100%" border=0 rules="none" frame="void"
1455 cols="2" cellspacing="0" cellpadding="0">
1456 <tr valign="top" align="left">
1457 <td width="10%"></td>
1459 <p><b>zsh/zutil</b></p></td>
1461 <!-- INDENTATION -->
1462 <table width="100%" border=0 rules="none" frame="void"
1463 cols="2" cellspacing="0" cellpadding="0">
1464 <tr valign="top" align="left">
1465 <td width="21%"></td>
1467 <p>Some utility builtins, e.g. the one for supporting
1468 configuration via styles.</p></td>
1470 <!-- INDENTATION -->
1471 <table width="100%" border=0 rules="none" frame="void"
1472 cols="2" cellspacing="0" cellpadding="0">
1473 <tr valign="top" align="left">
1474 <td width="4%"></td>
1476 <p><b>SUBSTITUTION</b></p></td>
1478 <!-- INDENTATION -->
1479 <table width="100%" border=0 rules="none" frame="void"
1480 cols="2" cellspacing="0" cellpadding="0">
1481 <tr valign="top" align="left">
1482 <td width="10%"></td>
1484 <p>Path substitution:</p>
1485 <!-- INDENTATION -->
1486 <pre> $ ls -l =zsh # is like: ’ls -l /path/to/zsh’ or ’ls -l ‘which zsh‘’
1488 <!-- INDENTATION -->
1489 <p>Process substitution:</p>
1490 <!-- INDENTATION -->
1491 <pre> $ (vi =(cmd)) # edit output of ’cmd’ (called process substitution).
1493 <!-- INDENTATION -->
1494 <p>Substitution of variables:</p>
1495 <!-- INDENTATION -->
1509 <!-- INDENTATION -->
1511 <table width="100%" border=0 rules="none" frame="void"
1512 cols="2" cellspacing="0" cellpadding="0">
1513 <tr valign="top" align="left">
1514 <td width="4%"></td>
1516 <p><b>ALIASES</b></p></td>
1518 <!-- INDENTATION -->
1519 <table width="100%" border=0 rules="none" frame="void"
1520 cols="2" cellspacing="0" cellpadding="0">
1521 <tr valign="top" align="left">
1522 <td width="10%"></td>
1524 <p>Suffix aliases are supported in zsh since version 4.2.0.
1526 <!-- INDENTATION -->
1527 <pre> alias -s tex=vim
1533 <!-- INDENTATION -->
1535 <table width="100%" border=0 rules="none" frame="void"
1536 cols="2" cellspacing="0" cellpadding="0">
1537 <tr valign="top" align="left">
1538 <td width="20%"></td>
1540 <p>Now pressing return-key after entering
1541 ’foobar.vim’ starts vim with foobar.vim. Calling
1542 a html-file runs browser w3m. ’www.zsh.org’ and
1543 pressing enter starts w3m with argument
1544 www.zsh.org.</p></td>
1546 <!-- INDENTATION -->
1547 <table width="100%" border=0 rules="none" frame="void"
1548 cols="2" cellspacing="0" cellpadding="0">
1549 <tr valign="top" align="left">
1550 <td width="10%"></td>
1552 <p>Global aliases can be used anywhere in the command line.
1554 <!-- INDENTATION -->
1555 <pre> $ alias -g C=’| wc -l’
1556 $ grep alias ~/.zsh/* C
1559 <!-- INDENTATION -->
1560 <p>Some more or less useful global aliases (choose whether
1561 they are useful or not for you on your own):</p>
1562 <!-- INDENTATION -->
1563 <pre> alias -g ...=’../..’
1564 alias -g ....=’../../..’
1565 alias -g .....=’../../../..’
1566 alias -g CA="2>&1 | cat -A"
1567 alias -g C=’| wc -l’
1568 alias -g D="DISPLAY=:0.0"
1569 alias -g DN=/dev/null
1570 alias -g ED="export DISPLAY=:0.0"
1571 alias -g EG=’|& egrep’
1572 alias -g EH=’|& head’
1573 alias -g EL=’|& less’
1574 alias -g ELS=’|& less -S’
1575 alias -g ETL=’|& tail -20’
1576 alias -g ET=’|& tail’
1577 alias -g F=’ | fmt -’
1578 alias -g G=’| egrep’
1579 alias -g H=’| head’
1580 alias -g HL=’|& head -20’
1581 alias -g §k="*~(*.bz2|*.gz|*.tgz|*.zip|*.z)"
1582 alias -g LL="2>&1 | less"
1583 alias -g L="| less"
1584 alias -g LS=’| less -S’
1585 alias -g MM=’| most’
1586 alias -g M=’| more’
1587 alias -g NE="2> /dev/null"
1588 alias -g NS=’| sort -n’
1589 alias -g NUL="> /dev/null 2>&1"
1590 alias -g PIPE=’|’
1591 alias -g R=’ > /c/aaa/tee.txt ’
1592 alias -g RNS=’| sort -nr’
1593 alias -g S=’| sort’
1594 alias -g TL=’| tail -20’
1595 alias -g T=’| tail’
1596 alias -g US=’| sort -u’
1597 alias -g VM=/var/log/messages
1598 alias -g X0G=’| xargs -0 egrep’
1599 alias -g X0=’| xargs -0’
1600 alias -g XG=’| xargs egrep’
1601 alias -g X=’| xargs’
1603 <!-- INDENTATION -->
1604 <p>Array parameters [array_name=(value1 value2 ...
1606 <!-- INDENTATION -->
1607 <pre> $ stupid=emacs
1614 <!-- INDENTATION -->
1616 <table width="100%" border=0 rules="none" frame="void"
1617 cols="2" cellspacing="0" cellpadding="0">
1618 <tr valign="top" align="left">
1619 <td width="4%"></td>
1621 <p><b>SHELL-SCRIPTING</b></p></td>
1623 <!-- INDENTATION -->
1624 <table width="100%" border=0 rules="none" frame="void"
1625 cols="2" cellspacing="0" cellpadding="0">
1626 <tr valign="top" align="left">
1627 <td width="10%"></td>
1629 <p>This section provides some examples for often needed
1630 shellscript-stuff. Notice that you should not use otherwise
1631 most examples won’t work.</p>
1632 <!-- INDENTATION -->
1633 <p>Parse options in shellscripts. Example taken from ZWS by
1635 (http://www.chodorowski.com/projects/zws/):</p>
1636 <!-- INDENTATION -->
1637 <pre>parse_options()
1643 zparseopts -K -- p:=o_port r:=o_root h=o_help
1644 if [[ $? != 0 || "$o_help" != "" ]]; then
1645 echo Usage: $(basename "$0") "[-p PORT] [-r DIRECTORY]"
1653 if [[ $root[1] != ’/’ ]]; then root="$PWD/$root"; fi
1655 # now use the function:
1660 <!-- INDENTATION -->
1662 <table width="100%" border=0 rules="none" frame="void"
1663 cols="2" cellspacing="0" cellpadding="0">
1664 <tr valign="top" align="left">
1665 <td width="4%"></td>
1667 <p><b>MISC−EXAMPLES</b></p></td>
1669 <!-- INDENTATION -->
1670 <table width="100%" border=0 rules="none" frame="void"
1671 cols="2" cellspacing="0" cellpadding="0">
1672 <tr valign="top" align="left">
1673 <td width="10%"></td>
1675 <p>Hint: A list of valid glob Qualifiers can be found in
1676 zshexpn(1). See ‘‘man 1 zshexpn | less
1677 -p’’ Qualifiers for details.</p>
1678 <!-- INDENTATION -->
1679 <p>Load all available modules at startup</p>
1680 <!-- INDENTATION -->
1681 <pre> $ typeset -U m
1683 $ for md ($module_path) m=($m $md/**/*(*e:’REPLY=${REPLY#$md/}’::r))
1686 <!-- INDENTATION -->
1687 <p>Rename all MP3-Files from ‘‘name with
1688 spaces.mp3’’ to ‘‘Name With
1689 Spaces.mp3’’:</p>
1690 <!-- INDENTATION -->
1691 <pre> $ for i in *.mp3; do
1692 > mv $i ${${(C)i}:s/Mp3/mp3/}
1695 <!-- INDENTATION -->
1696 <p>Download with LaTeX2HTML created Files (for example the
1697 ZSH−Guide):</p>
1698 <!-- INDENTATION -->
1699 <pre> $ for f in http://zsh.sunsite.dk/Guide/zshguide{,{01..08}}.html; do
1700 > lynx -source $f >${f:t}
1703 <!-- INDENTATION -->
1704 <p>Replace the unreadable Escape-Sequences:</p>
1705 <!-- INDENTATION -->
1706 <pre> $ autoload colors ; colors
1707 $ print "$bg[cyan]$fg[blue]You are an zsh user" >> /dev/pts/3
1709 <!-- INDENTATION -->
1710 <p>Filename−Expansion. <b>Note:</b> (N) activates
1711 setopt nullglob only for this loop.</p>
1712 <!-- INDENTATION -->
1713 <pre> $ for i in *.o(N); do
1717 <!-- INDENTATION -->
1718 <p>Re-linking broken links:</p>
1719 <!-- INDENTATION -->
1720 <pre> $ for f in ./**/*(-@); do
1721 > stat +link -A l $f
1722 > (cd $f:h & [[ -e $l.gz ]]) & ln -sf $l.gz $f
1725 <!-- INDENTATION -->
1726 <p>Show me all the .c files for which there doesn’t
1727 exist a .o file:</p>
1728 <!-- INDENTATION -->
1729 <pre> $ c=(*.c) o=(*.o(N)) eval ’ls ${${c:#(${~${(j:|:)${o:r}}}).c}:?done}’
1731 <!-- INDENTATION -->
1732 <p>Load all available modules at startup:</p>
1733 <!-- INDENTATION -->
1734 <pre> $ typeset -U m
1736 $ for md ($module_path) m=($m $md/**/*(*e:’REPLY=${REPLY#$md/}’::r))
1739 <!-- INDENTATION -->
1740 <p>Rename all files within a directory such that their names
1741 get a numeral prefix in the default sort order:</p>
1742 <!-- INDENTATION -->
1743 <pre> $ i=1; for j in *; do mv $j $i.$j; ((i++)); done
1744 $ i=1; for f in *; do mv $f $(echo $i| awk ’{ printf("%03d", $0)}’).$f; ((i++)); done
1745 $ integer i=0; for f in *; do mv $f $[i+=1].$f; done
1747 <!-- INDENTATION -->
1748 <p>Find (and print) all symbolic links without a target
1749 within the current dirtree:</p>
1750 <!-- INDENTATION -->
1751 <pre> $ $ file **/*(D@) | fgrep broken
1752 $ for i in **/*(D@); [[ -f $i || -d $i ]] || echo $i
1753 $ echo **/*(@-^./=%p)
1756 <!-- INDENTATION -->
1757 <p>List all plain files that do not have extensions listed
1758 in ‘fignore’:</p>
1759 <!-- INDENTATION -->
1760 <pre> $ ls **/*~*(${~${(j/|/)fignore}})(.)
1761 # see above, but now omit executables
1762 $ ls **/*~*(${~${(j/|/)fignore}})(.^*)
1764 <!-- INDENTATION -->
1765 <p>Print out files that dont have extensions (require setopt
1766 extendedglob dotglob):</p>
1767 <!-- INDENTATION -->
1768 <pre> $ printf ’%s0 ^?*.*
1770 <!-- INDENTATION -->
1771 <p>List files in reverse order sorted by name:</p>
1772 <!-- INDENTATION -->
1773 <pre> $ print -rl -- *(On)
1775 $ print -rl -- *(^on)
1777 <!-- INDENTATION -->
1778 <p>Synonymic to ‘‘ps ax | awk ’{print
1779 $1}’’’:</p>
1780 <!-- INDENTATION -->
1781 <pre> $ print -l /proc/*/cwd(:h:t:s/self//)
1783 <!-- INDENTATION -->
1784 <p>Get the PID of a process (without
1785 ‘‘ps’’,
1786 ‘‘sed’’,
1787 ‘‘pgrep’’, .. (under Linux):</p>
1788 <!-- INDENTATION -->
1791 > for i in /proc/<->/stat
1793 > [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t
1797 <!-- INDENTATION -->
1798 <p>for X in ’n’ ’o’ ’p’
1799 ’q’ ’r’ ’s’
1800 ’t’ ’u’ ’v’
1801 ’w’ ’x’ ’y’; do ...:</p>
1802 <!-- INDENTATION -->
1803 <pre> $ for (( i = 36#n; i <= 36#y; i++ )); do
1804 > print ${$(([##36]i)):l}
1806 # or in combination with ‘‘dc’’
1807 $ print {$((##n))..$((##y))}P 10P | dc
1808 # or with ‘‘eval’’
1809 $ eval print ’${$(([##36]’{$((36#n))..$((36#y))}’)):l}’
1811 <!-- INDENTATION -->
1812 <p>Foreach in one line of shell:</p>
1813 <!-- INDENTATION -->
1814 <pre> $ for f (*) print -r -- $f
1816 <!-- INDENTATION -->
1817 <p>Copy a directory recursively without data/files:</p>
1818 <!-- INDENTATION -->
1819 <pre> $ dirs=(**/*(/))
1823 $ find . -type d -exec env d="$dest_root" sh -c ’ exec mkdir -p -- "$d/$1"’ ’{}’ ’{}’ ;
1825 <!-- INDENTATION -->
1826 <p>If ‘foo=23’’, then print with 10 digit
1827 with leading ’0’:</p>
1828 <!-- INDENTATION -->
1830 $ print ${(r:10::0:)foo}
1832 <!-- INDENTATION -->
1833 <p>Find the name of all the files in their home directory
1834 that have more than 20 characters in their file names:</p>
1835 <!-- INDENTATION -->
1836 <pre> print -rl $HOME/${(l:20::?:)~:-}*
1838 <!-- INDENTATION -->
1840 <!-- INDENTATION -->
1841 <pre> $ print -r -- ${(qq)m} > $nameoffile # save it
1842 $ eval "m=($(cat -- $nameoffile)" # or use
1843 $ m=("${(@Q)${(z)"$(cat -- $nameoffile)"}}") # to restore it
1845 <!-- INDENTATION -->
1846 <p>Get a "ls -l" on all the files in the tree that
1847 are younger than a specified age (e.g "ls -l" all
1848 the files in the tree that where modified in the last 2
1850 <!-- INDENTATION -->
1851 <pre> $ ls -tld **/*(m-2)
1853 <!-- INDENTATION -->
1854 <p>This will give you a listing 1 file perl line (not
1855 à la ls -R). Think of an easy way to have a "ls
1856 -R" style output with only files newer than 2 day
1858 <!-- INDENTATION -->
1859 <pre> $ for d (. ./**/*(/)) {
1860 > print -r -- $’0${d}:
1861 > cd $d && {
1863 > (($#l)) && ls -ltd -- $l
1868 <!-- INDENTATION -->
1869 <p>If you also want directories to be included even if their
1870 mtime is more than 2 days old:</p>
1871 <!-- INDENTATION -->
1872 <pre> $ for d (. ./**/*(/)) {
1873 > print -r -- $’0${d}:
1874 > cd $d && {
1876 > (($#l)) && ls -ltd -- $l
1881 <!-- INDENTATION -->
1882 <p>And if you want only the directories with mtime < 2
1883 days to be listed:</p>
1884 <!-- INDENTATION -->
1885 <pre> $ for d (. ./**/*(N/m-2)) {
1886 > print -r -- $’0${d}:
1887 > cd $d && {
1889 > (($#l)) && ls -ltd -- $l
1894 <!-- INDENTATION -->
1895 <p>Print 42 ‘‘-’’:</p>
1896 <!-- INDENTATION -->
1897 <pre> $ echo ${(l:42::-:)}
1898 # or use ‘‘$COLUMS’’
1899 $ echo ${(l:$COLUMNS::-:)}
1900 # and now with colors (require autoload colors ;colors)
1901 $ echo "$bg[red]$fg[black]${(l:42::-:)}"
1903 <!-- INDENTATION -->
1904 <p>Redirect STDERR to a command like xless without
1905 redirecting STDOUT as well:</p>
1906 <!-- INDENTATION -->
1907 <pre> $ foo 2>>(xless)
1908 # but this executes the command asynchronously. To do it synchronously:
1909 $ { { foo 1>&3 } 2>&1 | xless } 3>&1
1911 <!-- INDENTATION -->
1912 <p>Rename all MP3-Files from name with spaces.mp3 to Name
1913 With Spaces.mp3:</p>
1914 <!-- INDENTATION -->
1915 <pre> $ for i in *.mp3; do
1916 > mv $i ${${(C)i}:s/Mp3/mp3/}
1919 <!-- INDENTATION -->
1920 <p>Match file names containing only digits and ending with
1921 .xml (requiresetopt kshglob):</p>
1922 <!-- INDENTATION -->
1923 <pre> $ ls -l [0-9]##.xml
1924 $ ls -l <0->.xml
1926 <!-- INDENTATION -->
1927 <p>Remove all "non txt" files:</p>
1928 <!-- INDENTATION -->
1931 <!-- INDENTATION -->
1932 <p>Move 200 files from a directory into another:</p>
1933 <!-- INDENTATION -->
1934 <pre> $ mv -- *([1,200]) /another/Dir
1936 <!-- INDENTATION -->
1937 <p>Convert images (foo.gif => foo.png):</p>
1938 <!-- INDENTATION -->
1939 <pre> $ for i in **/*.gif; convert $i $i:r.png
1941 <!-- INDENTATION -->
1942 <p>Convert a collection of mp3 files to wave or cdr (e.g.
1943 file.wav -> file.mp3):</p>
1944 <!-- INDENTATION -->
1945 <pre> $ for i (./*.mp3){mpg321 --w - $i > ${i:r}.wav}
1947 <!-- INDENTATION -->
1948 <p>Download with LaTeX2HTML created Files (for example the
1950 <!-- INDENTATION -->
1951 <pre> $ for f in http://zsh.sunsite.dk/Guide/zshguide{,{01..08}}.html; do
1952 > lynx -source $f >${f:t}
1955 <!-- INDENTATION -->
1956 <p>Move all files in dir1 and dir2 that have line counts
1957 greater than 10 to another directory say
1958 "/more10":</p>
1959 <!-- INDENTATION -->
1960 <pre> $ mv dir[12]/**/*.cr(-.e{’((‘wc -l < $REPLY‘ > 10))’}) /more10
1962 <!-- INDENTATION -->
1963 <p>Make with dpkg a master-list of everyfile that it has
1965 <!-- INDENTATION -->
1966 <pre> $ diff <(find / | sort) <(cat /var/lib/dpkg/info/*.list | sort)
1968 <!-- INDENTATION -->
1969 <p>Replace the unreadable Escape-Sequences:</p>
1970 <!-- INDENTATION -->
1971 <pre> $ autoload colors ; colors
1972 $ print "$bg[cyan]$fg[blue]You are an zsh user" >> /dev/pts/3
1974 <!-- INDENTATION -->
1975 <p>Get ASCII value of a character:</p>
1976 <!-- INDENTATION -->
1977 <pre> $ char=N ; print $((#char))
1979 <!-- INDENTATION -->
1980 <p>Filename suffix: Note: The (N) says to use the nullglob
1981 option for this particular glob pattern.</p>
1982 <!-- INDENTATION -->
1983 <pre> $ for i in *.o(N); do
1987 <!-- INDENTATION -->
1988 <p>Rename files; i. e. FOO to foo and bar to BAR:</p>
1989 <!-- INDENTATION -->
1990 <pre> $ for i in *(.); mv $i ${i:l} # ‘FOO’ to ‘foo’
1991 $ for i in *(.); mv $i ${i:u} # ‘bar to ‘BAR’
1993 <!-- INDENTATION -->
1994 <p>Show all suid-files in $PATH:</p>
1995 <!-- INDENTATION -->
1996 <pre> $ ls -latg ${(s.:.)PATH} | grep ’^...s’
1997 # or more complex ;)
1998 $ print -l ${^path}/*(Ns,S)
1999 # or show only executables with a user given pattern
2000 $ print -l ${^path}/*vim*(*N)
2002 <!-- INDENTATION -->
2003 <p>gzip files when containing a certain string:</p>
2004 <!-- INDENTATION -->
2005 <pre> $ gzip ${(ps: :)"$(grep -lZ foobar ./*.txt(.))"}
2007 <!-- INDENTATION -->
2008 <p>A small one-liner, that reads from stdin and prints to
2009 stdout the first unique line i. e. does not print lines that
2010 have been printed before (this is similar to the unique
2011 command, but unique can only handle adjacent lines):</p>
2012 <!-- INDENTATION -->
2013 <pre> $ IFS=$’0; print -rl -- ${(Oau)${(Oa)$(cat file;echo .)[1,-2]}}
2015 <!-- INDENTATION -->
2016 <p>Lists every executable in PATH:</p>
2017 <!-- INDENTATION -->
2018 <pre> $ print -l ${^path}/*(-*N)
2020 <!-- INDENTATION -->
2021 <p>Match all .c files in all subdirectories, _except_ any
2022 SCCS subdirectories?</p>
2023 <!-- INDENTATION -->
2024 <pre> $ ls **/*.c~(*/)#SCCS/*
2026 <!-- INDENTATION -->
2027 <p>List all ‘README’ - files case-insensitive
2028 with max. one typo:</p>
2029 <!-- INDENTATION -->
2030 <pre> $ ls **/*(#ia2)readme
2032 <!-- INDENTATION -->
2033 <p>Print version information of zsh:</p>
2034 <!-- INDENTATION -->
2035 <pre> $ print $ZSH_VERSION
2037 <!-- INDENTATION -->
2038 <p>Get hostspecific information:</p>
2039 <!-- INDENTATION -->
2040 <pre> $ echo $MACHTYPE $VENDOR $OSTYPE
2042 <!-- INDENTATION -->
2043 <p>Fast change of directories:</p>
2044 <!-- INDENTATION -->
2045 <pre> alias ...=’cd ../..’
2046 alias ....=’cd ../../..’
2047 alias .....=’cd ../../../..’
2048 alias ......=’cd ../../../../..’
2049 alias .......=’cd ../../../../../..’
2051 <!-- INDENTATION -->
2052 <p>Mailpath: simple multiple mailpath:</p>
2053 <!-- INDENTATION -->
2054 <pre> mailpath=($HOME/Mail/mbox’?new mail in mbox’
2055 $HOME/Mail/tux.u-strasbg’?new mail in tux’
2056 $HOME/Mail/lilo’?new mail in lilo’
2057 $HOME/Mail/ldap-fr’?new mail in ldap-fr’)
2059 <!-- INDENTATION -->
2060 <p>Mailpath: dynamic mailpath:</p>
2061 <!-- INDENTATION -->
2062 <pre> typeset -a mailpath
2063 for i in ~/Mail/Lists/*(.); do
2064 mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}."
2067 <!-- INDENTATION -->
2068 <p>Avoid globbing on special commands:</p>
2069 <!-- INDENTATION -->
2070 <pre>for com in alias expr find mattrib mcopy mdir mdel which;
2071 alias $com="noglob $com"
2073 <!-- INDENTATION -->
2074 <p>For migrating your bashprompt to zsh use the script
2075 bash2zshprompt located in the zsh source distribution under
2076 ’Misc’.</p>
2077 <!-- INDENTATION -->
2078 <p>For migration from (t)csh to zsh use the c2z tool that
2079 converts csh aliases and environment and shell variables to
2080 zsh. It does this by running csh, and having csh report on
2081 aliases and variables. The script then converts these to zsh
2082 startup files. It has some issues and usage information that
2083 are documented at the top of this script.</p>
2084 <!-- INDENTATION -->
2085 <p>Here are functions to set the title and hardstatus of an
2086 <b>XTerm</b> or of <b>GNU Screen</b> to ’zsh’
2087 and the current directory, respectively, when the prompt is
2088 displayed, and to the command name and rest of the command
2089 line, respectively, when a command is executed:</p>
2090 <!-- INDENTATION -->
2091 <pre> function title {
2092 if [[ $TERM == "screen" ]]; then
2093 # Use these two for GNU Screen:
2094 print -nR $’ 33k’$1$’ 33’\
2095 print -nR $’ 33]0;’$2$’’
2096 elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
2097 # Use this one instead for XTerms:
2098 print -nR $’ 33]0;’$*$’’
2103 title zsh "$PWD"
2108 local -a cmd; cmd=(${(z)1})
2109 title $cmd[1]:t "$cmd[2,-1]"
2112 <!-- INDENTATION -->
2113 <p>Put the following line into your ~/.screenrc to see this
2114 fancy hardstatus:</p>
2115 <!-- INDENTATION -->
2116 <pre> caption always "%3n %t%? (%u)%?%?: %h%?"
2118 <!-- INDENTATION -->
2119 <p>Special variables which are assigned or you can
2121 <!-- INDENTATION -->
2122 <pre> $ echo $LINENO $RANDOM $SECONDS $COLUMNS $HISTCHARS
2123 $ echo $UID $EUID $GID $EGID $USERNAME
2124 $ echo $fignore $mailpath $cdpath
2126 Show me all the .c files for which there doesn’t exist a .o file:
2127 $ c=(*.c) o=(*.o(N)) eval ’ls ${${c:#(${~${(j:|:)${o:r}}}).c}:?done}’
2129 <!-- INDENTATION -->
2130 <p>Find (and print) all symbolic links without a target
2131 within the current dirtree:</p>
2132 <!-- INDENTATION -->
2133 <pre> $ file **/*(D@) | fgrep broken
2134 $ for i in **/*(D@); [[ −f $i || −d $i ]] || echo $i
2135 $ echo **/*(@−^./=%p)
2136 $ print −l **/*(−@)
2138 <!-- INDENTATION -->
2139 <p>Rename files; i. e. FOO to foo and bar to BAR:</p>
2140 <!-- INDENTATION -->
2141 <pre> $ for i in *(.); mv $i ${i:l} # ‘FOO’ to ‘foo’
2142 $ for i in *(.); mv $i ${i:u} # ‘bar to ‘BAR’
2144 <!-- INDENTATION -->
2145 <p>Show all suid-files in $PATH:</p>
2146 <!-- INDENTATION -->
2147 <pre> $ ls −latg ${(s.:.)PATH} | grep ’^...s’
2149 <!-- INDENTATION -->
2150 <p>List all ‘README’ - files case-insensitive
2151 with max. one typo:</p>
2152 <!-- INDENTATION -->
2153 <pre> $ ls **/*(#ia2)readme
2157 <!-- INDENTATION -->
2159 <table width="100%" border=0 rules="none" frame="void"
2160 cols="2" cellspacing="0" cellpadding="0">
2161 <tr valign="top" align="left">
2162 <td width="4%"></td>
2164 <p><b>(RECURSIVE) GLOBBING−EXAMPLES</b></p></td>
2166 <!-- INDENTATION -->
2167 <table width="100%" border=0 rules="none" frame="void"
2168 cols="2" cellspacing="0" cellpadding="0">
2169 <tr valign="top" align="left">
2170 <td width="10%"></td>
2172 <p>Search for ‘README’ in all Subdirectories</p>
2173 <!-- INDENTATION -->
2174 <pre> $ print −l **/README
2176 <!-- INDENTATION -->
2177 <p>Recursive ‘‘chmod’’</p>
2178 <!-- INDENTATION -->
2179 <pre> $ chmod 700 **/(.) # Only files
2180 $ chmod 700 **/(/) # Only directories
2182 <!-- INDENTATION -->
2183 <p>List files beginning at ‘foo23’ upwards
2184 (foo23, foo24, foo25, ..)</p>
2185 <!-- INDENTATION -->
2186 <pre> $ ls -l foo<23−>
2188 <!-- INDENTATION -->
2189 <p>Remove spaces from filenames</p>
2190 <!-- INDENTATION -->
2191 <pre> $ for a in ./**/*\ *(Dod); do mv $a ${a:h}/${a:t:gs/ /_}; done
2193 <!-- INDENTATION -->
2194 <p>Show only all *.c and *.h - Files</p>
2195 <!-- INDENTATION -->
2196 <pre> $ ls -l *.(c|h)
2198 <!-- INDENTATION -->
2199 <p>Show <b>only</b> all *.c - files and ignore
2200 ‘foo.c’</p>
2201 <!-- INDENTATION -->
2202 <pre> $ ls *.c~foo.c
2204 <!-- INDENTATION -->
2205 <p>Show only world-readable files</p>
2206 <!-- INDENTATION -->
2209 <!-- INDENTATION -->
2210 <p>find and delete the files which are older than a given
2211 parameter (seconds/minutes/hours)</p>
2212 <!-- INDENTATION -->
2213 <pre> # deletes all regular file in /Dir that are older than 3 hours
2214 $ rm -f /Dir/**/*(.mh+3)
2215 # # deletes all symlinks in /Dir that are older than 3 minutes
2216 $ rm -f /Dir/**/*(@mm+3)
2217 # deletes all non dirs in /Dir that are older than 30 seconds
2218 $ rm -f /Dir/**/*(ms+30^/)
2219 # deletes all files more than 6 hours old
2221 # deletes all folders, sub-folders and files older than one hour
2222 $ rm ./**/*(.Dmh+1,.DL0)
2223 # removes all files but the ten newer ones (delete all but last 10 files in a directory)
2226 Note: If you get a arg list too long, you use the builtin rm. For example:
2227 $ zmodload zsh/files ; rm -f **/*(mh+6)
2228 or use the zargs function:
2229 $ autoload zargs ; zargs **/*(mh+6) -- rm -f
2231 <!-- INDENTATION -->
2232 <p><b>Explanation:</b></p>
2233 <!-- INDENTATION -->
2234 <pre> ./: to avoid problem with files starting with "−"
2235 **/: recursively descend
2243 <table width="100%" border=0 rules="none" frame="void"
2244 cols="3" cellspacing="0" cellpadding="0">
2245 <tr valign="top" align="left">
2246 <td width="11%"></td>
2249 <p>(<a>,<b>): files of <a> type or
2254 <tr valign="top" align="left">
2255 <td width="11%"></td>
2262 <tr valign="top" align="left">
2263 <td width="11%"></td>
2266 <p>.: regular files</p>
2270 <tr valign="top" align="left">
2271 <td width="11%"></td>
2274 <p>D: including dot files</p>
2278 <tr valign="top" align="left">
2279 <td width="11%"></td>
2282 <p>mh+1: whose [m]odification time, is more (+) than
2287 <tr valign="top" align="left">
2288 <td width="11%"></td>
2291 <p>[h]our in the past.</p>
2295 <tr valign="top" align="left">
2296 <td width="11%"></td>
2303 <tr valign="top" align="left">
2304 <td width="11%"></td>
2307 <p>.: regular files</p>
2311 <tr valign="top" align="left">
2312 <td width="11%"></td>
2315 <p>D: including dot files</p>
2319 <tr valign="top" align="left">
2320 <td width="11%"></td>
2323 <p>L0: of 0 [L]ength.</p>
2328 <!-- INDENTATION -->
2329 <table width="100%" border=0 rules="none" frame="void"
2330 cols="2" cellspacing="0" cellpadding="0">
2331 <tr valign="top" align="left">
2332 <td width="10%"></td>
2334 <p>If you want to remove empty directories afterwards:</p>
2335 <!-- INDENTATION -->
2336 <pre> # ‘‘/’’ matches only directories and ‘‘od’’ sorted in depth order (so
2337 # that dir/subdir is removed before directory).
2338 $ rmdir ./**/*(/od) 2> /dev/null
2340 <!-- INDENTATION -->
2341 <p><b>Note:</b> If you get a arg list too long, you use the
2342 builtin rm. For example:</p>
2343 <!-- INDENTATION -->
2344 <pre> $ zmodload zsh/files ; rm -f **/*(mh+6)
2346 <!-- INDENTATION -->
2347 <p>or use the zargs function:</p>
2348 <!-- INDENTATION -->
2349 <pre> $ autoload zargs ; zargs **/*(mh+6) -- rm -f
2351 <!-- INDENTATION -->
2352 <p>Delete only the oldest file in a directory:</p>
2353 <!-- INDENTATION -->
2354 <pre> $ rm ./*filename*(Om[1])
2356 <!-- INDENTATION -->
2357 <p>Sort the output from ‘ls −l’ by file
2359 <!-- INDENTATION -->
2360 <pre> $ ls -fld *(OL)
2362 <!-- INDENTATION -->
2363 <p>Find most recent file in a directory:</p>
2364 <!-- INDENTATION -->
2365 <pre> $ setopt dotglob ; print directory/**/*(om[1])
2367 <!-- INDENTATION -->
2368 <p>List the top 100 biggest files in a disk</p>
2369 <!-- INDENTATION -->
2370 <pre> $ zmodload −i zsh/stat ; ls −fld ./**/*(d‘stat +device .‘OL[1,100])
2372 <!-- INDENTATION -->
2373 <pre> $ ls *(L0f.go-w.)
2375 <!-- INDENTATION -->
2376 <p>Find all files without a valid owner:</p>
2377 <!-- INDENTATION -->
2378 <pre> $ chmod someuser /**/*(D^u:${(j.:u:.)${(f)"$(</etc/passwd)"}%%:*}:)
2380 <!-- INDENTATION -->
2381 <p>Show only files are owned from group
2382 ‘users’:</p>
2383 <!-- INDENTATION -->
2384 <pre> $ ls -l *(G[users])
2388 <!-- INDENTATION -->
2390 <table width="100%" border=0 rules="none" frame="void"
2391 cols="2" cellspacing="0" cellpadding="0">
2392 <tr valign="top" align="left">
2393 <td width="4%"></td>
2395 <p><b>ZMV−EXAMPLES</b></p></td>
2397 <!-- INDENTATION -->
2398 <table width="100%" border=0 rules="none" frame="void"
2399 cols="2" cellspacing="0" cellpadding="0">
2400 <tr valign="top" align="left">
2401 <td width="10%"></td>
2403 <p><b>Note:</b> ‘‘autoload zmv’’
2404 needed! See ‘‘man zshcontrib | less -p
2405 zmv’’ for more details.</p>
2406 <!-- INDENTATION -->
2407 <p>Serially all files (foo.foo > 1.foo, fnord.foo >
2409 <!-- INDENTATION -->
2411 1.c asd.foo bla.foo fnord.foo foo.fnord foo.foo
2412 $ c=1 zmv ’*.foo’ ’$((c++)).foo’
2414 1.c 1.foo 2.foo 3.foo 4.foo foo.fnord
2416 <!-- INDENTATION -->
2417 <p>See above, but now only files with a filename >= 30
2419 <!-- INDENTATION -->
2420 <pre> $ c=1 zmv "${(l:30-4::?:)}*.foo" ’$((c++)).foo’
2422 <!-- INDENTATION -->
2423 <p>Replace spaces in filenames with a underline:</p>
2424 <!-- INDENTATION -->
2425 <pre> $ zmv ’* *’ ’$f:gs/ /_’
2427 <!-- INDENTATION -->
2428 <p>Change the suffix from *.sh to *.pl:</p>
2429 <!-- INDENTATION -->
2430 <pre> $ zmv -W ’*.sh’ ’*.pl’
2432 <!-- INDENTATION -->
2433 <p>lowercase/uppercase all files/directories:</p>
2434 <!-- INDENTATION -->
2436 $ zmv ’(*)’ ’${(L)1}’
2438 zmv ’(*)’ ’${(U)1}’
2440 <!-- INDENTATION -->
2441 <p>Remove the suffix *.c from all C-Files:</p>
2442 <!-- INDENTATION -->
2443 <pre> $ zmv ’(*).c’ ’$1’
2445 <!-- INDENTATION -->
2446 <p>Uppercase only the first letter of all *.mp3 - files:</p>
2447 <!-- INDENTATION -->
2448 <pre> $ zmv ’([a-z])(*).mp3’ ’${(C)1}$2.mp3’
2450 <!-- INDENTATION -->
2451 <p>Copy the target ‘README’ in same directory as
2452 each ‘Makefile’:</p>
2453 <!-- INDENTATION -->
2454 <pre> $ zmv -C ’(**/)Makefile’ ’${1}README’
2456 <!-- INDENTATION -->
2457 <p>Removing single quote from filenames (recursive):</p>
2458 <!-- INDENTATION -->
2459 <pre>$ zmv -Q "(**/)(*’*)(D)" "\$1\${2//’/}"
2461 <!-- INDENTATION -->
2462 <p>Replace spaces with underscores in filenames
2464 <!-- INDENTATION -->
2465 <pre>$ zmv -Q "(**/)(* *)(D)" "\$1\${2// /_}"
2467 <!-- INDENTATION -->
2468 <p>Rename pic1.jpg, pic2.jpg, .. to pic0001.jpg,
2469 pic0002.jpg, ..:</p>
2470 <!-- INDENTATION -->
2471 <pre> # Not recursively
2472 $ zmv ’pic(*).jpg’ ’pic${(l:4::0:)1}.jpg’
2474 $ zmv ’(**/)pic(*).jpg’ ’$1/pic${(l:4::0:)2}.jpg’
2478 <!-- INDENTATION -->
2480 <table width="100%" border=0 rules="none" frame="void"
2481 cols="2" cellspacing="0" cellpadding="0">
2482 <tr valign="top" align="left">
2483 <td width="4%"></td>
2485 <p><b>TIPS BY ZZAPPER
2486 (http://www.rayninfo.co.uk/tips/zshtips.html)</b></p></td>
2488 <!-- INDENTATION -->
2489 <table width="100%" border=0 rules="none" frame="void"
2490 cols="2" cellspacing="0" cellpadding="0">
2491 <tr valign="top" align="left">
2492 <td width="10%"></td>
2494 <pre> !! # last command
2496 !$:h (last argument, strip one level)
2498 vi !* (all parameters)
2499 vi !$ (last parameters)
2502 ^fred^joe # edit previous command replace fred by joe
2506 cmdy !?cmd1?:*<TAB> #get parameters of a previous command
2508 !:0 is the previous command name
2509 !^, !:2, !:3, ?, !$ are the arguments
2510 !* is all the arguments
2511 !-2, !-3, ? are earlier commands
2512 !-2^, !-2:2, !-2$, !-2*
2514 cd !$:h (remove file name)
2515 cat !!:t (only file name)
2516 print ${param:&} (last substitute)
2518 # globbing modifiers
2519 # :r removes the suffix from the result,
2520 # :t takes away the directory part
2521 # . means must be regular files not directories etc
2522 # *(om[1]) picks most recently modified file
2523 # (.N) no warning message if any file absent
2524 print *(om[1]) # print the most recent file
2525 print *(.om[1]) # print the most recent file (not directory)
2526 ls -l *(Om[1]) # oldest file
2527 print *(om[1,5]) # print the 5 most recent files
2528 vi *(.om[1]^D) # vi newest file ^D means switch off GLOB_DOTS
2529 ls -l *(m4) # list files modified exactly 4 days ago
2530 ls -ltd *(mw3) # list files 3 weeks old
2531 echo *(m-1) # files modified today
2532 echo *(m0) # files modified today
2533 rm *.{aux,dvi,log,toc}(.N) # rm latex temp files N means no error msg is any file absent
2535 print *(n:t) # order by name strip directory
2536 print **/*(On:t) # recursive reverse order by name, strip directory
2537 print *.c(:r) # strip suffix
2538 ls **/*(.) # only files no directories
2539 -ld *(/) # list only directories
2540 FOO = (#i)foo ]] # case insensitive matching
2542 fred=$((6**2 + 6)) # can do maths
2543 print ${#path} # length of "path" array
2544 print ${#path[1]} # length of first element in path array
2549 array=(~/.zshenv ~/.zshrc ~/.zlogout)
2551 .zshenv .zshrc .zlogout
2553 x="bu&^*ck" # variable with mucky characters
2554 print ${x//[^[:alnum:]]/_} # replace all non-alphanumerics with _
2556 cp file ~1 # where 1 is first entry in pushd stack
2558 startfilename<tab> # will complete matching files anywhere in $PATH
2559 startfilename<C-D> # will list matching files anywhere in $PATH
2563 ls * | grep foo | less
2569 vim =some_file # edits file anywhere in $PATH
2570 ls =some_file # lists file anywhere in $PATH
2571 #magic ** (recursion)
2572 vim **/some_file # edits file under under current dir
2573 # modifying more than one file (multios)
2574 # writes ls results to file1 & file2 appends to filec
2575 ls > file1 > file2 >> file3 | wc
2577 <!-- INDENTATION -->
2578 <p>Find file containing string ’printf’ in
2580 <!-- INDENTATION -->
2581 <pre> $ zargs /usr/include/**/*.h −− grep printf /dev/null
2583 <!-- INDENTATION -->
2584 <p>A solution without zsh could look like:</p>
2585 <!-- INDENTATION -->
2586 <pre> $ find /usr/include -name \*.h −exec grep printf /dev/null {} ;
2588 <!-- INDENTATION -->
2589 <p>Create a directory structure based on an existing
2591 <!-- INDENTATION -->
2592 <pre> $ dirs=(**/*(/))
2593 $ cd −− $dest_root
2594 $ mkdir −p −− $dirs
2596 <!-- INDENTATION -->
2597 <p>A solution without zsh could look like:</p>
2598 <!-- INDENTATION -->
2599 <pre> $ src=/usr/local
2601 $ cd "$src"
2602 $ find . -type d | cpio -pdmv "$dst"
2604 <!-- INDENTATION -->
2605 <p>Uncompress file and read it</p>
2606 <!-- INDENTATION -->
2607 <pre>less <(gzip -cd foo.gz)
2609 <!-- INDENTATION -->
2610 <p>A solution without zsh could look like:</p>
2611 <!-- INDENTATION -->
2612 <pre> $ gzip -cd foo.gz && less foo
2614 <!-- INDENTATION -->
2615 <p>Print two files and sort them</p>
2616 <!-- INDENTATION -->
2617 <pre> $ sort <f{oo,ubar}
2619 <!-- INDENTATION -->
2620 <p>A solution without zsh could look like:</p>
2621 <!-- INDENTATION -->
2622 <pre> $ cat foo fubar | sort
2624 <!-- INDENTATION -->
2625 <p>Find files up from current directory and change
2626 permissions to ’700’.</p>
2627 <!-- INDENTATION -->
2628 <pre> $ chmod 700 **/*(.)
2630 <!-- INDENTATION -->
2631 <p>A solution without zsh could look like:</p>
2632 <!-- INDENTATION -->
2633 <pre> $ find . −type f −exec chmod 700 {} \;
2635 <!-- INDENTATION -->
2636 <p>List details of the executable ’foobar’.</p>
2637 <!-- INDENTATION -->
2638 <pre> $ ls -l =foobar
2640 <!-- INDENTATION -->
2641 <p>A solution without zsh could look like:</p>
2642 <!-- INDENTATION -->
2643 <pre> $ ls -l ‘which foobar‘
2645 <!-- INDENTATION -->
2646 <p>Small examples</p>
2647 <!-- INDENTATION -->
2648 <pre>´cd old new’ replaces ’old’ with ’new’ in directory-names.
2649 ´which -a cmd’ lists all occurences of ’cmd’ in $PATH.
2653 <a name="OPTIONS"></a>
2655 <!-- INDENTATION -->
2657 <table width="100%" border=0 rules="none" frame="void"
2658 cols="2" cellspacing="0" cellpadding="0">
2659 <tr valign="top" align="left">
2660 <td width="10%"></td>
2662 <p>Navigation options</p></td>
2664 <!-- INDENTATION -->
2665 <table width="100%" border=0 rules="none" frame="void"
2666 cols="2" cellspacing="0" cellpadding="0">
2667 <tr valign="top" align="left">
2668 <td width="21%"></td>
2670 <p>auto_cd (allow one to change to a directory by entering
2671 it as a command). auto_pushd (automatically append dirs to
2672 the push/pop list) pushd_ignore_dups (and don’t
2677 <table width="100%" border=0 rules="none" frame="void"
2678 cols="3" cellspacing="0" cellpadding="0">
2679 <tr valign="top" align="left">
2680 <td width="11%"></td>
2688 <!-- INDENTATION -->
2689 <table width="100%" border=0 rules="none" frame="void"
2690 cols="2" cellspacing="0" cellpadding="0">
2691 <tr valign="top" align="left">
2692 <td width="10%"></td>
2694 <p>no_hup (don’t send HUP signal to background jobs
2695 when exiting ZSH) print_exit_value (show a message with the
2696 exit code when a command returns with a non-zero exit
2700 <!-- INDENTATION -->
2701 <table width="100%" border=0 rules="none" frame="void"
2702 cols="2" cellspacing="0" cellpadding="0">
2703 <tr valign="top" align="left">
2704 <td width="10%"></td>
2706 <p>History options</p></td>
2708 <!-- INDENTATION -->
2709 <table width="100%" border=0 rules="none" frame="void"
2710 cols="2" cellspacing="0" cellpadding="0">
2711 <tr valign="top" align="left">
2712 <td width="21%"></td>
2714 <p>hist_verify (let the user edit the command line after
2715 history expansion (e.g. !ls) instead of immediately running
2717 <!-- INDENTATION -->
2718 <p>Use the same history file for all sessions :</p>
2719 <!-- INDENTATION -->
2720 <pre> setopt SHARE_HISTORY
2724 <!-- INDENTATION -->
2726 <table width="100%" border=0 rules="none" frame="void"
2727 cols="2" cellspacing="0" cellpadding="0">
2728 <tr valign="top" align="left">
2729 <td width="10%"></td>
2731 <p>Privacy / Security</p></td>
2733 <!-- INDENTATION -->
2734 <table width="100%" border=0 rules="none" frame="void"
2735 cols="2" cellspacing="0" cellpadding="0">
2736 <tr valign="top" align="left">
2737 <td width="21%"></td>
2739 <p>no_clobber (or set -C; prevent ’>’
2740 redirection from truncating the given file if it already
2744 <!-- INDENTATION -->
2745 <table width="100%" border=0 rules="none" frame="void"
2746 cols="2" cellspacing="0" cellpadding="0">
2747 <tr valign="top" align="left">
2748 <td width="10%"></td>
2750 <p>Spelling correction</p></td>
2752 <!-- INDENTATION -->
2753 <table width="100%" border=0 rules="none" frame="void"
2754 cols="2" cellspacing="0" cellpadding="0">
2755 <tr valign="top" align="left">
2756 <td width="21%"></td>
2758 <p>correct (automatically correct the spelling of commands)
2759 correct_all (automatically correct the spelling of each word
2760 on the command line) dvorak (dvorak layout)</p>
2763 <a name="LINKS"></a>
2765 <!-- INDENTATION -->
2766 <table width="100%" border=0 rules="none" frame="void"
2767 cols="2" cellspacing="0" cellpadding="0">
2768 <tr valign="top" align="left">
2769 <td width="10%"></td>
2771 <p>The Z shell Homepage</p></td>
2773 <!-- INDENTATION -->
2774 <table width="100%" border=0 rules="none" frame="void"
2775 cols="2" cellspacing="0" cellpadding="0">
2776 <tr valign="top" align="left">
2777 <td width="21%"></td>
2779 <p><b>http://www.zsh.org/</b></p>
2782 <!-- INDENTATION -->
2783 <table width="100%" border=0 rules="none" frame="void"
2784 cols="2" cellspacing="0" cellpadding="0">
2785 <tr valign="top" align="left">
2786 <td width="10%"></td>
2788 <p>The Z shell FAQ</p></td>
2790 <!-- INDENTATION -->
2791 <table width="100%" border=0 rules="none" frame="void"
2792 cols="2" cellspacing="0" cellpadding="0">
2793 <tr valign="top" align="left">
2794 <td width="21%"></td>
2796 <p><b>http://zsh.sunsite.dk/FAQ/</b></p>
2799 <!-- INDENTATION -->
2800 <table width="100%" border=0 rules="none" frame="void"
2801 cols="2" cellspacing="0" cellpadding="0">
2802 <tr valign="top" align="left">
2803 <td width="10%"></td>
2805 <p>The Z shell wiki</p></td>
2807 <!-- INDENTATION -->
2808 <table width="100%" border=0 rules="none" frame="void"
2809 cols="2" cellspacing="0" cellpadding="0">
2810 <tr valign="top" align="left">
2811 <td width="21%"></td>
2813 <p><b>http://www.zshwiki.org/</b></p>
2816 <!-- INDENTATION -->
2817 <table width="100%" border=0 rules="none" frame="void"
2818 cols="2" cellspacing="0" cellpadding="0">
2819 <tr valign="top" align="left">
2820 <td width="10%"></td>
2822 <p>Mailinglistarchive</p></td>
2824 <!-- INDENTATION -->
2825 <table width="100%" border=0 rules="none" frame="void"
2826 cols="2" cellspacing="0" cellpadding="0">
2827 <tr valign="top" align="left">
2828 <td width="21%"></td>
2830 <p><b>http://www.zsh.org/mla/</b></p>
2833 <!-- INDENTATION -->
2834 <table width="100%" border=0 rules="none" frame="void"
2835 cols="2" cellspacing="0" cellpadding="0">
2836 <tr valign="top" align="left">
2837 <td width="10%"></td>
2839 <p>The Z shell reference-card (included in the
2842 <!-- INDENTATION -->
2843 <table width="100%" border=0 rules="none" frame="void"
2844 cols="2" cellspacing="0" cellpadding="0">
2845 <tr valign="top" align="left">
2846 <td width="21%"></td>
2849 <b>http://zsh.sunsite.dk/Refcard/refcard.ps.gz</b></p>
2852 <!-- INDENTATION -->
2853 <table width="100%" border=0 rules="none" frame="void"
2854 cols="2" cellspacing="0" cellpadding="0">
2855 <tr valign="top" align="left">
2856 <td width="10%"></td>
2858 <p>Adam Spier’s UNIX shells page</p></td>
2860 <!-- INDENTATION -->
2861 <table width="100%" border=0 rules="none" frame="void"
2862 cols="2" cellspacing="0" cellpadding="0">
2863 <tr valign="top" align="left">
2864 <td width="21%"></td>
2866 <p><b>http://adamspiers.org/computing/shells/</b></p>
2869 <!-- INDENTATION -->
2870 <table width="100%" border=0 rules="none" frame="void"
2871 cols="2" cellspacing="0" cellpadding="0">
2872 <tr valign="top" align="left">
2873 <td width="10%"></td>
2875 <p>The Single UNIX (R) Specification, Version 2 - Shell
2876 Command Language Index</p></td>
2878 <!-- INDENTATION -->
2879 <table width="100%" border=0 rules="none" frame="void"
2880 cols="2" cellspacing="0" cellpadding="0">
2881 <tr valign="top" align="left">
2882 <td width="21%"></td>
2885 <p><b>http://www.opengroup.org/onlinepubs/007908799/xcu/shellix.html</b></p>
2888 <!-- INDENTATION -->
2889 <table width="100%" border=0 rules="none" frame="void"
2890 cols="2" cellspacing="0" cellpadding="0">
2891 <tr valign="top" align="left">
2892 <td width="10%"></td>
2894 <p>Zzappers Best of ZSH Tips</p></td>
2896 <!-- INDENTATION -->
2897 <table width="100%" border=0 rules="none" frame="void"
2898 cols="2" cellspacing="0" cellpadding="0">
2899 <tr valign="top" align="left">
2900 <td width="21%"></td>
2902 <p><b>http://www.rayninfo.co.uk/tips/zshtips.html</b></p>
2905 <!-- INDENTATION -->
2906 <table width="100%" border=0 rules="none" frame="void"
2907 cols="2" cellspacing="0" cellpadding="0">
2908 <tr valign="top" align="left">
2909 <td width="10%"></td>
2911 <p>The ZSH area on dotfiles.com</p></td>
2913 <!-- INDENTATION -->
2914 <table width="100%" border=0 rules="none" frame="void"
2915 cols="2" cellspacing="0" cellpadding="0">
2916 <tr valign="top" align="left">
2917 <td width="21%"></td>
2919 <p><b>http://www.dotfiles.com/index.php3?app_id=4</b></p>
2922 <!-- INDENTATION -->
2923 <table width="100%" border=0 rules="none" frame="void"
2924 cols="2" cellspacing="0" cellpadding="0">
2925 <tr valign="top" align="left">
2926 <td width="10%"></td>
2928 <p>Zsh Webpage by Christian Schneider</p></td>
2930 <!-- INDENTATION -->
2931 <table width="100%" border=0 rules="none" frame="void"
2932 cols="2" cellspacing="0" cellpadding="0">
2933 <tr valign="top" align="left">
2934 <td width="21%"></td>
2936 <p><b>http://strcat.neessen.net/zsh/</b></p>
2939 <!-- INDENTATION -->
2940 <table width="100%" border=0 rules="none" frame="void"
2941 cols="2" cellspacing="0" cellpadding="0">
2942 <tr valign="top" align="left">
2943 <td width="10%"></td>
2945 <p>The zsh-lovers webpage</p></td>
2947 <!-- INDENTATION -->
2948 <table width="100%" border=0 rules="none" frame="void"
2949 cols="2" cellspacing="0" cellpadding="0">
2950 <tr valign="top" align="left">
2951 <td width="21%"></td>
2953 <p><b>http://grml.org/zsh/</b></p>
2956 <!-- INDENTATION -->
2957 <table width="100%" border=0 rules="none" frame="void"
2958 cols="2" cellspacing="0" cellpadding="0">
2959 <tr valign="top" align="left">
2960 <td width="10%"></td>
2962 <p>IRC channel</p></td>
2964 <!-- INDENTATION -->
2965 <table width="100%" border=0 rules="none" frame="void"
2966 cols="2" cellspacing="0" cellpadding="0">
2967 <tr valign="top" align="left">
2968 <td width="21%"></td>
2970 <p><b>#zsh at irc.freenode.org</b></p>
2973 <a name="AUTHORS"></a>
2975 <!-- INDENTATION -->
2976 <table width="100%" border=0 rules="none" frame="void"
2977 cols="2" cellspacing="0" cellpadding="0">
2978 <tr valign="top" align="left">
2979 <td width="10%"></td>
2981 <p>This manpage was written by Michael Prokop, Christian
2982 ´strcat’ Schneider and Matthias Kopfermann. But
2983 many ideas have been taken from zsh-geeks e.g. from the
2984 zsh-mailinglists (zsh-users and zsh-workers), google,
2985 newsgroups and the zsh-Wiki. Thanks for your cool and
2986 incredible tips. We learned much from you!</p>
2987 <!-- INDENTATION -->
2988 <p>In alphabetic order:</p>
2989 <!-- INDENTATION -->
2990 <pre>Andrew ’zefram’ Main - http://www.fysh.org/~zefram/
2991 Barton E. Schaefer - http://www.well.com/user/barts/
2992 Matthias Kopfermann - http://www.infodrom.north.de/~matthi/
2993 Oliver Kiddle - http://people.freenet.de/opk/
2994 Paul Falstad - http://www.falstad.com/
2995 Peter Stephenson - http://python.swan.ac.uk/~pypeters/
2997 Stéphane Chazelas - http://stephane.chazelas.free.fr/
2998 Sven Guckes - http://www.guckes.net/
2999 Sven Wischnowsky - http://w9y.de/zsh/zshrc
3003 <a name="SEE ALSO"></a>
3005 <!-- INDENTATION -->
3007 <table width="100%" border=0 rules="none" frame="void"
3008 cols="2" cellspacing="0" cellpadding="0">
3009 <tr valign="top" align="left">
3010 <td width="10%"></td>
3012 <p>Manpages of zsh:</p>
3013 <!-- INDENTATION -->
3014 <pre>zsh Zsh overview (this section)
3015 zshmisc Anything not fitting into the other sections
3016 zshexpn Zsh command and parameter expansion
3017 zshparam Zsh parameters
3018 zshoptions Zsh options
3019 zshbuiltins Zsh built-in functions
3020 zshzle Zsh command line editing
3021 zshcompwid Zsh completion widgets
3022 zshcompsys Zsh completion system
3023 zshcompctl Zsh completion control
3024 zshmodules Zsh loadable modules
3025 zshzftpsys Zsh built-in FTP client
3026 zshall Meta-man page containing all of the above
3028 Note: especially ’man zshcontrib’ covers very useful topics!
3031 From Bash to Z Shell
3032 by Oliver Kiddle, Jerry Peck and Peter Stephenson
3035 Also take a look at the section
3037 </b>in this manpage.
3044 <!-- INDENTATION -->
3046 <table width="100%" border=0 rules="none" frame="void"
3047 cols="2" cellspacing="0" cellpadding="0">
3048 <tr valign="top" align="left">
3049 <td width="10%"></td>
3051 <p>Probably. This manpage might be never complete. So please
3052 report bugs, feedback and suggestions to
3053 <zsh-lovers@michael-prokop.at>. Thank you!</p>
3056 <a name="COPYRIGHT"></a>
3058 <!-- INDENTATION -->
3059 <table width="100%" border=0 rules="none" frame="void"
3060 cols="2" cellspacing="0" cellpadding="0">
3061 <tr valign="top" align="left">
3062 <td width="10%"></td>
3064 <p>Copyright © 2005 Michael Prokop, Christian Schneider
3065 and Matthias Kopfermann.</p>