make urls clickable
[grml.org.git] / zsh / zsh-lovers.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
2     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
4 <head>\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
6 <meta name="generator" content="AsciiDoc 8.5.2" />\r
7 <title>ZSH-LOVERS(1)</title>\r
8 <style type="text/css">\r
9 /* Debug borders */\r
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {\r
11 /*\r
12   border: 1px solid red;\r
13 */\r
14 }\r
15 \r
16 body {\r
17   margin: 1em 5% 1em 5%;\r
18 }\r
19 \r
20 a {\r
21   color: blue;\r
22   text-decoration: underline;\r
23 }\r
24 a:visited {\r
25   color: fuchsia;\r
26 }\r
27 \r
28 em {\r
29   font-style: italic;\r
30   color: navy;\r
31 }\r
32 \r
33 strong {\r
34   font-weight: bold;\r
35   color: #083194;\r
36 }\r
37 \r
38 tt {\r
39   color: navy;\r
40 }\r
41 \r
42 h1, h2, h3, h4, h5, h6 {\r
43   color: #527bbd;\r
44   font-family: sans-serif;\r
45   margin-top: 1.2em;\r
46   margin-bottom: 0.5em;\r
47   line-height: 1.3;\r
48 }\r
49 \r
50 h1, h2, h3 {\r
51   border-bottom: 2px solid silver;\r
52 }\r
53 h2 {\r
54   padding-top: 0.5em;\r
55 }\r
56 h3 {\r
57   float: left;\r
58 }\r
59 h3 + * {\r
60   clear: left;\r
61 }\r
62 \r
63 div.sectionbody {\r
64   font-family: serif;\r
65   margin-left: 0;\r
66 }\r
67 \r
68 hr {\r
69   border: 1px solid silver;\r
70 }\r
71 \r
72 p {\r
73   margin-top: 0.5em;\r
74   margin-bottom: 0.5em;\r
75 }\r
76 \r
77 ul, ol, li > p {\r
78   margin-top: 0;\r
79 }\r
80 \r
81 pre {\r
82   padding: 0;\r
83   margin: 0;\r
84 }\r
85 \r
86 span#author {\r
87   color: #527bbd;\r
88   font-family: sans-serif;\r
89   font-weight: bold;\r
90   font-size: 1.1em;\r
91 }\r
92 span#email {\r
93 }\r
94 span#revnumber, span#revdate, span#revremark {\r
95   font-family: sans-serif;\r
96 }\r
97 \r
98 div#footer {\r
99   font-family: sans-serif;\r
100   font-size: small;\r
101   border-top: 2px solid silver;\r
102   padding-top: 0.5em;\r
103   margin-top: 4.0em;\r
104 }\r
105 div#footer-text {\r
106   float: left;\r
107   padding-bottom: 0.5em;\r
108 }\r
109 div#footer-badges {\r
110   float: right;\r
111   padding-bottom: 0.5em;\r
112 }\r
113 \r
114 div#preamble {\r
115   margin-top: 1.5em;\r
116   margin-bottom: 1.5em;\r
117 }\r
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,\r
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
120 div.admonitionblock {\r
121   margin-top: 1.0em;\r
122   margin-bottom: 1.5em;\r
123 }\r
124 div.admonitionblock {\r
125   margin-top: 2.0em;\r
126   margin-bottom: 2.0em;\r
127   margin-right: 10%;\r
128   color: #606060;\r
129 }\r
130 \r
131 div.content { /* Block element content. */\r
132   padding: 0;\r
133 }\r
134 \r
135 /* Block element titles. */\r
136 div.title, caption.title {\r
137   color: #527bbd;\r
138   font-family: sans-serif;\r
139   font-weight: bold;\r
140   text-align: left;\r
141   margin-top: 1.0em;\r
142   margin-bottom: 0.5em;\r
143 }\r
144 div.title + * {\r
145   margin-top: 0;\r
146 }\r
147 \r
148 td div.title:first-child {\r
149   margin-top: 0.0em;\r
150 }\r
151 div.content div.title:first-child {\r
152   margin-top: 0.0em;\r
153 }\r
154 div.content + div.title {\r
155   margin-top: 0.0em;\r
156 }\r
157 \r
158 div.sidebarblock > div.content {\r
159   background: #ffffee;\r
160   border: 1px solid silver;\r
161   padding: 0.5em;\r
162 }\r
163 \r
164 div.listingblock > div.content {\r
165   border: 1px solid silver;\r
166   background: #f4f4f4;\r
167   padding: 0.5em;\r
168 }\r
169 \r
170 div.quoteblock, div.verseblock {\r
171   padding-left: 1.0em;\r
172   margin-left: 1.0em;\r
173   margin-right: 10%;\r
174   border-left: 5px solid #dddddd;\r
175   color: #777777;\r
176 }\r
177 \r
178 div.quoteblock > div.attribution {\r
179   padding-top: 0.5em;\r
180   text-align: right;\r
181 }\r
182 \r
183 div.verseblock > div.content {\r
184   white-space: pre;\r
185 }\r
186 div.verseblock > div.attribution {\r
187   padding-top: 0.75em;\r
188   text-align: left;\r
189 }\r
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */\r
191 div.verseblock + div.attribution {\r
192   text-align: left;\r
193 }\r
194 \r
195 div.admonitionblock .icon {\r
196   vertical-align: top;\r
197   font-size: 1.1em;\r
198   font-weight: bold;\r
199   text-decoration: underline;\r
200   color: #527bbd;\r
201   padding-right: 0.5em;\r
202 }\r
203 div.admonitionblock td.content {\r
204   padding-left: 0.5em;\r
205   border-left: 3px solid #dddddd;\r
206 }\r
207 \r
208 div.exampleblock > div.content {\r
209   border-left: 3px solid #dddddd;\r
210   padding-left: 0.5em;\r
211 }\r
212 \r
213 div.imageblock div.content { padding-left: 0; }\r
214 span.image img { border-style: none; }\r
215 a.image:visited { color: white; }\r
216 \r
217 dl {\r
218   margin-top: 0.8em;\r
219   margin-bottom: 0.8em;\r
220 }\r
221 dt {\r
222   margin-top: 0.5em;\r
223   margin-bottom: 0;\r
224   font-style: normal;\r
225   color: navy;\r
226 }\r
227 dd > *:first-child {\r
228   margin-top: 0.1em;\r
229 }\r
230 \r
231 ul, ol {\r
232     list-style-position: outside;\r
233 }\r
234 ol.arabic {\r
235   list-style-type: decimal;\r
236 }\r
237 ol.loweralpha {\r
238   list-style-type: lower-alpha;\r
239 }\r
240 ol.upperalpha {\r
241   list-style-type: upper-alpha;\r
242 }\r
243 ol.lowerroman {\r
244   list-style-type: lower-roman;\r
245 }\r
246 ol.upperroman {\r
247   list-style-type: upper-roman;\r
248 }\r
249 \r
250 div.compact ul, div.compact ol,\r
251 div.compact p, div.compact p,\r
252 div.compact div, div.compact div {\r
253   margin-top: 0.1em;\r
254   margin-bottom: 0.1em;\r
255 }\r
256 \r
257 div.tableblock > table {\r
258   border: 3px solid #527bbd;\r
259 }\r
260 thead, p.table.header {\r
261   font-family: sans-serif;\r
262   font-weight: bold;\r
263 }\r
264 tfoot {\r
265   font-weight: bold;\r
266 }\r
267 td > div.verse {\r
268   white-space: pre;\r
269 }\r
270 p.table {\r
271   margin-top: 0;\r
272 }\r
273 /* Because the table frame attribute is overriden by CSS in most browsers. */\r
274 div.tableblock > table[frame="void"] {\r
275   border-style: none;\r
276 }\r
277 div.tableblock > table[frame="hsides"] {\r
278   border-left-style: none;\r
279   border-right-style: none;\r
280 }\r
281 div.tableblock > table[frame="vsides"] {\r
282   border-top-style: none;\r
283   border-bottom-style: none;\r
284 }\r
285 \r
286 \r
287 div.hdlist {\r
288   margin-top: 0.8em;\r
289   margin-bottom: 0.8em;\r
290 }\r
291 div.hdlist tr {\r
292   padding-bottom: 15px;\r
293 }\r
294 dt.hdlist1.strong, td.hdlist1.strong {\r
295   font-weight: bold;\r
296 }\r
297 td.hdlist1 {\r
298   vertical-align: top;\r
299   font-style: normal;\r
300   padding-right: 0.8em;\r
301   color: navy;\r
302 }\r
303 td.hdlist2 {\r
304   vertical-align: top;\r
305 }\r
306 div.hdlist.compact tr {\r
307   margin: 0;\r
308   padding-bottom: 0;\r
309 }\r
310 \r
311 .comment {\r
312   background: yellow;\r
313 }\r
314 \r
315 .footnote, .footnoteref {\r
316   font-size: 0.8em;\r
317 }\r
318 \r
319 span.footnote, span.footnoteref {\r
320   vertical-align: super;\r
321 }\r
322 \r
323 #footnotes {\r
324   margin: 20px 0 20px 0;\r
325   padding: 7px 0 0 0;\r
326 }\r
327 \r
328 #footnotes div.footnote {\r
329   margin: 0 0 5px 0;\r
330 }\r
331 \r
332 #footnotes hr {\r
333   border: none;\r
334   border-top: 1px solid silver;\r
335   height: 1px;\r
336   text-align: left;\r
337   margin-left: 0;\r
338   width: 20%;\r
339   min-width: 100px;\r
340 }\r
341 \r
342 \r
343 @media print {\r
344   div#footer-badges { display: none; }\r
345 }\r
346 \r
347 div#toc {\r
348   margin-bottom: 2.5em;\r
349 }\r
350 \r
351 div#toctitle {\r
352   color: #527bbd;\r
353   font-family: sans-serif;\r
354   font-size: 1.1em;\r
355   font-weight: bold;\r
356   margin-top: 1.0em;\r
357   margin-bottom: 0.1em;\r
358 }\r
359 \r
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {\r
361   margin-top: 0;\r
362   margin-bottom: 0;\r
363 }\r
364 div.toclevel2 {\r
365   margin-left: 2em;\r
366   font-size: 0.9em;\r
367 }\r
368 div.toclevel3 {\r
369   margin-left: 4em;\r
370   font-size: 0.9em;\r
371 }\r
372 div.toclevel4 {\r
373   margin-left: 6em;\r
374   font-size: 0.9em;\r
375 }\r
376 /* Workarounds for IE6's broken and incomplete CSS2. */\r
377 \r
378 div.sidebar-content {\r
379   background: #ffffee;\r
380   border: 1px solid silver;\r
381   padding: 0.5em;\r
382 }\r
383 div.sidebar-title, div.image-title {\r
384   color: #527bbd;\r
385   font-family: sans-serif;\r
386   font-weight: bold;\r
387   margin-top: 0.0em;\r
388   margin-bottom: 0.5em;\r
389 }\r
390 \r
391 div.listingblock div.content {\r
392   border: 1px solid silver;\r
393   background: #f4f4f4;\r
394   padding: 0.5em;\r
395 }\r
396 \r
397 div.quoteblock-attribution {\r
398   padding-top: 0.5em;\r
399   text-align: right;\r
400 }\r
401 \r
402 div.verseblock-content {\r
403   white-space: pre;\r
404 }\r
405 div.verseblock-attribution {\r
406   padding-top: 0.75em;\r
407   text-align: left;\r
408 }\r
409 \r
410 div.exampleblock-content {\r
411   border-left: 3px solid #dddddd;\r
412   padding-left: 0.5em;\r
413 }\r
414 \r
415 /* IE6 sets dynamically generated links as visited. */\r
416 div#toc a:visited { color: blue; }\r
417 </style>\r
418 <script type="text/javascript">\r
419 /*<![CDATA[*/\r
420 window.onload = function(){asciidoc.footnotes();}\r
421 var asciidoc = {  // Namespace.\r
422 \r
423 /////////////////////////////////////////////////////////////////////\r
424 // Table Of Contents generator\r
425 /////////////////////////////////////////////////////////////////////\r
426 \r
427 /* Author: Mihai Bazon, September 2002\r
428  * http://students.infoiasi.ro/~mishoo\r
429  *\r
430  * Table Of Content generator\r
431  * Version: 0.4\r
432  *\r
433  * Feel free to use this script under the terms of the GNU General Public\r
434  * License, as long as you do not remove or alter this notice.\r
435  */\r
436 \r
437  /* modified by Troy D. Hanson, September 2006. License: GPL */\r
438  /* modified by Stuart Rackham, 2006, 2009. License: GPL */\r
439 \r
440 // toclevels = 1..4.\r
441 toc: function (toclevels) {\r
442 \r
443   function getText(el) {\r
444     var text = "";\r
445     for (var i = el.firstChild; i != null; i = i.nextSibling) {\r
446       if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.\r
447         text += i.data;\r
448       else if (i.firstChild != null)\r
449         text += getText(i);\r
450     }\r
451     return text;\r
452   }\r
453 \r
454   function TocEntry(el, text, toclevel) {\r
455     this.element = el;\r
456     this.text = text;\r
457     this.toclevel = toclevel;\r
458   }\r
459 \r
460   function tocEntries(el, toclevels) {\r
461     var result = new Array;\r
462     var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');\r
463     // Function that scans the DOM tree for header elements (the DOM2\r
464     // nodeIterator API would be a better technique but not supported by all\r
465     // browsers).\r
466     var iterate = function (el) {\r
467       for (var i = el.firstChild; i != null; i = i.nextSibling) {\r
468         if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {\r
469           var mo = re.exec(i.tagName);\r
470           if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {\r
471             result[result.length] = new TocEntry(i, getText(i), mo[1]-1);\r
472           }\r
473           iterate(i);\r
474         }\r
475       }\r
476     }\r
477     iterate(el);\r
478     return result;\r
479   }\r
480 \r
481   var toc = document.getElementById("toc");\r
482   var entries = tocEntries(document.getElementById("content"), toclevels);\r
483   for (var i = 0; i < entries.length; ++i) {\r
484     var entry = entries[i];\r
485     if (entry.element.id == "")\r
486       entry.element.id = "_toc_" + i;\r
487     var a = document.createElement("a");\r
488     a.href = "#" + entry.element.id;\r
489     a.appendChild(document.createTextNode(entry.text));\r
490     var div = document.createElement("div");\r
491     div.appendChild(a);\r
492     div.className = "toclevel" + entry.toclevel;\r
493     toc.appendChild(div);\r
494   }\r
495   if (entries.length == 0)\r
496     toc.parentNode.removeChild(toc);\r
497 },\r
498 \r
499 \r
500 /////////////////////////////////////////////////////////////////////\r
501 // Footnotes generator\r
502 /////////////////////////////////////////////////////////////////////\r
503 \r
504 /* Based on footnote generation code from:\r
505  * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html\r
506  */\r
507 \r
508 footnotes: function () {\r
509   var cont = document.getElementById("content");\r
510   var noteholder = document.getElementById("footnotes");\r
511   var spans = cont.getElementsByTagName("span");\r
512   var refs = {};\r
513   var n = 0;\r
514   for (i=0; i<spans.length; i++) {\r
515     if (spans[i].className == "footnote") {\r
516       n++;\r
517       // Use [\s\S] in place of . so multi-line matches work.\r
518       // Because JavaScript has no s (dotall) regex flag.\r
519       note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];\r
520       noteholder.innerHTML +=\r
521         "<div class='footnote' id='_footnote_" + n + "'>" +\r
522         "<a href='#_footnoteref_" + n + "' title='Return to text'>" +\r
523         n + "</a>. " + note + "</div>";\r
524       spans[i].innerHTML =\r
525         "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +\r
526         "' title='View footnote' class='footnote'>" + n + "</a>]";\r
527       var id =spans[i].getAttribute("id");\r
528       if (id != null) refs["#"+id] = n;\r
529     }\r
530   }\r
531   if (n == 0)\r
532     noteholder.parentNode.removeChild(noteholder);\r
533   else {\r
534     // Process footnoterefs.\r
535     for (i=0; i<spans.length; i++) {\r
536       if (spans[i].className == "footnoteref") {\r
537         var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");\r
538         href = href.match(/#.*/)[0];  // Because IE return full URL.\r
539         n = refs[href];\r
540         spans[i].innerHTML =\r
541           "[<a href='#_footnote_" + n +\r
542           "' title='View footnote' class='footnote'>" + n + "</a>]";\r
543       }\r
544     }\r
545   }\r
546 }\r
547 \r
548 }\r
549 /*]]>*/\r
550 </script>\r
551 </head>\r
552 <body>\r
553 <div id="header">\r
554 <h1>ZSH-LOVERS(1)</h1>\r
555 </div>\r
556 <div id="content">\r
557 <h2 id="_name">NAME</h2>\r
558 <div class="sectionbody">\r
559 <div class="paragraph"><p>zsh-lovers - tips, tricks and examples for the Z shell</p></div>\r
560 </div>\r
561 <h2 id="_synopsis">SYNOPSIS</h2>\r
562 <div class="sectionbody">\r
563 <div class="paragraph"><p>Just read it. ;-)</p></div>\r
564 </div>\r
565 <h2 id="_overview">OVERVIEW</h2>\r
566 <div class="sectionbody">\r
567 <div class="paragraph"><p>Whenever we look at the zsh manual we wonder why there are no examples or those\r
568 simply things in (shell) life.  The zsh contains many features, but there was no\r
569 manpage with some examples (like procmailex(5)).  That&#8217;s why we wrote this\r
570 manpage.</p></div>\r
571 <div class="paragraph"><p>Most of the tricks and oneliner come from the mailinglists zsh-users,\r
572 zsh-workers, google, newsgroups and from ourself.  See section <strong>LINKS</strong> for\r
573 details.</p></div>\r
574 <div class="paragraph"><p>Note: This manpage (zsh-lovers(1)) is <strong>not</strong> an offical part of the Z shell! It&#8217;s\r
575 just a just for fun - manpage ;)<br />\r
576 For comments, bugreports and feedback take a quick look at the section <strong>BUGS</strong>.</p></div>\r
577 </div>\r
578 <h2 id="_shell_scripting">SHELL-SCRIPTING</h2>\r
579 <div class="sectionbody">\r
580 <div class="paragraph"><p>This section provides some examples for often needed shellscript-stuff. Notice\r
581 that you should not use otherwise most examples won&#8217;t work.<br />\r
582 Parse options in shellscripts. Example taken from ZWS by Adam Chodorowski\r
583 (<a href="http://www.chodorowski.com/projects/zws/">http://www.chodorowski.com/projects/zws/</a>):</p></div>\r
584 <div class="listingblock">\r
585 <div class="content">\r
586 <pre><tt>parse_options()\r
587 {\r
588     o_port=(-p 9999)\r
589     o_root=(-r WWW)\r
590     o_log=(-d ZWS.log)\r
591 \r
592     zparseopts -K -- p:=o_port r:=o_root l:=o_log h=o_help\r
593     if [[ $? != 0 || "$o_help" != "" ]]; then\r
594         echo Usage: $(basename "$0") "[-p PORT] [-r DIRECTORY]"\r
595         exit 1\r
596     fi\r
597 \r
598     port=$o_port[2]\r
599     root=$o_root[2]\r
600     log=$o_log[2]\r
601 \r
602     if [[ $root[1] != '/' ]]; then root="$PWD/$root"; fi\r
603 }\r
604 # now use the function:\r
605 parse_options $*</tt></pre>\r
606 </div></div>\r
607 </div>\r
608 <h2 id="_examples">EXAMPLES</h2>\r
609 <div class="sectionbody">\r
610 <div class="paragraph"><p>Available subsections are <strong>Aliases</strong>, <strong>Completion</strong>, <strong>Unsorted/Misc examples</strong>,\r
611 <strong>(Recursive) Globbing - Examples</strong>, <strong>Modifiers usage</strong>, <strong>Redirection-Examples</strong>,\r
612 <strong>ZMV-Examples</strong> and <strong>Module-Examples</strong>.</p></div>\r
613 <h3 id="_aliases">ALIASES</h3><div style="clear:left"></div>\r
614 <div class="paragraph"><p>Suffix aliases are supported in zsh since version 4.2.0. Some examples:</p></div>\r
615 <div class="listingblock">\r
616 <div class="content">\r
617 <pre><tt>alias -s tex=vim\r
618 alias -s html=w3m\r
619 alias -s org=w3m</tt></pre>\r
620 </div></div>\r
621 <div class="paragraph"><p>Now pressing return-key after entering <em>foobar.tex</em> starts vim with\r
622 foobar.tex. Calling a html-file runs browser w3m. <em>www.zsh.org</em> and pressing\r
623 enter starts w3m with argument www.zsh.org.<br />\r
624 Global aliases can be used anywhere in the command line. Example:</p></div>\r
625 <div class="listingblock">\r
626 <div class="content">\r
627 <pre><tt>$ alias -g C='| wc -l'\r
628 $ grep alias ~/.zsh/* C\r
629 443</tt></pre>\r
630 </div></div>\r
631 <div class="paragraph"><p>Some more or less useful global aliases (choose whether they are useful  or not\r
632 for you on your own):</p></div>\r
633 <div class="listingblock">\r
634 <div class="content">\r
635 <pre><tt>alias -g ...='../..'\r
636 alias -g ....='../../..'\r
637 alias -g .....='../../../..'\r
638 alias -g CA="2&gt;&amp;1 | cat -A"\r
639 alias -g C='| wc -l'\r
640 alias -g D="DISPLAY=:0.0"\r
641 alias -g DN=/dev/null\r
642 alias -g ED="export DISPLAY=:0.0"\r
643 alias -g EG='|&amp; egrep'\r
644 alias -g EH='|&amp; head'\r
645 alias -g EL='|&amp; less'\r
646 alias -g ELS='|&amp; less -S'\r
647 alias -g ETL='|&amp; tail -20'\r
648 alias -g ET='|&amp; tail'\r
649 alias -g F=' | fmt -'\r
650 alias -g G='| egrep'\r
651 alias -g H='| head'\r
652 alias -g HL='|&amp; head -20'\r
653 alias -g Sk="*~(*.bz2|*.gz|*.tgz|*.zip|*.z)"\r
654 alias -g LL="2&gt;&amp;1 | less"\r
655 alias -g L="| less"\r
656 alias -g LS='| less -S'\r
657 alias -g MM='| most'\r
658 alias -g M='| more'\r
659 alias -g NE="2&gt; /dev/null"\r
660 alias -g NS='| sort -n'\r
661 alias -g NUL="&gt; /dev/null 2&gt;&amp;1"\r
662 alias -g PIPE='|'\r
663 alias -g R=' &gt; /c/aaa/tee.txt '\r
664 alias -g RNS='| sort -nr'\r
665 alias -g S='| sort'\r
666 alias -g TL='| tail -20'\r
667 alias -g T='| tail'\r
668 alias -g US='| sort -u'\r
669 alias -g VM=/var/log/messages\r
670 alias -g X0G='| xargs -0 egrep'\r
671 alias -g X0='| xargs -0'\r
672 alias -g XG='| xargs egrep'\r
673 alias -g X='| xargs'</tt></pre>\r
674 </div></div>\r
675 <h3 id="_completion">COMPLETION</h3><div style="clear:left"></div>\r
676 <div class="paragraph"><p>See also man 1 zshcompctl zshcompsys zshcompwid. zshcompctl is the old\r
677 style of zsh programmable completion, zshcompsys is the new completion\r
678 system, zshcompwid are the zsh completion widgets.</p></div>\r
679 <div class="paragraph"><p>Some functions, like _apt and _dpkg, are very slow. You can use a cache\r
680 in order to proxy the list of  results  (like  the  list  of  available\r
681 debian packages) Use a cache:</p></div>\r
682 <div class="listingblock">\r
683 <div class="content">\r
684 <pre><tt>zstyle ':completion:*' use-cache on\r
685 zstyle ':completion:*' cache-path ~/.zsh/cache</tt></pre>\r
686 </div></div>\r
687 <div class="paragraph"><p>Prevent CVS files/directories from being completed:</p></div>\r
688 <div class="listingblock">\r
689 <div class="content">\r
690 <pre><tt>zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'\r
691 zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'</tt></pre>\r
692 </div></div>\r
693 <div class="paragraph"><p>Fuzzy matching of completions for when you mistype them:</p></div>\r
694 <div class="listingblock">\r
695 <div class="content">\r
696 <pre><tt>zstyle ':completion:*' completer _complete _match _approximate\r
697 zstyle ':completion:*:match:*' original only\r
698 zstyle ':completion:*:approximate:*' max-errors 1 numeric</tt></pre>\r
699 </div></div>\r
700 <div class="paragraph"><p>And  if  you  want  the  number  of  errors  allowed by _approximate to\r
701 increase with the length of what you have typed so far:</p></div>\r
702 <div class="listingblock">\r
703 <div class="content">\r
704 <pre><tt>zstyle -e ':completion:*:approximate:*' \\r
705         max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'</tt></pre>\r
706 </div></div>\r
707 <div class="paragraph"><p>Ignore completion functions for commands you don&#8217;t have:</p></div>\r
708 <div class="listingblock">\r
709 <div class="content">\r
710 <pre><tt>zstyle ':completion:*:functions' ignored-patterns '_*'</tt></pre>\r
711 </div></div>\r
712 <div class="paragraph"><p>With helper functions like:</p></div>\r
713 <div class="listingblock">\r
714 <div class="content">\r
715 <pre><tt>xdvi() { command xdvi ${*:-*.dvi(om[1])} }</tt></pre>\r
716 </div></div>\r
717 <div class="paragraph"><p>you can avoid having to complete at all in many cases, but if  you  do,\r
718 you  might want to fall into menu selection immediately and to have the\r
719 words sorted by time:</p></div>\r
720 <div class="listingblock">\r
721 <div class="content">\r
722 <pre><tt>zstyle ':completion:*:*:xdvi:*' menu yes select\r
723 zstyle ':completion:*:*:xdvi:*' file-sort time</tt></pre>\r
724 </div></div>\r
725 <div class="paragraph"><p>Completing process IDs with menu selection:</p></div>\r
726 <div class="listingblock">\r
727 <div class="content">\r
728 <pre><tt>zstyle ':completion:*:*:kill:*' menu yes select\r
729 zstyle ':completion:*:kill:*'   force-list always</tt></pre>\r
730 </div></div>\r
731 <div class="paragraph"><p>If you end up using a directory  as  argument,  this  will  remove  the\r
732 trailing slash (usefull in ln)</p></div>\r
733 <div class="listingblock">\r
734 <div class="content">\r
735 <pre><tt>zstyle ':completion:*' squeeze-slashes true</tt></pre>\r
736 </div></div>\r
737 <div class="paragraph"><p>cd will never select the parent directory (e.g.: cd ../&lt;TAB&gt;):</p></div>\r
738 <div class="listingblock">\r
739 <div class="content">\r
740 <pre><tt>zstyle ':completion:*:cd:*' ignore-parents parent pwd</tt></pre>\r
741 </div></div>\r
742 <div class="paragraph"><p>Another method for <em>quick change directories</em>. Add this to your ~/.zshrc, then just enter\r
743 &#8220;cd &#8230;./dir&#8221;</p></div>\r
744 <div class="listingblock">\r
745 <div class="content">\r
746 <pre><tt>rationalise-dot() {\r
747   if [[ $LBUFFER = *.. ]]; then\r
748     LBUFFER+=/..\r
749   else\r
750     LBUFFER+=.\r
751   fi\r
752 }\r
753 zle -N rationalise-dot\r
754 bindkey . rationalise-dot</tt></pre>\r
755 </div></div>\r
756 <h3 id="_unsorted_misc_examples">UNSORTED/MISC examples</h3><div style="clear:left"></div>\r
757 <div class="paragraph"><p>Hint: A list of valid glob Qualifiers can be found in zshexpn(1).\r
758 See &#8220;man 1 zshexpn | less -p&#8221; Qualifiers for details.</p></div>\r
759 <div class="listingblock">\r
760 <div class="content">\r
761 <pre><tt># Get the names of all files that *don't* match a pattern *anywhere* on the\r
762 # file (and without ``-L'' because its GNUish)\r
763   $ print -rl -- *(.^e{'grep -q pattern $REPLY'})\r
764   # or\r
765   $ : *(.e{'grep -q pattern $REPLY || print -r -- $REPLY'})\r
766 \r
767 # random numbers\r
768   $ echo $[${RANDOM}%1000]     # random between 0-999\r
769   $ echo $[${RANDOM}%11+10]    # random between 10-20\r
770   $ echo ${(l:3::0:)${RANDOM}} # N digits long (3 digits)\r
771 \r
772 # reverse a word\r
773   $ echo "${(j::)${(@Oa)${(s::):-hello}}}"\r
774 \r
775 # Show newest directory\r
776   $ ls -ld *(/om[1])\r
777 \r
778 # random array element\r
779   $ FILES=( .../files/* )\r
780   $ feh $FILES[$RANDOM%$#FILES+1]\r
781 \r
782 # cat first line in all files in this dir\r
783   $ for file (*(ND-.)) IFS= read -re &lt; $file\r
784 \r
785 # test if a parameter is numeric\r
786   $ if [[ $1 == &lt;-&gt; ]] ; then\r
787          echo numeric\r
788     else\r
789          echo non-numeric\r
790     fi\r
791 \r
792 # Show me all the .c files for which there doesn't exist a .o file.\r
793   $ print *.c(e_'[[ ! -e $REPLY:r.o ]]'_)\r
794 \r
795 # All files in /var/ that are not owned by root\r
796   $ ls -ld /var/*(^u:root)\r
797 \r
798 # All files for which the owner hat read and execute permissions\r
799   $ echo *(f:u+rx:)\r
800 \r
801 # The same, but also others dont have execute permissions\r
802   $ echo *(f:u+rx,o-x:)\r
803 \r
804 # brace expansion - example\r
805   $ X=(A B C)\r
806   $ Y=(+ -)\r
807   $ print -r -- $^X.$^Y\r
808   A.+ A.- B.+ B.- C.+ C.-\r
809 \r
810 # Fetch the newest file containing the string 'fgractg*.log' in the\r
811 # filename and contains the string 'ORA-' in it\r
812   $ file=(fgractg*.log(Nm0om[1]))\r
813   $ (($#file)) &amp;&amp; grep -l ORA- $file\r
814   # without Zsh\r
815   $ files=$( find . -name . -o -prune -name 'fgractg*&gt;log' -mtime 0 -print )\r
816   &gt; if [ -n "$files" ]; then\r
817   &gt;    IFS='\r
818   &gt; '\r
819   &gt; set -f\r
820   &gt; file=$(ls -td $files | head -1)\r
821   &gt; grep -l ORA- "$file"\r
822   &gt; fi\r
823 \r
824 # keep specified number of child processes running until entire task finished\r
825   $ zsh -c 'sleep 1 &amp; sleep 3 &amp; sleep 2&amp; print -rl -- $jobtexts'\r
826 \r
827 # Remove zero length and .bak files in a directory\r
828   $ rm -i *(.L0) *.bak(.)\r
829 \r
830 # print out files that dont have extensions\r
831   $ printf '%s\n' ^?*.*\r
832   $ printf '%s\n' ^?*.[^.]*(D)\r
833   $ ls -d -- ^?*.*(D)\r
834 \r
835 # Finding files which does not contain a specific string\r
836   $ print -rl file* | comm -2 -3 - &lt;(grep -l string file*)'\r
837   $ for f (file*(N)) grep -q string $f || print -r $f'\r
838 \r
839 # Show/Check whether a option is set or not. It works both with $options as\r
840 # with $builtins\r
841   $ echo $options[correct]\r
842   off\r
843   $ $options[zle]\r
844   on\r
845 \r
846 # Count the number of directories on the stack\r
847   $ print $((${${(z)${(f)"$(dirs -v)"}[-1]}[1]} + 1)) # or\r
848   $ dirs -v | awk '{n=$1}END{print n+1}'\r
849 \r
850 # Matching all files which do not have a dot in filename\r
851   $ ls *~*.*(.)\r
852 \r
853 # Show only the ip-address from ``ifconfig device''\r
854   # ifconfig from net-tools (Linux)\r
855   $ print ${${$(LC_ALL=C /sbin/ifconfig eth0)[7]}:gs/addr://}\r
856   # ifconfig from 4.2BSD {Free,Net,Open}BSD\r
857   $ print ${$(/sbin/ifconfig tun0)[6]}\r
858 \r
859 # Ping all the IP addresses in a couple of class C's or all hosts\r
860 # into /etc/hosts\r
861   $ for i in {1..254}; do ping -c 1 192.168.13.$i; done\r
862   or\r
863   $ I=1\r
864   $ while ( [[ $I -le 255 ]] ) ; do ping -1 2 150.150.150.$I; let I++; done\r
865   or\r
866   $ for i in $(sed 's/#.*//' &gt; /etc/hosts | awk '{print $2}')\r
867   : do\r
868   :    echo "Trying $i ... "\r
869   :    ping -c 1 $i ;\r
870   :    echo '============================='\r
871   : done\r
872 \r
873 # load all available modules at startup\r
874   $ typeset -U m\r
875   $ m=()\r
876   $ for md ($module_path) m=($m $md/**/*(*e:'REPLY=${REPLY#$md/}'::r))\r
877   $ zmodload -i $m\r
878 \r
879 # Rename all files within a directory such that their names get a numeral\r
880 # prefix in the default sort order.\r
881   $ i=1; for j in *; do mv $j $i.$j; ((i++)); done\r
882   $ i=1; for f in *; do mv $f $(echo $i | \\r
883     awk '{ printf("%03d", $0)}').$f; ((i++)); done\r
884   $ integer i=0; for f in *; do mv $f $[i+=1].$f; done\r
885 \r
886 # Find (and print) all symbolic links without a target within the current\r
887 # dirtree.\r
888   $ $ file **/*(D@) | fgrep broken\r
889   $ for i in **/*(D@); [[ -f $i || -d $i ]] || echo $i\r
890   $ echo **/*(@-^./=%p)\r
891   $ print -l **/*(-@)\r
892 \r
893 # List all plain files that do not have extensions listed in `fignore'\r
894   $ ls **/*~*(${~${(j/|/)fignore}})(.)\r
895   # see above, but now omit executables\r
896   $ ls **/*~*(${~${(j/|/)fignore}})(.^*)\r
897 \r
898 # Print out files that dont have extensions (require *setopt extendedglob*\r
899 # and *setopt dotglob*)\r
900   $ printf '%s\n' ^?*.*\r
901 \r
902 # List files in reverse order sorted by name\r
903   $ print -rl -- *(On)\r
904   or\r
905   $ print -rl -- *(^on)\r
906 \r
907 # Synonymic to ``ps ax | awk '{print $1}'''\r
908   $ print -l /proc/*/cwd(:h:t:s/self//)\r
909 \r
910 # Get the PID of a process (without ``ps'', ``sed'', ``pgrep'', ..\r
911 # (under Linux)\r
912   $ pid2 () {\r
913   &gt;   local i\r
914   &gt;   for i in /proc/&lt;-&gt;/stat\r
915   &gt; do\r
916   &gt;   [[ "$(&lt; $i)" = *\((${(j:|:)~@})\)* ]] &amp;&amp; echo $i:h:t\r
917   &gt; done\r
918   &gt; }\r
919 \r
920 # for X in 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y'; do ...\r
921   $ for (( i = 36#n; i &lt;= 36#y; i++ )); do\r
922   &gt;   print ${$(([##36]i)):l}\r
923   &gt; done\r
924 # or in combination with ``dc''\r
925   $ print {$((##n))..$((##y))}P\ 10P | dc\r
926 # or with ``eval''\r
927   $ eval print '${$(([##36]'{$((36#n))..$((36#y))}')):l}'\r
928 \r
929 # foreach in one line of shell\r
930   $ for f (*) print -r -- $f\r
931 \r
932 # copy a directory recursively without data/files\r
933   $ dirs=(**/*(/))\r
934   $ cd -- $dest_root\r
935   $ mkdir -p -- $dirs\r
936 # or without zsh\r
937   $ find . -type d -exec env d="$dest_root" \\r
938     sh -c ' exec mkdir -p -- "$d/$1"' '{}' '{}' \;\r
939 \r
940 # If `foo=23'', then print with 10 digit with leading '0'.\r
941   $ foo=23\r
942   $ print ${(r:10::0:)foo}\r
943 \r
944 # find the name of all the files in their home directory that have\r
945 # more than 20 characters in their file names\r
946   print -rl $HOME/${(l:20::?:)~:-}*\r
947 \r
948 # Save arrays\r
949   $ print -r -- ${(qq)m} &gt; $nameoffile      # save it\r
950   $ eval "m=($(cat -- $nameoffile)"            # or use\r
951   $ m=("${(@Q)${(z)"$(cat -- $nameoffile)"}}") # to restore it\r
952 \r
953 # get a "ls -l" on all the files in the tree that are younger than a\r
954 # specified age (e.g "ls -l" all the files in the tree that where\r
955 # modified in the last 2 days)\r
956   $ ls -tld **/*(m-2)\r
957 # This will give you a listing 1 file perl line (not Ã  la ls -R).\r
958 # Think of an easy way to have a "ls -R" style output with\r
959 # only files newer than 2 day old.\r
960   $ for d (. ./**/*(/)) {\r
961   &gt;   print -r -- $'\n'${d}:\r
962   &gt;   cd $d &amp;&amp; {\r
963   &gt;       l=(*(Nm-2))\r
964   &gt;       (($#l)) &amp;&amp; ls -ltd -- $l\r
965   &gt;       cd ~-\r
966   &gt;   }\r
967   &gt; }\r
968 # If you also want directories to be included even if their mtime\r
969 # is more than 2 days old:\r
970   $ for d (. ./**/*(/)) {\r
971   &gt;   print -r -- $'\n'${d}:\r
972   &gt;   cd $d &amp;&amp; {\r
973   &gt;      l=(*(N/,m-2))\r
974   &gt;      (($#l)) &amp;&amp; ls -ltd -- $l\r
975   &gt;      cd ~-\r
976   &gt;   }\r
977   &gt; }\r
978 # And if you want only the directories with mtime &lt; 2 days to be listed:\r
979   $ for d (. ./**/*(N/m-2)) {\r
980   &gt;   print -r -- $'\n'${d}:\r
981   &gt;   cd $d &amp;&amp; {\r
982   &gt;      l=(*(Nm-2))\r
983   &gt;      (($#l)) &amp;&amp; ls -ltd -- $l\r
984   &gt;      cd ~-\r
985   &gt;   }\r
986   &gt; }\r
987 \r
988 # print 42 ``-''\r
989   $ echo ${(l:42::-:)}\r
990 # or use ``$COLUMS''\r
991   $ echo ${(l:$COLUMNS::-:)}\r
992 # and now with colors (require autoload colors ;colors)\r
993   $ echo "$bg[red]$fg[black]${(l:42::-:)}"\r
994 \r
995 # Redirect STDERR to a command like xless without redirecting STDOUT as well.\r
996   $ foo 2&gt;&gt;(xless)\r
997 # but this executes the command asynchronously. To do it synchronously:\r
998   $ { { foo 1&gt;&amp;3 } 2&gt;&amp;1 | xless } 3&gt;&amp;1\r
999 \r
1000 # Rename all MP3-Files from name with spaces.mp3 to Name With Spaces.mp3\r
1001   $ for i in *.mp3; do\r
1002   &gt;     mv $i ${${(C)i}:s/Mp3/mp3/}\r
1003   &gt; done\r
1004 \r
1005 # Match file names containing only digits and ending with .xml (require\r
1006 # *setopt kshglob*)\r
1007   $ ls -l [0-9]##.xml\r
1008   $ ls -l &lt;0-&gt;.xml\r
1009 \r
1010 # Remove all "non txt" files\r
1011   $ rm ./^*.txt\r
1012 \r
1013 # Move 200 files from a directory into another\r
1014   $ mv -- *([1,200]) /another/Dir\r
1015 \r
1016 # Convert images (foo.gif =&gt; foo.png):\r
1017   $ for i in **/*.gif; convert $i $i:r.png\r
1018 \r
1019 # convert a collection of mp3 files to wave or cdr,\r
1020 # e.g. file.wav -&gt; file.mp3)\r
1021   $ for i (./*.mp3){mpg321 --w - $i &gt; ${i:r}.wav}\r
1022 \r
1023 # Download with LaTeX2HTML  created Files (for example the ZSH-Guide):\r
1024   $ for f in http://zsh.sunsite.dk/Guide/zshguide{,{01..08}}.html; do\r
1025   &gt;     lynx -source $f &gt;${f:t}\r
1026   &gt; done\r
1027 \r
1028 # Move all files in dir1 and dir2 that have line counts greater than 10 to\r
1029 # another directory say "/more10"\r
1030   $ mv dir[12]/**/*.cr(-.e{'((`wc -l &lt; $REPLY` &gt; 10))'}) /more10\r
1031 \r
1032 # Make with dpkg a master-list of everyfile that it has installed\r
1033   $ diff &lt;(find / | sort) &lt;(cat /var/lib/dpkg/info/*.list | sort)\r
1034 \r
1035 # Replace this fucking Escape-Sequences:\r
1036   $ autoload colors ; colors\r
1037   $ print "$bg[cyan]$fg[blue]You are a idiot" &gt;&gt; /dev/pts/3\r
1038 \r
1039 # Get ASCII value of a character\r
1040   $ char=N ; print $((#char))\r
1041 \r
1042 # Filename "Erweiterung"\r
1043 # Note: The (N) says to use the nullglob option for this particular\r
1044 # glob pattern.\r
1045   $ for i in *.o(N); do\r
1046   &gt;     rm $i\r
1047   &gt; done\r
1048 \r
1049 # Rename files; i. e. FOO to foo and bar to BAR\r
1050   $ for i in *(.); mv $i ${i:l} # `FOO' to `foo'\r
1051   $ for i in *(.); mv $i ${i:u} # `bar to `BAR'\r
1052 \r
1053 # Show all suid-files in $PATH\r
1054   $ ls -latg ${(s.:.)PATH} | grep '^...s'\r
1055 # or more complex ;)\r
1056   $ print -l ${^path}/*(Ns,S)\r
1057 # or show only executables with a user given pattern\r
1058   $ print -l ${^path}/*vim*(*N)\r
1059 \r
1060 # gzip files when containing a certain string\r
1061   $ gzip ${(ps:\0:)"$(grep -lZ foobar ./*.txt(.))"}\r
1062 \r
1063 # A small  one-liner, that reads from stdin and prints to stdout the first\r
1064 # unique line i. e. does not print lines that have been printed before\r
1065 # (this is similar to the unique command, but unique can only handle\r
1066 # adjacent lines).\r
1067   $ IFS=$'\n\n'; print -rl -- ${(Oau)${(Oa)$(cat file;echo .)[1,-2]}}\r
1068 \r
1069 # Lists every executable in PATH\r
1070   $ print -l ${^path}/*(-*N)\r
1071 \r
1072 # Match all .c files in all subdirectories, _except_ any SCCS subdirectories?\r
1073   $ ls **/*.c~(*/)#SCCS/*\r
1074 \r
1075 # List all `README' - files case-insensitive with max. one typo\r
1076   $ ls **/*(#ia2)readme\r
1077 \r
1078 # case insensitive checking for variables\r
1079   $ if [[ $OSTYPE == (#i)LINUX*(#I) ]]; then\r
1080   &gt;    echo "Penguin on board."\r
1081   &gt; else\r
1082   &gt;    echo "Not a Linux."\r
1083   &gt; fi</tt></pre>\r
1084 </div></div>\r
1085 <h3 id="_recursive_globbing_examples">(Recursive) Globbing - Examples</h3><div style="clear:left"></div>\r
1086 <div class="paragraph"><p>A list of valid glob Qualifiers can be found in zshexpn(1). <strong>Note:</strong>\r
1087 **/ is equivalent to (*/)#! For example:</p></div>\r
1088 <div class="listingblock">\r
1089 <div class="content">\r
1090 <pre><tt>$ print (*/)#zsh_us.ps\r
1091 zsh-4.2.3/Doc/zsh_us.ps\r
1092 $ print **/zsh_us.ps\r
1093 zsh-4.2.3/Doc/zsh_us.ps</tt></pre>\r
1094 </div></div>\r
1095 <div class="listingblock">\r
1096 <div class="content">\r
1097 <pre><tt># Search for `README' in all Subdirectories\r
1098   $ ls -l **/README\r
1099 \r
1100 # find directories that contain both "index.php" and "index.html", or in\r
1101 # general, directories that contain more than one file matching "index.*"\r
1102   $ ls **/*(D/e:'[[ -e $REPLY/index.php &amp;&amp; -e $REPLY/index.html ]]':)\r
1103   # or\r
1104   $ ls **/*(D/e:'l=($REPLY/index.*(N)); (( $#l &gt;= 2 ))':)\r
1105 \r
1106 # Find command to search for directory name instead of basename\r
1107   $ print -rl /**/*~^*/path(|/*)\r
1108   # or - without Zsh\r
1109   $ find / | grep -e /path/ -e '/path$'\r
1110 \r
1111 # Print he path of the directories holding the ten biggest C regular files\r
1112 # in the current directory and subdirectories.\r
1113   $ print -rl -- **/*.c(D.OL[1,10]:h) | sort -u\r
1114 \r
1115 # Find files with size == 0 and send a mail\r
1116   $ files=(**/*(ND.L0m+0m-2))\r
1117   &gt; (( $#files &gt; 0 )) &amp;&amp; print -rl -- $files | \\r
1118     mailx -s "empty files" foo@bar.tdl\r
1119 \r
1120 # recursive chmod\r
1121   $ chmod 700 **/(.) # Only files\r
1122   $ chmod 700 **/(/) # Only directories\r
1123 \r
1124 # print out all of the files in that directory in 2 columns\r
1125   $ print -rC2 -- ${1:[...]}/*(D:t)\r
1126 #            ^- number ob columns\r
1127 # or - if you feel concerned about special characters - use\r
1128   $ list=(${1:[...]}/*(ND:t))\r
1129   $ (($#list)) &amp;&amp; print -rC2 -- ${(V)list}\r
1130 \r
1131 # Search all files in /home/*/*-mail/ with a setting ``chmod -s'' flag\r
1132 # (recursive, include  dotfiles) remove the setgid/setuid flag and print\r
1133 # a message\r
1134   $ chmod -s /home/*/*-mail(DNs,S) /home/*/*-mail/**/*(DNs,S))\r
1135 # or with a small script\r
1136   $ for file (/home/*/*-mail(DNs,S) /home/*/*-mail/**/*(DNs,S)) {\r
1137   &gt;    print -r -- $file\r
1138   &gt;    chmod -s $file &amp;&amp; print -r fixed $file\r
1139   &gt; }\r
1140 # or use ``zargs'' (require autoload zargs) prevent the arg list too\r
1141 # long error\r
1142   $ zargs /home/*/*-mail(DNs,S) /home/*/*-mail/**/*(DNs,S)) -- chmod -s\r
1143 \r
1144 # List files beginning at `foo23' upwards (foo23, foo24, foo25, ..)\r
1145   $ ls -l foo&lt;23-&gt;\r
1146 \r
1147 # get all files that begin with the date strings from June 4 through\r
1148 # June 9 of 2004\r
1149   $ ls -l 200406{04..10}*(N)\r
1150 # or if they are of the form 200406XX (require ``setopt extended_glob''\r
1151   $ ls -l 200306&lt;4-10&gt;.*\r
1152 \r
1153 # remove spaces from filenames\r
1154   $ for a in ./**/*\ *(Dod); do mv $a ${a:h}/${a:t:gs/ /_}; done\r
1155 \r
1156 # Show only all *.c and *.h - Files\r
1157   $ ls -l *.(c|h)\r
1158 \r
1159 # Show only all *.c - files and ignore `foo.c'\r
1160   $ ls *.c~foo.c\r
1161 \r
1162 # show data to *really* binary format\r
1163   $ zsh -ec 'while {} {printf %.8x $n;repeat 8 \\r
1164   &gt; {read -ku0 a printf \ %.8d $(([##2]#a))};print;((n+=8))}' &lt; binary\r
1165 \r
1166 # Show only world-readable files\r
1167   $ ls -l *(R)\r
1168 \r
1169 # List files in the current directory are not writable by the owner\r
1170   $ print -l ~/*(ND.^w)\r
1171 \r
1172 # find and delete the files which are older than a given parameter\r
1173 # (seconds/minutes/hours)\r
1174   # deletes all regular file in /Dir that are older than 3 hours\r
1175    $ rm -f /Dir/**/*(.mh+3)\r
1176   # deletes all symlinks in /Dir that are older than 3 minutes\r
1177    $ rm -f /Dir/**/*(@mm+3)\r
1178   # deletes all non dirs in /Dir that are older than 30 seconds\r
1179    $ rm -f /Dir/**/*(ms+30^/)\r
1180   # deletes all folders, sub-folders and files older than one hour\r
1181    $ rm ./**/*(.Dmh+1,.DL0)\r
1182   # deletes all files more than 6 hours old\r
1183    $ rm -f **/*(mh+6)\r
1184   # removes all files but the ten newer ones (delete all but last 10\r
1185   # files in a directory)\r
1186    $ rm ./*(Om[1,-11])\r
1187  Note: If you get a arg list too long, you use the builtin rm. For\r
1188        example:\r
1189    $ zmodload zsh/files ; rm -f **/*(mh+6)\r
1190   or use the zargs function:\r
1191    $ autoload zargs ; zargs **/*(mh+6) -- rm -f\r
1192 \r
1193 # A User's Guide to the Z-Shell /5.9: Filename Generation and Pattern\r
1194 # Matching find all files in all subdirectories, searching recursively,\r
1195 # which have a given name, case insensitive, are at least 50 KB large,\r
1196 # no more than a week old and owned by the root user, and allowing up\r
1197 # to a single error in the spelling of the name. In fact, the required\r
1198 # expression looks like this:\r
1199   $ ls **/(#ia1)name(LK+50mw-1u0)\r
1200 \r
1201 # Change the UID from 102 to 666\r
1202   $ chown 666 **/*(u102)\r
1203 \r
1204 # List all files which have not been updated since last 10 hours\r
1205   $ print -rl -- *(Dmh+10^/)\r
1206 \r
1207 # delete only the oldest file in a directory\r
1208   $ rm ./*filename*(Om[1])\r
1209 \r
1210 # Sort the output from `ls -l' by file size\r
1211   $ ls -fld *(OL)\r
1212 \r
1213 # find most recent file in a directory\r
1214   $ setopt dotglob ; print directory/**/*(om[1])\r
1215 \r
1216 # Show only empty files which nor `group' or `world writable'\r
1217   $ ls *(L0f.go-w.)\r
1218 \r
1219 # Find - and list - the ten newest files in directories and subdirs.\r
1220 # (recursive)\r
1221   $ print -rl -- **/*(Dom[1,10])\r
1222 \r
1223 # Print only 5 lines by "ls" command (like ``ls -laS | head -n 5'').\r
1224   $ ls -fl *(DOL[1,5])\r
1225 \r
1226 # Display the 5-10 last modified files.\r
1227   $ print -rl -- /path/to/dir/**/*(D.om[5,10])\r
1228 \r
1229 # Find all files without a valid owner.\r
1230   $ chmod someuser /**/*(D^u:${(j.:u:.)${(f)"$(&lt;/etc/passwd)"}%%:*}:)\r
1231 \r
1232 # Find all the empty directories in a tree.\r
1233   $ for f in ***/*(/l2); do foo=($f/*(N)); [[ -z $foo ]] &amp;&amp; print $f; done\r
1234 # Note:Since Zsh 4.2.1 the glob qualifier F indicates a non-empty directory.\r
1235 # Hence *(F) indicates all subdirectories with entries, *(/^F) means all\r
1236 # subdirectories with no entries.\r
1237   $ ls -ld *(/^F)\r
1238 \r
1239 # Remove empty directories afterwards.\r
1240   $ rmdir ./**/*(/od) 2&gt; /dev/null\r
1241 \r
1242 # Show only files which are owned by group `users'.\r
1243   $ ls -l *(G[users])</tt></pre>\r
1244 </div></div>\r
1245 <h3 id="_modifiers_usage">Modifiers usage</h3><div style="clear:left"></div>\r
1246 <div class="paragraph"><p>Modifiers are a powerful mechanism that let you modify the results\r
1247 returned by parameter, filename and history expansion. See zshexpn(1)\r
1248 for details.</p></div>\r
1249 <div class="listingblock">\r
1250 <div class="content">\r
1251 <pre><tt># NOTE: Zsh 4.3.4 needed!\r
1252   $ autoload -U age\r
1253 # files modified today\r
1254   $ print *(e:age today now:)\r
1255 # files modified since 5 pm\r
1256   $ print *(e-age 17:00 now-)\r
1257 # ... since 5 o'clock yesterda\r
1258   $ print *(e-age yesterday,17:00 now-)\r
1259 # ... from last Christmas before today\r
1260   $ print *(e-age 2006/12/25 today-)\r
1261 # ... before yesterday\r
1262   $ print *(e-age 1970/01/01 yesterday-)\r
1263 # all files modified between the start of those dates\r
1264   $ print *(e:age 2006/10/04 2006/10/09:)\r
1265 # all files modified on that date\r
1266   $ print *(e:age 2006/10/04:)\r
1267 # Supply times.\r
1268   $ print *(e-age 2006/10/04:10:15 2006/10/04:10:45-)\r
1269 \r
1270 # Remove a trailing pathname component, leaving the head. This works like\r
1271 # `dirname'.\r
1272   $ echo =ls(:h)\r
1273   /bin\r
1274 \r
1275 # Remove all leading pathname components, leaving the tail. This works\r
1276 # like `basename'.\r
1277   $ echo =ls(:t)\r
1278   ls\r
1279 \r
1280 # Remove the suffix from each file (*.sh in this example)\r
1281    $f:e is $f file extension\r
1282    :h --&gt; head (dirname)\r
1283    :t --&gt; tail (basename)\r
1284    :r --&gt; rest (extension removed)\r
1285   $ for f (*.sh) mv $f $f:r\r
1286 \r
1287 # Remove a filename extension of the form `.xxx', leaving the root name.\r
1288   $ echo $PWD\r
1289   /usr/src/linux\r
1290   $ echo $PWD:t\r
1291   linux\r
1292 \r
1293 # Remove all but the extension.\r
1294   $ foo=23.42\r
1295   $ echo $foo\r
1296   23.42\r
1297   $ echo $foo:e\r
1298   42\r
1299 \r
1300 # Print the new command but do not execute it. Only works with history\r
1301 # expansion.\r
1302   $ echo =ls(:h)\r
1303   /bin\r
1304   $ !echo:p\r
1305   $ echo =ls(:h)\r
1306 \r
1307 # Quote the substituted words, escaping further substitutions.\r
1308   $ bar="23'42"\r
1309   $ echo $bar\r
1310   23'42\r
1311   $ echo $bar:q\r
1312   23\'42\r
1313 \r
1314 # Convert the words to all lowercase.\r
1315   $ bar=FOOBAR\r
1316   $ echo $bar\r
1317   FOOBAR\r
1318   $ echo $bar:l\r
1319   foobar\r
1320 \r
1321 # Convert the words to all uppercase.\r
1322   $ bar=foobar\r
1323   $ echo $bar\r
1324   foobar\r
1325   $ echo $bar:u\r
1326   FOOBAR\r
1327 \r
1328 # convert 1st char of a word to uppercase\r
1329   $ foo="one two three four"\r
1330   $ print -r -- "${(C)foo}"\r
1331   One Two Three Four</tt></pre>\r
1332 </div></div>\r
1333 <h3 id="_redirection_examples">Redirection-Examples</h3><div style="clear:left"></div>\r
1334 <div class="paragraph"><p>See zshmisc(1) for more informations (or less ${^fpath}/zmv(N))</p></div>\r
1335 <div class="listingblock">\r
1336 <div class="content">\r
1337 <pre><tt># Append `exit 1' at the end of all *.sh - files\r
1338   $ echo "exit 1" &gt;&gt; *.sh\r
1339 \r
1340 # adding files to foobar.tar.gz\r
1341   $ eval set =(gunzip &lt; foobar.tar.gz) '\r
1342      tar rf $1 additional.txt &amp;&amp;gzip &lt; $1 &gt; foobar.tar.gz'\r
1343 \r
1344 # Redirect output to a file AND display on screen\r
1345   $ foobar &gt;&amp;1 &gt; file1 &gt; file2 &gt; ..\r
1346 \r
1347 # pipe single output to multiple inputs\r
1348   $ zcat foobar.Z &gt;&gt; (gzip -9 &gt; file1.gz) \\r
1349       &gt;&gt; (bzip2 -9 &gt; file1.bz2) \\r
1350       &gt;&gt; (acb --best &gt; file1.acb)\r
1351 \r
1352 # Append /etc/services at the end of file `foo' and `bar'\r
1353   $ cat /etc/services &gt;&gt; foo &gt;&gt; bar\r
1354 \r
1355 # Pipe STDERR\r
1356   $ echo An error &gt;&amp;2 2&gt;&amp;1 | sed -e 's/A/I/'\r
1357 \r
1358 # send standard output of one process to standard input of several processes\r
1359 # in the pipeline\r
1360   $ setopt multios\r
1361   $ process1 &gt; &gt;(process1) &gt; &gt;(process2)\r
1362 \r
1363 # initializing a variable and simultaneously keeping terminal output\r
1364   $ setopt multios\r
1365   $ { a=$(command &gt;&amp;1 &gt;&amp; 3 3 &gt; &amp;- 2&gt;&amp;1);} 3&gt;&amp;1\r
1366 \r
1367 # redirect stderr two times\r
1368   $ setopt multios ; program 2&gt; file2 &gt; file1 2&gt;&amp;1\r
1369 \r
1370 # Duplicating stdout and stderr to a logfile\r
1371   $ exec 3&gt;&amp;1 &gt; logfile 2&gt;&amp;2 2&gt;&amp;1 &gt;&amp;3 3&gt;&amp;-\r
1372 \r
1373 # redirect stderr (only) to a file and to orig. stderr:\r
1374   $ command 2&gt;&amp;2 2&gt;stderr\r
1375 # redirect stderr and stdout to separate files and both to orig. stdout:\r
1376   $ command 2&gt;&amp;1 1&gt;&amp;1 2&gt;stderr 1&gt;stdout\r
1377 # redirect stderr and stdout to separate files and stdout to orig. stdout\r
1378 # AND stderr to orig. stderr:\r
1379   $ command 2&gt;&amp;2 1&gt;&amp;1 2&gt;stderr 1&gt;stdout\r
1380 \r
1381 # More fun with STDERR ;)\r
1382   $ ./my-script.sh 2&gt; &gt;(grep -v moron &gt;error.log)|process-output &gt;output.log\r
1383   $  echo "Thats STDOUT" &gt;&gt;(sed 's/stdout/another example/' &gt; foobar)</tt></pre>\r
1384 </div></div>\r
1385 <h3 id="_zmv_examples_require_autoload_zmv">ZMV-Examples (require autoload zmv)</h3><div style="clear:left"></div>\r
1386 <div class="paragraph"><p><strong>Note:</strong> <em>-n</em> means no execution (just print what would happen). At</p></div>\r
1387 <div class="listingblock">\r
1388 <div class="content">\r
1389 <pre><tt># Remove illegal characters in a fat32 file system. Illegal characters are\r
1390 #   / :  ;  *  ?  "  &lt;  &gt;  |\r
1391 # NOTE: ``-Q'' and (D) is to include hidden files.\r
1392   $ unwanted='[:;*?\"&lt;&gt;|]'\r
1393   $ zmv -Q "(**/)(*$~unwanted*)(D)" '$1${2//$~unwanted/}'\r
1394 \r
1395 # Changing part of a filename (i. e. "file-hell.name" -&gt; "file-heaven.name")\r
1396   $ zmv '(*)hell(*)' '${1}heaven${2}'\r
1397   # or\r
1398   $ zmv '*' '$f:s/hell/heaven/'\r
1399 \r
1400 # remove round bracket within filenames\r
1401 # i. e. foo-(bar).avi -&gt; foo-bar.avi\r
1402   $ zmv '*' '${f//[()]/}'\r
1403 \r
1404 # serially all files (foo.foo &gt; 1.foo, fnord.foo &gt; 2.foo, ..)\r
1405   $ autoload zmv\r
1406   $ ls *\r
1407   1.c  asd.foo  bla.foo  fnord.foo  foo.fnord  foo.foo\r
1408   $ c=1 zmv '*.foo' '$((c++)).foo'\r
1409   $ ls *\r
1410   1.c  1.foo  2.foo  3.foo  4.foo  foo.fnord\r
1411 \r
1412 # Rename "file.with.many.dots.txt" by substituting dots (exept for the last\r
1413 # one!) with a space\r
1414   $ touch {1..20}-file.with.many.dots.txt\r
1415   $ zmv '(*.*)(.*)' '${1//./ }$2'\r
1416 \r
1417 # Remove the first 4 chars from a filename\r
1418   $ zmv -n '*' '$f[5,-1]' # NOTE: The "5" is NOT a mistake in writing!\r
1419 \r
1420 # Rename names of all files under the current Dir to lower case, but keep\r
1421 # dirnames as-is.\r
1422   $ zmv -Qv '(**/)(*)(.D)' '$1${(L)2}'\r
1423 \r
1424 # replace all 4th character, which is "1",  with "2" and so on\r
1425   $ autoload -U zmv\r
1426   $ zmv '(???)1(???[1-4].txt)' '${1}2${2}'\r
1427 \r
1428 # Remove the first 15 characters from a string\r
1429   $ touch 111111111111111{a-z}\r
1430   $ autoload zmv\r
1431   $ zmv '*' '$f[16,-1]'\r
1432 \r
1433 # Replace spaces (any number of them) with a single dash in file names\r
1434   $ autload zmv\r
1435   $ zmv -n '(**/)(* *)' '$1${2//( #-## #| ##)/-}'\r
1436   # or - with Bash\r
1437   $ find . -depth -name '* *' -exec bash -c '\r
1438   &gt; shopt -s extglob\r
1439   &gt; file=$1\r
1440   &gt; dir=${file%/*}\r
1441   &gt; name=${file##*/}\r
1442   &gt; newname=${name//*([ -]) *([ -])/-}\r
1443   &gt; mv -i -- "$file" "$Dir/$newname"' {} {} \;\r
1444 \r
1445 # Clean up file names and remove special characters\r
1446   $ autoload zmv\r
1447   $ zmv -n '(**/)(*)' '$1${2//[^A-Za-z0-9._]/_}'\r
1448 \r
1449 # Add *.py to a bunch of python scripts in a directory (some of them end\r
1450 # in *.py and give them all a proper extension\r
1451   $ autoload zmv\r
1452   $ zmv -n '(**/)(con*)(#qe,file $REPLY | grep "python script",)' '$1$2.py'\r
1453 \r
1454 # lowercase all extensions (i. e. *.JPG) incl. subfolders\r
1455   $ autoload zmv\r
1456   $ zmv '(**/)(*).(#i)jpg' '$1$2.jpg'\r
1457   # Or - without Zsh\r
1458   $ find Dir -name '*.[jJ][pP][gG]' -print | while read f\r
1459   &gt; do\r
1460   &gt;      case $f in\r
1461   &gt;       *.jpg) ;\r
1462   &gt;       *) mv "$f" "${f%.*}.jpg" ;\r
1463   &gt;       esac\r
1464   &gt; done\r
1465 \r
1466 # remove leading zeros from file extension\r
1467   $ autoload zmv\r
1468   $ ls\r
1469   filename.001  filename.003  filename.005  filename.007  filename.009\r
1470   filename.002  filename.004  filename.006  filename.008  filename.010\r
1471   $ zmv '(filename.)0##(?*)' '$1$2'\r
1472   $ ls\r
1473   filename.1  filename.10  filename.2  filename.3  filename.4  filename.5 ..\r
1474 \r
1475 # renumber files.\r
1476   $ autoload zmv\r
1477   $ ls *\r
1478   foo_10.jpg  foo_2.jpg  foo_3.jpg  foo_4.jpg  foo_5.jpg  foo_6.jpg ..\r
1479   $ zmv -fQ 'foo_(&lt;0-&gt;).jpg(.nOn)' 'foo_$(($1 + 1)).jpg'\r
1480   $ ls *\r
1481   foo_10.jpg  foo_11.jpg  foo_3.jpg  foo_4.jpg  foo_5.jpg  ...\r
1482 \r
1483 # adding leading zeros to a filename (1.jpg -&gt; 001.jpg, ..\r
1484   $ autoload zmv\r
1485   $ zmv '(&lt;1-&gt;).jpg' '${(l:3::0:)1}.jpg'\r
1486 \r
1487 # See above, but now only files with a filename &gt;= 30 chars\r
1488   $ autoload zmv\r
1489   $ c=1 zmv "${(l:30-4::?:)}*.foo" '$((c++)).foo'\r
1490 \r
1491 # Replace spaces in filenames with a underline\r
1492   $ autoload zmv\r
1493   $ zmv '* *' '$f:gs/ /_'\r
1494 \r
1495 # Change the suffix from *.sh to *.pl\r
1496   $ autoload zmv\r
1497   $ zmv -W '*.sh' '*.pl'\r
1498 \r
1499 # Add a "".txt" extension to all the files within ${HOME}\r
1500   # ``-.'' is to only rename regular files or symlinks to regular files,\r
1501   # ``D'' is to also rename hidden files (dotfiles))\r
1502   $ autoload zmv\r
1503   $ zmv -Q '/home/**/*(D-.)' '$f.txt'\r
1504   # Or to only rename files that don't have an extension:\r
1505   $ zmv -Q '/home/**/^?*.*(D-.)' '$f.txt'\r
1506 \r
1507 # Recursively change filenames with characters ? [ ] / = + &lt; &gt; ; : " , - *\r
1508   $ autoload zmv\r
1509   $ chars='[][?=+&lt;&gt;;",*-]'\r
1510   $ zmv '(**/)(*)' '$1${2//$~chars/%}'\r
1511 \r
1512 # Removing single quote from filenames (recursively)\r
1513   $ autoload zmv\r
1514   $ zmv -Q "(**/)(*'*)(D)" "\$1\${2//'/}"\r
1515 \r
1516 # When a new file arrives (named file.txt) rename all files in order to\r
1517 # get (e. g. file119.txt becomes file120.txt, file118.txt becomes\r
1518 # file119.txt and so on ending with file.txt becoming file1.txt\r
1519   $ autoload zmv\r
1520   $ zmv -fQ 'file([0-9]##).txt(On)' 'file$(($1 + 1)).txt'\r
1521 \r
1522 # lowercase/uppercase all files/directories\r
1523   $ autoload zmv\r
1524   $ zmv '(*)' '${(L)1}' # lowercase\r
1525   $ zmv '(*)' '${(U)1}' # uppercase\r
1526 \r
1527 # Remove the suffix *.c from all C-Files\r
1528   $ autoload zmv\r
1529   $ zmv '(*).c' '$1'\r
1530 \r
1531 # Uppercase only the first letter of all *.mp3 - files\r
1532   $ autoload zmv\r
1533   $ zmv '([a-z])(*).mp3' '${(C)1}$2.mp3'\r
1534 \r
1535 # Copy the target `README' in same directory as each `Makefile'\r
1536   $ autoload zmv\r
1537   $ zmv -C '(**/)Makefile' '${1}README'\r
1538 \r
1539 # Removing single quote from filenames (recursively)\r
1540   $ autoload zmv\r
1541   $ zmv -Q "(**/)(*'*)(D)" "\$1\${2//'/}"\r
1542 \r
1543 # Rename pic1.jpg, pic2.jpg, .. to pic0001.jpg, pic0002.jpg, ..\r
1544   $ autoload zmv\r
1545   $ zmv 'pic(*).jpg' 'pic${(l:4::0:)1}.jpg'\r
1546   $ zmv '(**/)pic(*).jpg' '$1/pic${(l:4::0:)2}.jpg' # recursively</tt></pre>\r
1547 </div></div>\r
1548 <h3 id="_module_examples">Module-Examples</h3><div style="clear:left"></div>\r
1549 <div class="paragraph"><p>Please read zshmodules(1) first!</p></div>\r
1550 <h4 id="_zsh_pcre_require_zmodload_zsh_pcre">zsh/pcre (require zmodload zsh/pcre)</h4>\r
1551 <div class="listingblock">\r
1552 <div class="content">\r
1553 <pre><tt># Copy files of a certain period (date indicated in the filenames)\r
1554   $ zmodload zsh/pcre\r
1555   $ ls -d -- *(e:'[[ $REPLY -pcre-match pcre-regexp ]]':)\r
1556   # or\r
1557   $ m() { [[ $1 -pcre-match pcre-regexp ]] }\r
1558   $ ls -d -- *(+m)</tt></pre>\r
1559 </div></div>\r
1560 <h4 id="_zsh_clone_require_zmodload_zsh_clone">zsh/clone (require zmodload zsh/clone)</h4>\r
1561 <div class="listingblock">\r
1562 <div class="content">\r
1563 <pre><tt># Creates a forked instance of the current shell ($! is set to zero) and\r
1564 # execute ``command'' on /dev/tty8 (for this example).\r
1565   $ zmodload zsh/clone\r
1566   $ clone /dev/tty8 &amp;&amp; (($! == 0)) &amp;&amp; exec command</tt></pre>\r
1567 </div></div>\r
1568 <h4 id="_zsh_datetime_require_zmodload_zsh_datetime">zsh/datetime (require zmodload zsh/datetime)</h4>\r
1569 <div class="listingblock">\r
1570 <div class="content">\r
1571 <pre><tt>  $ zmodload zsh/datetime\r
1572   $ alias datereplacement='strftime "%Y-%m-%d" $EPOCHSECONDS'\r
1573   $ export DATE=`datereplacement`\r
1574   $ echo $DATE\r
1575 \r
1576 #  strip date from filename\r
1577   $ $ zmodload zsh/datetime\r
1578   $ setopt extendedglob\r
1579   $ touch aaa_bbb_20041212_c.dat eee_fff_20051019_g.dat\r
1580   $ strftime -s pattern \\r
1581     '???_???_&lt;0-%Y%m%d&gt;_?.dat' $((EPOCHSECONDS - 365 * 24 * 60 * 60 / 2))\r
1582   $ print -rl -- $~pattern\r
1583   aaa_bbb_20041212_c.dat\r
1584   $ print -rl -- $pattern\r
1585   ???_???_&lt;0-20050815&gt;_?.dat\r
1586 \r
1587 # Search files size == 0, to be based on the file name containing a date\r
1588 # rather than the "last modified" date of the file\r
1589   $ zmodload -i zsh/datetime\r
1590   $ strftime -s file "abc_de_%m%d%Y.dat" $((EPOCHSECONDS - 24 * 60 * 60 ))\r
1591   $ files=(**/$file(N.L0))\r
1592   $ (( $#files &gt; 0 )) &amp;&amp; print -rl -- $files | \\r
1593     mailx -s "empty files"  foo@bar.tdl</tt></pre>\r
1594 </div></div>\r
1595 <h4 id="_zsh_stat_require_zmodload_zsh_stat">zsh/stat (require zmodload zsh/stat)</h4>\r
1596 <div class="listingblock">\r
1597 <div class="content">\r
1598 <pre><tt># test if a symbolic link links to a certain file\r
1599   $ zmodload -i zsh/stat\r
1600   $ ! stat -LH s foo.ln || [[ $s[link] != "foo.exe" ]] || ln -sf foo.exe foo.ln\r
1601 \r
1602 # comparing file dates\r
1603   $ zmodload zsh/stat\r
1604   $ file1=foo\r
1605   $ file2=bar\r
1606   $ touch bar &amp; sleep 5 &amp; touch foo\r
1607   $ echo $file1 is $(($(stat +mtime $file2) - \\r
1608     $(stat +mtime $file1))) seconds older than $file2.\r
1609   bar is 5 seconds older than foo\r
1610 \r
1611 # list the files of a disk smaller than some other file\r
1612   $ zmodload zsh/stat\r
1613   $ stat -A max +size some-other-file\r
1614   $ print -rl ./**/*(D.L-$max)\r
1615 \r
1616 # List the top 100 biggest files in a disk\r
1617   $ zmodload zsh/stat\r
1618   $ ls -fld ./**/*(d`stat +device .`OL[1,100])\r
1619 \r
1620 # Get only the user name and the file names from (like\r
1621 # ls -l * | awk '{print $3" " $8}')\r
1622   $ zmodload zsh/stat\r
1623   $ for file; do\r
1624   &gt;   stat -sA user +uid -- "$file" &amp;&amp;\r
1625   &gt;     print -r -- "$user" "$file"\r
1626   &gt; done\r
1627 \r
1628 # get the difference between actual bytes of file and allocated bytes of file\r
1629   $ zmodload zsh/stat\r
1630   $ print $(($(stat +block -- file) * 512 - $(stat +size -- file)))\r
1631 \r
1632 # Find largest file\r
1633 # ``D''  : to include dot files (d lowercase is for device)\r
1634 # ``O''  : reverse Ordered (o lowercase for non-reverse order)\r
1635 # ``L''  : by file Length (l is for number of links)\r
1636 # ``[1]'': return only first one\r
1637   $ zmodload zsh/stat\r
1638   $ stat +size ./*(DOL[1])\r
1639 \r
1640 # file size in bytes\r
1641   $ zmodload zsh/stat\r
1642   $ stat -L +size ~/.zshrc\r
1643   4707\r
1644 \r
1645 # Delete files in a directory that hasn't been accessed in the last ten days\r
1646 # and send ONE mail to the owner of the files informing him/her of the files'\r
1647 # deletion.\r
1648   $ zmodload zsh/stat zsh/files\r
1649   $ typeset -A f; f=()\r
1650   $ rm -f /path/**/*(.a+10e{'stat -sA u +uidr $REPLY; f[$u]="$f[$u]$REPLY"'})\r
1651   $ for user (${(k)f}) {print -rn $f[$user]|mailx -s "..." $user}\r
1652 \r
1653 # Get a "ls -l" on all the files in the tree that are younger than a\r
1654 # specified age\r
1655   $ zmodload zsh/stat\r
1656   $ for d (. ./**/*(N/m-2))\r
1657   &gt;   print -r -- $'\n'$d: &amp;&amp; cd $d &amp;&amp; {\r
1658   &gt;      for f (*(Nm-2om))\r
1659   &gt;   stat -F '%b %d %H:%M' -LsAs -- $f &amp;&amp;\r
1660   &gt;   print -r -- $s[3] ${(l:4:)s[4]} ${(l:8:)s[5]} \\r
1661   &gt;   ${(l:8:)s[6]} ${(l:8:)s[8]} $s[10] $f ${s[14]:+-&gt; $s[14]}\r
1662   &gt;   cd ~-\r
1663   &gt; }\r
1664 \r
1665 # get file creation date\r
1666   $ zmodload zsh/stat\r
1667   $ stat -F '%d %m %Y' +mtime ~/.zshrc\r
1668   30 06 2004\r
1669   $ stat -F '%D' +mtime ~/.zshrc\r
1670   06/30/04</tt></pre>\r
1671 </div></div>\r
1672 <h4 id="_zsh_files_require_zmodload_zsh_files">zsh/files (require zmodload zsh/files)</h4>\r
1673 <div class="listingblock">\r
1674 <div class="content">\r
1675 <pre><tt># search a directory for files containing a certain string then copy those\r
1676 # files to another directory.\r
1677   $ zmodload zsh/files\r
1678   $ IFS=$'\0'\r
1679   $ cp $(grep -lZr foobar .) otherdirectory</tt></pre>\r
1680 </div></div>\r
1681 <h4 id="_zsh_mapfile_require_zmodload_zsh_mapfile">zsh/mapfile (require zmodload zsh/mapfile)</h4>\r
1682 <div class="listingblock">\r
1683 <div class="content">\r
1684 <pre><tt># grepping for two patterns\r
1685   $ zmodload zsh/mapfile\r
1686   $ pattern1="foo"\r
1687   $ pattern2="bar foo"\r
1688   $ print -l ./**/*(DN.e{'z=$mapfile[$REPLY] &amp;&amp; [[ $z = *$pattern1* &amp;&amp; \\r
1689     $z = *$pattern2* ]]'})\r
1690 # or a solution in combination with zsh/pcre\r
1691   $ zmodload -i zsh/mapfile zsh/pcre\r
1692   $ pattern1="foo"\r
1693   $ pattern2="bar foo"\r
1694   $ pcre_compile "(?s)(?=.*?$pattern1).*?$pattern2"\r
1695   $ pcre_study\r
1696   $ print -l ./**/*(DN.e{'pcre_match $mapfile[$REPLY]'})\r
1697 \r
1698 # equivalent for ``less /etc/passwd | grep -v root''\r
1699   $ zmodload zsh/mapfile\r
1700   $ IFS=$'\n\n'\r
1701   $ print -rl -- ${${=mapfile[/etc/passwd]}:#*root*}\r
1702 # or - for case insensitive\r
1703   $ setopt extendedglob\r
1704   $ print -rl -- ${${=mapfile[/etc/passwd]}:#*(#i)root*}\r
1705 \r
1706 # If a XML-file contains stuff like ``&lt;TAGA/&gt;'' and ``&lt;TAGB/&gt;'', number\r
1707 # this empty tags (ones ending in '/&gt;') so if encountered in the same\r
1708 # order, the preceeding tags would become ``&lt;TAGA/&gt;1&lt;/TAGA&gt;'' and\r
1709 # ``&lt;TAGB/&gt;2&lt;/TAGB&gt;''\r
1710   $ zmodload zsh/mapfile\r
1711   $ cnt=0\r
1712   $ apfile[data.xml.new]=${(S)mapfile[data.xml]//\\r
1713   &gt; (#im)&lt;TAGA&gt;*&lt;\/TAGA&gt;/&lt;TAGA&gt;$((++cnt))&lt;\/TAGA&gt;}\r
1714 \r
1715 # removing all files in users Maildir/new that contain ``filename="gone.src''\r
1716   $ zmodload zsh/{files,mapfile}\r
1717   $ rm -f /u1/??/*/Maildir/new/100*(.e{'[[ $mapfile[$REPLY] == \\r
1718     *filename=\"gone.scr\"* ]]'})\r
1719 \r
1720 # Grep out the Title from a postscript file and append that value to the\r
1721 # end of the filename\r
1722   $ autoload -U zmv\r
1723   $ zmodload zsh/mapfile\r
1724   $ zmv '(*).ps' '$1-${${${mapfile[$f]##*%%Title: }%% *}//[^a-zA-Z0-9_]/}.ps'</tt></pre>\r
1725 </div></div>\r
1726 <h4 id="_zsh_mathfunc_require_zmodload_zsh_mathfunc">zsh/mathfunc (require zmodload zsh/mathfunc)</h4>\r
1727 <div class="listingblock">\r
1728 <div class="content">\r
1729 <pre><tt>$ zmodload zsh/mathfunc\r
1730 $ echo $(( sin(1/4.0)**2 + cos(1/4.0)**2 - 1 ))\r
1731   -1.1102230246251565e-16\r
1732 $ echo $(( pi = 4.0 * atan(1.0) ))\r
1733   3.1415926535897931\r
1734 $ echo $(( f = sin(0.3) ))\r
1735   0.29552020666133955\r
1736 $ print $((1e12 * rand48()))\r
1737   847909677310.23413\r
1738 $ print $(( rand48(seed) ))\r
1739   0.01043488334700271</tt></pre>\r
1740 </div></div>\r
1741 <h4 id="_zsh_termcap_require_zmodload_zsh_termcap">zsh/termcap (require zmodload zsh/termcap)</h4>\r
1742 <div class="listingblock">\r
1743 <div class="content">\r
1744 <pre><tt> $ zmodload -ab zsh/termcap echotc\r
1745  $ GREEN=`echotc AF 2`\r
1746  $ YELLOW=`echotc AF 3`\r
1747  $ RED=`echotc AF 1`\r
1748  $ BRIGHTRED=`echotc md ; echotc AF 1`\r
1749  $ print -l ${GREEN}green ${YELLOW}yellow ${RED}red ${BRIGHTRED}brightred</tt></pre>\r
1750 </div></div>\r
1751 <h4 id="_zsh_zpty_require_zmodload_zsh_zpty">zsh/zpty (require zmodload zsh/zpty)</h4>\r
1752 <div class="listingblock">\r
1753 <div class="content">\r
1754 <pre><tt>  $ zmodload zsh/zpty\r
1755   $ zpty PW passwd $1\r
1756   $ zpty PW passwd $1\r
1757 # ``-r'': read the output of the command name.\r
1758 # ``z'' : Parameter\r
1759   $ zpty -r PW z '*password:'\r
1760 # send the to command name the given strings as input\r
1761   $ zpty -w PW $2\r
1762   $ zpty -r PW z '*password:'\r
1763   $ zpty -w PW $2\r
1764 # The second form, with the -d option, is used to delete commands\r
1765 # previously started, by supplying a list of their names. If no names\r
1766 # are given, all commands are deleted. Deleting a command causes the HUP\r
1767 # signal to be sent to the corresponding process.\r
1768   $ zpty -d PW</tt></pre>\r
1769 </div></div>\r
1770 <h4 id="_zsh_net_socket_require_zmodload_zsh_net_socket">zsh/net/socket (require zmodload zsh/net/socket)</h4>\r
1771 <div class="listingblock">\r
1772 <div class="content">\r
1773 <pre><tt># ``-l'': open a socket listening on filename\r
1774 # ``-d'': argument will be taken as the target file descriptor for the\r
1775 #         connection\r
1776 # ``3'' : file descriptor. See ``A User's Guide to the Z-Shell''\r
1777 #         (3.7.2: File descriptors)\r
1778   $ zmodload zsh/net/socket\r
1779   $ zsocket -l -d 3\r
1780 # ``-a'': accept an incoming connection to the socket\r
1781   $ zsocket -a -d 4 3\r
1782   $ zsocket -a -d 5 3 # accept a connection\r
1783   $ echo foobar &gt;&amp;4\r
1784   $ echo barfoo &gt;&amp;5\r
1785   $ 4&gt;&amp;- 5&gt;&amp;- 3&gt;&amp;</tt></pre>\r
1786 </div></div>\r
1787 <h4 id="_zsh_zftp_require_zmodload_zsh_zftp">zsh/zftp (require zmodload zsh/zftp)</h4>\r
1788 <div class="listingblock">\r
1789 <div class="content">\r
1790 <pre><tt> $ autoload -U zfinit\r
1791  $ zfinit\r
1792  $ zfparams www.example.invalid myuserid mypassword\r
1793  $ zfopen\r
1794  $ zfcd tips\r
1795  $ zfls -l zshtips.html\r
1796  $ zfput zshtips.html\r
1797  $ zfls -l zshtips.html\r
1798 \r
1799 # Automatically transfer files using FTP with error checking\r
1800   $ autoload -U zfinit ; zfinit\r
1801   $ zftp open host.name.invalid user passwd || exit\r
1802   $ zftp get /remote/file &gt; /local/file; r=$?\r
1803   $ zftp close &amp;&amp; exit r\r
1804 \r
1805 # compress and ftp on the fly\r
1806   $ autoload -U zfinit ; zfinit\r
1807   $ zftp open host.name.invalid user password\r
1808   $ zftp get $file | bzip2 &gt; ${file}.bz2\r
1809   $ zftp close\r
1810 \r
1811 # Recursice ``get''\r
1812   $ autoload -U zfinit ; zfinit\r
1813   $ zfanon cr.yp.to\r
1814   $ zfcd daemontools\r
1815   $ for file in `zfls` ; do\r
1816   &gt;     zfget $file\r
1817   $ done\r
1818   $ zfclose\r
1819 \r
1820 # Upload all regular files in $HOME/foobar (recursive) that are newer than\r
1821 # two hours to ftp.foobar.invalid/path/to/upload\r
1822   $ autoload -U zfinit ; zfinit\r
1823   $ zfopen ftp.foobar.invalid/path/to/upload\r
1824   $ cd $HOME/foobar\r
1825   $ zfput -r **/*(.mh-2)\r
1826   $ zfclose\r
1827 \r
1828 # long list of files on a ftp\r
1829   $ autoload -U zfinit ; zfinit\r
1830   $ zfopen some-host\r
1831   $ zfcd /some/remote/Dir\r
1832   $ cd /some/local/Dir\r
1833 # If the list.txt is located on the remote host, change to\r
1834 # zfget ${(f)"$(zftp get /path/to/remote/list.txt)"}\r
1835   $ zfget ${(f)"$(cat list.txt)"}\r
1836   $ zfclose</tt></pre>\r
1837 </div></div>\r
1838 <h4 id="_zsh_zselect_require_zmodload_zsh_zselect">zsh/zselect (require zmodload zsh/zselect)</h4>\r
1839 <div class="listingblock">\r
1840 <div class="content">\r
1841 <pre><tt># It's similar to\r
1842  ,----\r
1843  | $ sg=$(stty -g)\r
1844  | $ stty -icanon min 0 time 50\r
1845  | $ read yesno\r
1846  | $ stty "$sg"\r
1847  | $ case "$yesno" in\r
1848  | &gt;  yes) command1;;\r
1849  | &gt;  *) command2;;\r
1850  | &gt; esac\r
1851  `----\r
1852 $ zmodload zsh/zselect\r
1853 $ if zselect -t 500 -r 0 &amp;&amp; read yesno &amp;&amp; [ yes = "$yesno" ]; then\r
1854 &gt;    command1\r
1855 &gt; else\r
1856 &gt;    command1\r
1857 &gt; fi</tt></pre>\r
1858 </div></div>\r
1859 </div>\r
1860 <h2 id="_options">OPTIONS</h2>\r
1861 <div class="sectionbody">\r
1862 <h3 id="_navigation_options">Navigation options</h3><div style="clear:left"></div>\r
1863 <div class="paragraph"><p><strong>auto_cd</strong> (allow one to change to a directory by entering it as a\r
1864 command). <strong>auto_pushd</strong> (automatically append dirs to the push/pop list)\r
1865 pushd_ignore_dups (and don&#8217;t duplicate them).</p></div>\r
1866 <h3 id="_misc">Misc</h3><div style="clear:left"></div>\r
1867 <div class="paragraph"><p><strong>no_hup</strong> (don&#8217;t send  HUP signal to background jobs when exiting ZSH).\r
1868 <strong>print_exit_value</strong> (show a message with the exit code when a command\r
1869 returns with a non-zero exit code)</p></div>\r
1870 <h4 id="_history_options">History options</h4>\r
1871 <div class="paragraph"><p><strong>hist_verify</strong> (let the user edit the command line after history\r
1872 expansion (e.g. !ls) instead of immediately running it)<br />\r
1873 Use the same history file for all sessions :<br />\r
1874 <strong>setopt SHARE_HISTORY</strong></p></div>\r
1875 <h4 id="_privacy_security">Privacy / Security</h4>\r
1876 <div class="paragraph"><p><strong>no_clobber</strong>  (or set -C; prevent <em>&gt;</em> redirection from truncating\r
1877 the given file if it already exists)</p></div>\r
1878 <h4 id="_spelling_correction">Spelling correction</h4>\r
1879 <div class="paragraph"><p><strong>correct</strong> (automatically correct the spelling of commands).\r
1880 <strong>correct_all</strong> (automatically correct the spelling of each word on the\r
1881 command line) <strong>dvorak</strong> (dvorak layout)</p></div>\r
1882 </div>\r
1883 <h2 id="_unsorted_misc">UNSORTED/MISC</h2>\r
1884 <div class="sectionbody">\r
1885 <div class="paragraph"><p>Mailpath: simple multiple mailpath:</p></div>\r
1886 <div class="listingblock">\r
1887 <div class="content">\r
1888 <pre><tt>mailpath=($HOME/Mail/mbox'?new mail in mbox'\r
1889           $HOME/Mail/tux.u-strasbg'?new mail in tux'\r
1890           $HOME/Mail/lilo'?new mail in lilo'\r
1891           $HOME/Mail/ldap-fr'?new mail in ldap-fr')</tt></pre>\r
1892 </div></div>\r
1893 <div class="paragraph"><p>Mailpath: dynamic mailpath:</p></div>\r
1894 <div class="listingblock">\r
1895 <div class="content">\r
1896 <pre><tt>typeset -a mailpath\r
1897 for i in ~/Mail/Lists/*(.); do\r
1898    mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}."\r
1899 done</tt></pre>\r
1900 </div></div>\r
1901 <div class="paragraph"><p>Avoid globbing on special commands:</p></div>\r
1902 <div class="listingblock">\r
1903 <div class="content">\r
1904 <pre><tt>for com in alias expr find mattrib mcopy mdir mdel which;\r
1905 alias $com="noglob $com"</tt></pre>\r
1906 </div></div>\r
1907 <div class="paragraph"><p>For migrating your bashprompt to zsh use the script bash2zshprompt located in\r
1908 the zsh source distribution under <em>Misc</em>.</p></div>\r
1909 <div class="paragraph"><p>For migration from (t)csh to zsh use the c2z tool that converts csh\r
1910 aliases and environment and shell variables to zsh. It does this by running\r
1911 csh, and having csh report on aliases and variables. The script then converts\r
1912 these to zsh startup files. It has some issues and usage information that are\r
1913 documented at the top of this script.</p></div>\r
1914 <div class="paragraph"><p>Here are functions to set the title and hardstatus of an <strong>XTerm</strong> or of <strong>GNU\r
1915 Screen</strong> to <em>zsh</em> and the current directory, respectively, when the prompt is\r
1916 displayed, and to the command name and rest of the command line, respectively,\r
1917 when a command is executed:</p></div>\r
1918 <div class="listingblock">\r
1919 <div class="content">\r
1920 <pre><tt>function title {\r
1921       if [[ $TERM == "screen" ]]; then\r
1922         # Use these two for GNU Screen:\r
1923         print -nR $' 33k'$1$' 33'\\r
1924         print -nR $' 33]0;'$2$''\r
1925       elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then\r
1926         # Use this one instead for XTerms:\r
1927         print -nR $' 33]0;'$*$''\r
1928       fi\r
1929 }\r
1930 function precmd { title zsh "$PWD" }\r
1931 function preexec {\r
1932     emulate -L zsh\r
1933     local -a cmd; cmd=(${(z)1})\r
1934     title $cmd[1]:t "$cmd[2,-1]"\r
1935 }</tt></pre>\r
1936 </div></div>\r
1937 <div class="paragraph"><p>Put the following line into your ~/.screenrc to see this fancy hardstatus:</p></div>\r
1938 <div class="listingblock">\r
1939 <div class="content">\r
1940 <pre><tt>caption always "%3n %t%? (%u)%?%?: %h%?"</tt></pre>\r
1941 </div></div>\r
1942 <div class="paragraph"><p>Special variables which are assigned:</p></div>\r
1943 <div class="listingblock">\r
1944 <div class="content">\r
1945 <pre><tt>$LINENO $RANDOM $SECONDS $COLUMNS $HISTCHARS $UID\r
1946 $EUID $GID $EGID $USERNAME $fignore $mailpath $cdpath</tt></pre>\r
1947 </div></div>\r
1948 </div>\r
1949 <h2 id="_links">LINKS</h2>\r
1950 <div class="sectionbody">\r
1951 <div class="dlist"><dl>\r
1952 <dt class="hdlist1">\r
1953 Primary site\r
1954 </dt>\r
1955 <dd>\r
1956 <p>\r
1957     <strong><a href="http://www.zsh.org/">http://www.zsh.org/</a></strong>\r
1958 </p>\r
1959 </dd>\r
1960 <dt class="hdlist1">\r
1961 Project-page\r
1962 </dt>\r
1963 <dd>\r
1964 <p>\r
1965     <strong><a href="http://sourceforge.net/projects/zsh/">http://sourceforge.net/projects/zsh/</a></strong>\r
1966 </p>\r
1967 </dd>\r
1968 <dt class="hdlist1">\r
1969 Z shell page at sunsite.dk\r
1970 </dt>\r
1971 <dd>\r
1972 <p>\r
1973     <strong><a href="http://zsh.sunsite.dk/">http://zsh.sunsite.dk/</a></strong>\r
1974 </p>\r
1975 </dd>\r
1976 <dt class="hdlist1">\r
1977 From Bash to Z Shell: Conquering the Command Line - the book\r
1978 </dt>\r
1979 <dd>\r
1980 <p>\r
1981     <strong><a href="http://www.bash2zsh.com/">http://www.bash2zsh.com/</a></strong>\r
1982 </p>\r
1983 </dd>\r
1984 <dt class="hdlist1">\r
1985 "Zsh - die magische Shell" (german book about Zsh) by Sven Guckes and Julius Plenz\r
1986 </dt>\r
1987 <dd>\r
1988 <p>\r
1989     <strong><a href="http://zshbuch.org/">http://zshbuch.org/</a></strong>\r
1990 </p>\r
1991 </dd>\r
1992 <dt class="hdlist1">\r
1993 Mailinglistarchive\r
1994 </dt>\r
1995 <dd>\r
1996 <p>\r
1997     <strong><a href="http://www.zsh.org/mla/">http://www.zsh.org/mla/</a></strong>\r
1998 </p>\r
1999 </dd>\r
2000 <dt class="hdlist1">\r
2001 ZSH-FAQ\r
2002 </dt>\r
2003 <dd>\r
2004 <p>\r
2005     <strong><a href="http://zsh.dotsrc.org/FAQ/">http://zsh.dotsrc.org/FAQ/</a></strong>\r
2006 </p>\r
2007 </dd>\r
2008 <dt class="hdlist1">\r
2009 Userguide\r
2010 </dt>\r
2011 <dd>\r
2012 <p>\r
2013     <strong><a href="http://zsh.sunsite.dk/Guide/">http://zsh.sunsite.dk/Guide/</a></strong>\r
2014 </p>\r
2015 </dd>\r
2016 <dt class="hdlist1">\r
2017 ZSH-Wiki\r
2018 </dt>\r
2019 <dd>\r
2020 <p>\r
2021     <strong><a href="http://zshwiki.org/home/">http://zshwiki.org/home/</a></strong>\r
2022 </p>\r
2023 </dd>\r
2024 <dt class="hdlist1">\r
2025 A short introduction from BYU\r
2026 </dt>\r
2027 <dd>\r
2028 <p>\r
2029     <strong><a href="http://docs.cs.byu.edu/linux/advanced/zsh.html">http://docs.cs.byu.edu/linux/advanced/zsh.html</a></strong>\r
2030 </p>\r
2031 </dd>\r
2032 <dt class="hdlist1">\r
2033 Mouse-Support ;)\r
2034 </dt>\r
2035 <dd>\r
2036 <p>\r
2037     <strong><a href="http://stchaz.free.fr/mouse.zsh">http://stchaz.free.fr/mouse.zsh</a></strong>\r
2038 </p>\r
2039 </dd>\r
2040 <dt class="hdlist1">\r
2041 Curtains up: introducing the Z shell\r
2042 </dt>\r
2043 <dd>\r
2044 <p>\r
2045     <strong><a href="http://www-128.ibm.com/developerworks/linux/library/l-z.html?dwzone=linux">http://www-128.ibm.com/developerworks/linux/library/l-z.html?dwzone=linux</a></strong>\r
2046 </p>\r
2047 </dd>\r
2048 <dt class="hdlist1">\r
2049 ZSH-Liebhaberseite (german)\r
2050 </dt>\r
2051 <dd>\r
2052 <p>\r
2053     <strong><a href="http://michael-prokop.at/computer/tools_zsh_liebhaber.html">http://michael-prokop.at/computer/tools_zsh_liebhaber.html</a></strong>\r
2054 </p>\r
2055 </dd>\r
2056 <dt class="hdlist1">\r
2057 ZSH-Seite von Michael Prokop (german)\r
2058 </dt>\r
2059 <dd>\r
2060 <p>\r
2061     <strong><a href="http://michael-prokop.at/computer/tools_zsh.html">http://michael-prokop.at/computer/tools_zsh.html</a></strong>\r
2062 </p>\r
2063 </dd>\r
2064 <dt class="hdlist1">\r
2065 ZSH Prompt introduction\r
2066 </dt>\r
2067 <dd>\r
2068 <p>\r
2069     <strong><a href="http://aperiodic.net/phil/prompt/">http://aperiodic.net/phil/prompt/</a></strong>\r
2070 </p>\r
2071 </dd>\r
2072 <dt class="hdlist1">\r
2073 ft&#8217;s zsh configuration\r
2074 </dt>\r
2075 <dd>\r
2076 <p>\r
2077     <strong><a href="http://ft.bewatermyfriend.org/comp/zsh.html">http://ft.bewatermyfriend.org/comp/zsh.html</a></strong>\r
2078 </p>\r
2079 </dd>\r
2080 <dt class="hdlist1">\r
2081 Adam&#8217;s ZSH page\r
2082 </dt>\r
2083 <dd>\r
2084 <p>\r
2085     <strong><a href="http://www.adamspiers.org/computing/zsh/">http://www.adamspiers.org/computing/zsh/</a></strong>\r
2086 </p>\r
2087 </dd>\r
2088 <dt class="hdlist1">\r
2089 Zzappers Best of ZSH Tips\r
2090 </dt>\r
2091 <dd>\r
2092 <p>\r
2093     <strong><a href="http://www.rayninfo.co.uk/tips/zshtips.html">http://www.rayninfo.co.uk/tips/zshtips.html</a></strong>\r
2094 </p>\r
2095 </dd>\r
2096 <dt class="hdlist1">\r
2097 Zsh Webpage by Christian Schneider\r
2098 </dt>\r
2099 <dd>\r
2100 <p>\r
2101     <strong><a href="http://www.strcat.de/zsh/">http://www.strcat.de/zsh/</a></strong>\r
2102 </p>\r
2103 </dd>\r
2104 <dt class="hdlist1">\r
2105 The zsh-lovers webpage\r
2106 </dt>\r
2107 <dd>\r
2108 <p>\r
2109     <strong><a href="http://grml.org/zsh/">http://grml.org/zsh/</a></strong>\r
2110 </p>\r
2111 </dd>\r
2112 <dt class="hdlist1">\r
2113 IRC channel\r
2114 </dt>\r
2115 <dd>\r
2116 <p>\r
2117     <strong>#zsh at irc.freenode.org</strong>\r
2118 </p>\r
2119 </dd>\r
2120 <dt class="hdlist1">\r
2121 The Z shell reference-card (included in the zsh-lovers debian-package)\r
2122 </dt>\r
2123 <dd>\r
2124 <p>\r
2125     <strong><a href="http://www.bash2zsh.com/zsh_refcard/refcard.pdf">http://www.bash2zsh.com/zsh_refcard/refcard.pdf</a></strong>\r
2126 </p>\r
2127 </dd>\r
2128 </dl></div>\r
2129 </div>\r
2130 <h2 id="_authors">AUTHORS</h2>\r
2131 <div class="sectionbody">\r
2132 <div class="paragraph"><p>This manpage was written by Michael Prokop, Christian <em>strcat</em>\r
2133 Schneider and Matthias Kopfermann. But many ideas have been taken from\r
2134 zsh-geeks e.g. from the zsh-mailinglists (zsh-users and zsh-workers),\r
2135 google, newsgroups and the zsh-Wiki.<br />\r
2136 Thanks for your cool and incredible tips. We learned much from you!</p></div>\r
2137 <div class="paragraph"><p>In alphabetic order:</p></div>\r
2138 <div class="listingblock">\r
2139 <div class="content">\r
2140 <pre><tt>Andrew 'zefram' Main  - http://www.fysh.org/~zefram/\r
2141 Barton E. Schaefer    - http://www.well.com/user/barts/\r
2142 Matthias Kopfermann   - http://www.infodrom.north.de/~matthi/\r
2143 Oliver Kiddle         - http://people.freenet.de/opk/\r
2144 Paul Falstad          - http://www.falstad.com/\r
2145 Peter Stephenson      - http://homepage.ntlworld.com/p.w.stephenson/\r
2146 Richard Coleman\r
2147 Stephane Chazelas     - http://stephane.chazelas.free.fr/\r
2148 Sven Guckes           - http://www.guckes.net/\r
2149 Sven Wischnowsky      - http://w9y.de/zsh/zshrc</tt></pre>\r
2150 </div></div>\r
2151 </div>\r
2152 <h2 id="_see_also">SEE ALSO</h2>\r
2153 <div class="sectionbody">\r
2154 <div class="paragraph"><p>Manpages of zsh:</p></div>\r
2155 <div class="listingblock">\r
2156 <div class="content">\r
2157 <pre><tt>       zsh          Zsh overview\r
2158        zshall       Tthe Z shell meta-man page\r
2159        zshbuiltins  Zsh built-in commands\r
2160        zshcalsys    zsh calendar system\r
2161        zshcompctl   zsh programmable completion\r
2162        zshcompsys   Zsh completion system\r
2163        zshcompwid   Zsh completion widgets\r
2164        zshcontrib   User contributions to zsh\r
2165        zshexpn      Zsh expansion and substitution\r
2166        zshmisc      Anything not fitting into the other sections\r
2167        zshmodules   Zsh loadable modules\r
2168        zshoptions   Zsh options\r
2169        zshparam     Zsh parameters\r
2170        zshroadmap   Informal introduction to the zsh manual\r
2171        zshtcpsys    Zsh tcp system\r
2172        zshzle       Zsh command line editing\r
2173        zshzftpsys   Zsh built-in FTP client\r
2174        zshall       Meta-man page containing all of the above</tt></pre>\r
2175 </div></div>\r
2176 <div class="paragraph"><p>Note: especially <em>man zshcontrib</em> covers very useful topics!<br />\r
2177 Book: <strong>From Bash to Z Shell</strong> by Oliver Kiddle, Jerry Peck and Peter\r
2178 Stephenson. <strong>ISBN: 1590593766</strong>. - <strong><a href="http://www.bash2zsh.com/">bash2zsh.com</a></strong><br />\r
2179 Also take a look at the section <strong>LINKS</strong> in this manpage.</p></div>\r
2180 </div>\r
2181 <h2 id="_bugs">BUGS</h2>\r
2182 <div class="sectionbody">\r
2183 <div class="paragraph"><p>Probably. This manpage might be never complete. So please report bugs,\r
2184 feedback and suggestions to &lt;<a href="mailto:zsh-lovers@michael-prokop.at">zsh-lovers@michael-prokop.at</a>&gt;. Thank\r
2185 you!</p></div>\r
2186 </div>\r
2187 <h2 id="_copyright">COPYRIGHT</h2>\r
2188 <div class="sectionbody">\r
2189 <div class="paragraph"><p>Copyright  (C) Michael Prokop, Christian Schneider and Matthias\r
2190 Kopfermann.</p></div>\r
2191 </div>\r
2192 </div>\r
2193 <div id="footnotes"><hr /></div>\r
2194 <div id="footer">\r
2195 <div id="footer-text">\r
2196 Last updated 2010-07-28 17:55:37 EDT\r
2197 </div>\r
2198 </div>\r
2199 </body>\r
2200 </html>\r