home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume35 / zsh / part07 < prev    next >
Text File  |  1993-02-20  |  56KB  |  2,072 lines

  1. Newsgroups: comp.sources.misc
  2. From: zsh-list@cs.uow.edu.au (The Zsh Mailing List)
  3. Subject: v35i057:  zsh - The Z Shell, version 2.3.1, Part07/22
  4. Message-ID: <1993Feb20.212230.28490@sparky.imd.sterling.com>
  5. X-Md4-Signature: 984dfb968d2571a1cf2bf025bc00b7b1
  6. Date: Sat, 20 Feb 1993 21:22:30 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: zsh-list@cs.uow.edu.au (The Zsh Mailing List)
  10. Posting-number: Volume 35, Issue 57
  11. Archive-name: zsh/part07
  12. Environment: UNIX
  13. Supersedes: zsh2.2: Volume 29, Issue 97-113
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  help/trap man/man1/zsh.1.01 src/ztype.h
  22. # Wrapped by mattson@odin on Sat Feb  6 14:41:52 1993
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 7 (of 22)."'
  26. if test -f 'help/trap' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'help/trap'\"
  28. else
  29.   echo shar: Extracting \"'help/trap'\" \(946 characters\)
  30.   sed "s/^X//" >'help/trap' <<'END_OF_FILE'
  31. X     trap [ arg ] [ sig ] ...
  32. X          arg is a command to be read and executed when the shell
  33. X          receives  sig.  Each sig can be given as a number or as
  34. X          the name of a signal.  If arg is -, then all traps  sig
  35. X          are  reset to their default values.  If arg is the null
  36. X          string, then this signal is ignored by the shell and by
  37. X          the  commands  it invokes.  If sig is ERR then arg will
  38. X          be executed after each command.  If sig is  0  or  EXIT
  39. X          and the trap statement is executed inside the body of a
  40. X          function, then the command arg is  executed  after  the
  41. X          function  completes.   If sig is 0 or EXIT and the trap
  42. X          statement is not executed inside the body  of  a  func-
  43. X          tion,  then  the command arg is executed when the shell
  44. X          terminates.  The trap command with no arguments  prints
  45. X          a list of commands associated with each signal.
  46. END_OF_FILE
  47.   if test 946 -ne `wc -c <'help/trap'`; then
  48.     echo shar: \"'help/trap'\" unpacked with wrong size!
  49.   fi
  50.   # end of 'help/trap'
  51. fi
  52. if test -f 'man/man1/zsh.1.01' -a "${1}" != "-c" ; then 
  53.   echo shar: Will not clobber existing file \"'man/man1/zsh.1.01'\"
  54. else
  55.   echo shar: Extracting \"'man/man1/zsh.1.01'\" \(49329 characters\)
  56.   sed "s/^X//" >'man/man1/zsh.1.01' <<'END_OF_FILE'
  57. X.\"
  58. X.TH ZSH 1 "5 February 1993" "zsh version 2.3.1"
  59. X.SH NAME
  60. Xzsh \- the Z shell
  61. X.SH SYNOPSIS
  62. X\fBzsh\fP [ \(+-\fIoptions\fP ] [ \(+-\fBo\fP \fIoption\fP ] ...  [ \-\fBc\fP \fIstring\fP ] [ \fIarg\fP ... ]
  63. X.SH "SHELL GRAMMAR"
  64. XA \fIsimple command\fP is a sequence of optional parameter
  65. Xassignments followed by blank-separated words,
  66. Xwith optional redirections interspersed.
  67. XThe first word is the command to be executed, and the remaining
  68. Xwords, if any, are arguments to the command.
  69. XIf a command name is given, the parameter assignments modify
  70. Xthe environment of the command when it is executed.
  71. XThe value of a simple command is its exit status,
  72. Xor 128 plus the signal number if terminated by a signal.
  73. X.PP
  74. XIf a simple command is preceded by the word \fBexec\fP,
  75. Xit is executed in the parent shell without forking.
  76. XIf preceded by \fBcommand\fP, the command word is taken
  77. Xto be the name of an external command, rather than a
  78. Xshell function or builtin.
  79. XIf preceded by \fBnoglob\fP, filename generation is not performed
  80. Xon any of the words.  If preceded by a \-, the command
  81. Xis executed with a \- prepended to its \fBargv[0]\fP string.
  82. XIf preceded by \fBnocorrect\fP, spelling correction is not
  83. Xdone on any of the words.
  84. X.PP
  85. XA \fIpipeline\fP is a sequence of one or more commands
  86. Xseparated by \fB|\fP or \fB|&\fP.  \fB|&\fP is shorthand
  87. Xfor \fB2>&1 |\fP.  The standard output of each command is
  88. Xconnected to the standard input of the next command in the
  89. Xpipeline.
  90. X.PP
  91. XThe value of a pipeline is the value of the last command.
  92. XIf a pipeline is preceded by a \fB!\fP, the value
  93. Xof that pipeline is the logical NOT of the value of the last
  94. Xcommand.
  95. X.PP
  96. XIf a pipeline is preceded by \fBcoproc\fP, it is
  97. Xexecuted as a coprocess; a two-way pipe is established
  98. Xbetween it and the parent shell.  The shell can read from or write to
  99. Xthe coprocess by means of the \fB>&p\fP and \fB<&p\fP
  100. Xredirection operators.
  101. X.PP
  102. XA \fIsublist\fP is a sequence of one or more pipelines
  103. Xseparated by \fB&&\fP or \fB|\||\fP.  If two pipelines
  104. Xare separated by \fB&&\fP, the second pipeline is executed
  105. Xonly if the first is successful (returns a zero value).
  106. XIf two pipelines are separated by \fB|\||\fP, the second is executed
  107. Xonly if the first is unsuccessful (returns a nonzero value).
  108. X.PP
  109. XA \fIlist\fP is a sequence of one or more sublists
  110. Xseparated by, and optionally terminated by, \fB;\fP, \fB&\fP,
  111. Xor a newline.
  112. XNormally the shell waits for each list to finish before executing
  113. Xthe next one.
  114. XIf a list is terminated by a \fB&\fP, the shell executes
  115. Xit in the background, and does not wait for it to finish.
  116. X.PP
  117. XA \fIcomplex command\fP is one of the following:
  118. X.PP
  119. X.RS
  120. X.PD 0
  121. X.TP
  122. X\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ... ]
  123. X.TP
  124. X\fBdo\fP \fIlist\fP
  125. X.TP
  126. X\fBdone\fP
  127. X.PD
  128. XExpand the list of \fIword\fPs, and set the parameter
  129. X\fIname\fP to each of them in turn, executing
  130. X\fIlist\fP each time.  If the \fBin\fP \fIword\fP is omitted,
  131. Xuse the positional parameters instead of the \fIword\fPs.
  132. X.TP
  133. X\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ... ] ; \fIsublist\fP
  134. XThis is a shorthand for \fBfor\fP.
  135. XThough it may cause confusion, it is included for convenience;
  136. Xits use in scripts is discouraged,
  137. Xunless \fIsublist\fP is a command of the form { \fIlist\fP }.
  138. X.PP
  139. X.PD 0
  140. X.TP
  141. X\fBforeach\fP \fIname\fP \fB(\fP \fIword\fP ... \fB)\fP
  142. X.TP
  143. X\fIlist\fP
  144. X.TP
  145. X\fBend\fP
  146. X.PD
  147. XAnother form of \fBfor\fP.
  148. X.PP
  149. X.PD 0
  150. X.TP
  151. X\fBfor\fP \fIname\fP \fBin\fP \fIword\fP ...
  152. X.TP
  153. X\fB{\fP
  154. X.TP
  155. X\fIlist\fP
  156. X.TP
  157. X\fB}\fP
  158. X.PD
  159. XAnother form of \fBfor\fP.
  160. X.PP
  161. X.PD 0
  162. X.TP
  163. X\fBfor\fP \fIname\fP \fB(\fP \fIword\fP ... \fB) {\fP
  164. X.TP
  165. X\fIlist\fP
  166. X.TP
  167. X\fB}\fP
  168. X.PD
  169. XAnother form of \fBfor\fP.
  170. X.PP
  171. X.PD 0
  172. X.TP
  173. X\fBfor\fP \fIname\fP \fB(\fP \fIword\fP ... \fB) \fIsublist\fP
  174. X.PD
  175. XAnother form of \fBfor\fP.
  176. X.PP
  177. X.PD 0
  178. X.TP
  179. X\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ... ]
  180. X.TP
  181. X\fBdo\fP \fIlist\fP
  182. X.TP
  183. X\fBdone\fP
  184. X.PD
  185. XPrint the set of \fIword\fPs, each preceded by a number.
  186. XIf the \fBin\fP \fIword\fP is omitted, use the positional parameters.
  187. XThe \fBPROMPT3\fP prompt is printed and a line is read from standard
  188. Xinput.  If this line consists of the number of one of the listed
  189. X\fIword\fPs, then the parameter \fIname\fP
  190. Xis set to the \fIword\fP corresponding to this number.
  191. XIf this line is empty, the selection list is printed again.
  192. XOtherwise, the value of the parameter \fIname\fP is set to null.
  193. XThe contents of the line read from standard input is saved
  194. Xin the parameter \fBREPLY\fP.  \fIlist\fP is executed
  195. Xfor each selection until a break or end-of-file is encountered.
  196. X.TP
  197. X\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fIsublist\fP
  198. XA short form of \fBselect\fP.
  199. X.TP
  200. X\fBcase\fP \fIword\fP \fBin\fP [ \fIpattern\fP ) \fIlist\fP ;; ] ...  \fBesac\fP
  201. XExecute the \fIlist\fP associated with the first \fIpattern\fP
  202. Xthat matches \fIword\fP, if any.  The form of the patterns
  203. Xis the same as that used for filename generation.  See
  204. X\fIFilename Generation\fP below.
  205. X.TP
  206. X\fBcase\fP \fIword\fP \fB{\fP [ \fIpattern\fP ) \fIlist\fP ;; ] ...  \fB}\fP
  207. XAnother form of \fBcase\fP.
  208. X.TP
  209. X.PD 0
  210. X\fBif\fP \fIlist\fP
  211. X.TP
  212. X\fBthen\fP \fIlist\fP
  213. X.TP
  214. X[ \fBelif\fP \fIlist\fP ; \fBthen\fP \fIlist\fP ] ...
  215. X.TP
  216. X[ \fBelse\fP \fIlist\fP ]
  217. X.TP
  218. X\fBfi\fP
  219. X.PD
  220. XThe \fBif\fP \fIlist\fP is executed, and,
  221. Xif it returns a zero exit status,
  222. Xthe \fBthen\fP \fIlist\fP is executed.
  223. XOtherwise, the \fBelif\fP \fIlist\fP is
  224. Xexecuted and, if its value is zero,
  225. Xthe \fBthen\fP \fIlist\fP is executed.
  226. XIf each \fBelif\fP \fIlist\fP returns
  227. Xnonzero, the \fBelse\fP \fIlist\fP is executed.
  228. X.TP
  229. X\fBif (\fP \fIlist\fP \fB)\fP \fIsublist\fP
  230. XA short form of \fBif\fP.
  231. X.PP
  232. X.PD 0
  233. X.TP
  234. X\fBif\fP \fB(\fP \fIlist\fP \fB) {\fP
  235. X.TP
  236. X\fIlist\fP
  237. X.TP
  238. X\fB} elif (\fP \fIlist\fP \fB) {\fP
  239. X.TP
  240. X\fIlist\fP
  241. X.TP
  242. X\fB} ... else {\fP
  243. X.TP
  244. X\fIlist\fP
  245. X.TP
  246. X\fB}\fP
  247. X.PD
  248. XAn alternate form of \fBif\fP.
  249. X.TP
  250. X.PD 0
  251. X\fBwhile\fP \fIlist\fP
  252. X.TP
  253. X\fBdo\fP \fIlist\fP
  254. X.TP
  255. X\fBdone\fP
  256. X.PD
  257. XExecute the \fBdo\fP \fIlist\fP as long as the \fBwhile\fP \fIlist\fP
  258. Xreturns a zero exit status.
  259. X.PP
  260. X.PD 0
  261. X.TP
  262. X\fBwhile (\fP \fIlist\fP \fB) {\fP
  263. X.TP
  264. X\fIlist\fP
  265. X.TP
  266. X\fB}\fP
  267. X.PD
  268. XAn alternate form of \fBwhile\fP.
  269. X.TP
  270. X.PD 0
  271. X\fBuntil\fP \fIlist\fP
  272. X.TP
  273. X\fBdo\fP \fIlist\fP
  274. X.TP
  275. X\fBdone\fP
  276. X.PD
  277. XExecute the \fBdo\fP \fIlist\fP as long as \fBuntil\fP \fIlist\fP
  278. Xreturns a nonzero exit status.
  279. X.TP
  280. X.PD 0
  281. X\fBrepeat\fP \fIword\fP
  282. X.TP
  283. X\fBdo\fP \fIlist\fP
  284. X.TP
  285. X\fBdone\fP
  286. X.PD
  287. X\fIword\fP is expanded and treated as an arithmetic expression,
  288. Xwhich must evaluate to a number \fIn\fP.
  289. X\fIlist\fP is then executed \fBn\fP times.
  290. X.TP
  291. X\fBrepeat\fP \fIword\fP \fIsublist\fP
  292. XThis is a short form of \fBrepeat\fP.
  293. X.TP
  294. X( \fIlist\fP )
  295. XExecute \fIlist\fP in a subshell.
  296. X.TP
  297. X{ \fIlist\fP }
  298. XExecute \fIlist\fP.
  299. X.TP
  300. X.PD 0
  301. X\fBfunction\fP \fIword\fP [ (\|) ] ... { \fIlist\fP }
  302. X.TP
  303. X\fIword\fP ... (\|) { \fIlist\fP }
  304. X.TP
  305. X\fIword\fP ... (\|) \fIsublist\fP
  306. X.PD
  307. XDefine a function which is referenced by any one of \fIword\fP.
  308. XNormally, only one \fIword\fP is provided; multiple \fIword\fPs
  309. Xare usually only useful for setting traps.
  310. XThe body of the function is the \fIlist\fP between
  311. Xthe { and }.
  312. XSee \fBFUNCTIONS\fP below.
  313. X.TP
  314. X\fBtime\fP [ \fIpipeline\fP ]
  315. XThe \fIpipeline\fP is executed, and timing statistics are
  316. Xreported on the standard error in the form specified
  317. Xby the \fBTIMEFMT\fP parameter.
  318. XIf \fIpipeline\fP is omitted, print statistics about the
  319. Xshell process and its children.
  320. X.TP
  321. X[[ \fIexp\fP ]]
  322. XEvaluates the conditional expression \fIexp\fP
  323. Xand return a zero exit status if it is true.
  324. XSee \fBConditional Expressions\fP below for a description
  325. Xof \fIexp\fP.
  326. X.SH "RESERVED WORDS"
  327. XThe following words are recognized as reserved words when used 
  328. Xas the first word of a command
  329. Xunless quoted or removed using the \fBunalias\fP builtin:
  330. X.RS
  331. X.PP
  332. X\fBdo done esac then elif else fi for case
  333. Xif while function repeat time until exec command
  334. Xselect coproc noglob \- nocorrect foreach end\fP
  335. X.RE
  336. X.SH COMMENTS
  337. XIn noninteractive shells, or in interactive shells with the
  338. X\fBINTERACTIVE_COMMENTS\fP option set, a word beginning
  339. Xwith the third character of the \fBHISTCHARS\fP parameter
  340. X(`#' by default) causes that word and all the following
  341. Xcharacters up to a newline to be ignored.
  342. X.SH ALIASING
  343. XEvery token in the shell input is checked to see if there
  344. Xis an alias defined for it.
  345. XIf so, it is replaced by the text of the alias if it is in command
  346. Xposition (if it could be the first word of a simple command),
  347. Xor if the alias is global.
  348. XIf the text ends with a space, the next word in the shell input
  349. Xis treated as though it were in command position for purposes of alias
  350. Xexpansion.
  351. XAn alias is defined using the \fBalias\fP builtin; global aliases
  352. Xmay be defined using the \-\fBg\fP option to that bulitin.
  353. X.PP
  354. XAlias substitution is done on the shell input before any
  355. Xother substitution except history substitution.  Therefore,
  356. Xif an alias is defined for the word \fBfoo\fP, alias substitution
  357. Xmay be avoided by quoting part of the word, e.g. \fB\efoo\fP.
  358. XBut there is nothing to prevent an alias being defined
  359. Xfor \fB\efoo\fP as well.
  360. X.SH QUOTING
  361. XA character may be \fIquoted\fP (that is, made
  362. Xto stand for itself) by preceding it with a \e\|.
  363. X\e followed by a newline is ignored.
  364. XAll characters enclosed between a pair of single quotes ('')
  365. Xare quoted.
  366. XA single quote cannot appear within single quotes.
  367. XInside double quotes (""), parameter and command substitution
  368. Xoccurs, and \e quotes the characters \e\|, `, ", and $.
  369. X.SH EXPANSION
  370. XExpansion is performed on the command line after it has been
  371. Xparsed.  The types of expansions performed are
  372. X\fIfilename expansion\fP, 
  373. X\fIprocess substitution\fP,
  374. X\fIparameter expansion\fP,
  375. X\fIcommand substitution\fP,
  376. X\fIarithmetic expansion\fP,
  377. X\fIbrace expansion\fP,
  378. Xand \fIfilename generation\fP.
  379. X.SS Filename Expansion
  380. XEach word is checked to see if it begins with an unquoted ~.
  381. XIf it does, then the word up to a / is checked to see if it matches
  382. Xthe name of a named directory.  If so, then the ~ and the matched portion
  383. Xare replaced with the value of the named directory.
  384. XA ~ by itself or followed by a / is replaced by the value of the
  385. X\fBHOME\fP parameter.
  386. XA ~ followed by a + or a \- is replaced by the value of 
  387. X\fBPWD\fP or \fBOLDPWD\fP, respectively.
  388. X.PP
  389. XNamed directories are typically login directories for users on the system.
  390. XThey may also be defined if the text after the ~ is the name
  391. Xof a string shell parameter whose value begins with a /.
  392. XIn certain circumstances (in prompts, for instance), when the shell
  393. Xprints a path, the path is checked to see if it has a named
  394. Xdirectory as its prefix.  If so, then the prefix portion
  395. Xis replaced with a ~ followed by the name of the directory.
  396. XThe longest match is preferred.
  397. X.PP
  398. XIf a word begins with an unquoted \fB=\fP and the
  399. X\fBNO_EQUALS\fP option is not set,
  400. Xthe remainder of the word is taken as the
  401. Xname of a command or alias.  If a command
  402. Xexists by that name, the word is replaced
  403. Xby the full pathname of the command.
  404. XIf an alias exists by that name, the word
  405. Xis replaced with the text of the alias.
  406. XOtherwise the word is checked up to a /
  407. Xto see if it is a number or a \-.  If so,
  408. Xthe matched portion is replaced with
  409. Xthe \fIn\fPth directory in the directory stack,
  410. Xwhere \fIn\fP is the number matched, or
  411. Xthe last directory in the directory stack
  412. Xif a \- is matched.
  413. X.SS Process Substitution
  414. XEach command argument of the form
  415. X\fB<(\fIlist\^\fB)\fR
  416. Xor
  417. X\fB>(\fIlist\^\fB)\fR
  418. Xor
  419. X\fB=(\fIlist\^\fB)\fR
  420. Xis subject to process substitution.
  421. XIn the case of the
  422. X.B <
  423. Xor
  424. X.B >
  425. Xforms, the shell will run process
  426. X.I list
  427. Xasynchronously connected to a named pipe (FIFO).
  428. XThe name of this pipe will become the argument to the command.
  429. XIf the form with
  430. X.B >
  431. Xis selected then writing on this file will provide input for
  432. X.IR list .
  433. XIf
  434. X.B <
  435. Xis used,
  436. Xthen the file passed as an argument will
  437. Xbe a named pipe connected to the output of the
  438. X.I list
  439. Xprocess.
  440. XFor example,
  441. X.RS
  442. X.PP
  443. X\fBpaste <(cut \-f1\fP \fIfile1\fB) <(cut \-f3\fP \fIfile2\fB) | tee >(\fIprocess1\fB) >(\fIprocess2\fB)\fR >/dev/null
  444. X.RE
  445. X.PP
  446. X.BR cut s
  447. Xfields 1 and 3 from
  448. Xthe files
  449. X.I file1
  450. Xand
  451. X.I file2
  452. Xrespectively,
  453. X.BR paste s
  454. Xthe results together, and sends it to the processes
  455. X.I process1
  456. Xand
  457. X.IR process2 .
  458. XNote that the file, which is passed as an argument to the command,
  459. Xis a system
  460. Xpipe 
  461. Xso programs that expect to
  462. X.BR lseek (2)
  463. Xon the file will not work.
  464. XAlso note that the previous example can be more compactly and
  465. Xefficiently written as:
  466. X.RS
  467. X.PP
  468. X\fBpaste <(cut \-f1\fP \fIfile1\fB) <(cut \-f3\fP \fIfile2\fB) > >(\fIprocess1\fB) > >(\fIprocess2\fB)\fR
  469. X.RE
  470. X.PP
  471. XThe shell uses pipes instead of FIFOs to implement the latter
  472. Xtwo process substitutions in the above example.
  473. X.PP
  474. XIf
  475. X.B =
  476. Xis used,
  477. Xthen the file passed as an argument will be the name
  478. Xof a temporary file containing
  479. Xthe output of the
  480. X.I list
  481. Xprocess.  This may be used instead of the
  482. X.B <
  483. Xform for a program that expects to \fBlseek\fP(2) on the input file.
  484. X.SS Parameter Expansion
  485. XThe character \fB$\fP is used to introduce parameter expansions.
  486. XSee \fBPARAMETERS\fP below for a description of parameters.
  487. X.PD
  488. X.RS
  489. X.TP
  490. X\fB${\fIname\fB}\fR
  491. XThe value, if any, of the parameter \fIname\fP is substituted.
  492. XThe braces are required if \fIname\fP is followed by
  493. Xa letter, digit, or underscore that is not to be interpreted
  494. Xas part of its name.
  495. XIf \fIname\fP is an array parameter, then the values of each
  496. Xelement of \fIname\fP is substituted, one element per word.
  497. XOtherwise, the expansion results in one word only; no
  498. Xword splitting is done on the result.
  499. X.TP
  500. X\fB${\fIname\fB:\-\fIword\fB}\fR
  501. XIf \fIname\fP is set and is non-null then substitute its
  502. Xvalue; otherwise substitute \fIword\fP.
  503. X.TP
  504. X\fB${\fIname\fB:=\fIword\fB}\fR
  505. XIf \fIname\fP is unset or is null then
  506. Xset it to \fIword\fP; the value of the parameter is then
  507. Xsubstituted.
  508. X.TP
  509. X\fB${\fIname\fB:?\fIword\fB}\fR
  510. XIf \fIname\fP is set and is non-null, then substitute
  511. Xits value; otherwise, print \fIword\fP and exit from the shell.
  512. XIf \fIword\fP is omitted, then a standard message is printed.
  513. X.TP
  514. X\fB${\fIname\fB:+\fIword\fB}\fR
  515. XIf \fIname\fP is set and is non-null then substitute
  516. X\fIword\fP; otherwise substitute nothing.
  517. X.PD 0
  518. X.TP
  519. X\fB${\fIname\fB#\fIpattern\fB}\fR
  520. X.TP
  521. X\fB${\fIname\fB##\fIpattern\fB}\fR
  522. X.PD
  523. XIf the \fIpattern\fP matches the beginning of the value of
  524. X\fIname\fP, then substitute the value of \fIname\fP with
  525. Xthe matched portion deleted; otherwise, just
  526. Xsubstitute the value of \fIname\fP.  In the first
  527. Xform, the smallest matching pattern is preferred;
  528. Xin the second form, the largest matching pattern is preferred.
  529. X.PD 0
  530. X.TP
  531. X${\fIname\fB%\fIpattern\fR}
  532. X.TP
  533. X${\fIname\fB%%\fIpattern\fR}
  534. X.PD
  535. XIf the \fIpattern\fP matches the end of the value of
  536. X\fIname\fP, then substitute the value of \fIname\fP with
  537. Xthe matched portion deleted; otherwise, just
  538. Xsubstitute the value of \fIname\fP.  In the first
  539. Xform, the smallest matching pattern is preferred;
  540. Xin the second form, the largest matching pattern is preferred.
  541. X.TP
  542. X${\fB#\fIspec\fR}
  543. XIf \fIspec\fP is one of the above substitutions, substitute
  544. Xthe length in characters of the result instead of
  545. Xthe result itself.  If \fIspec\fP is an array expression,
  546. Xsubstitute the number of elements of the result.
  547. X.TP
  548. X${\fB^\fIspec\fR}
  549. XToggle the value of the \fBRC_EXPAND_PARAM\fP option for the
  550. Xevaluation of \fIspec\fP.
  551. XWhen this option is set, array expansions of the form
  552. X\fIfoo\fB${\fIxx\fB}\fIbar\fR, where the parameter
  553. X\fIxx\fP is set to (\fIa b c\fP), are substituted with
  554. X\fIfooabar foobbar foocbar\fP instead of the default
  555. X\fIfooa b cbar\fP.
  556. X.TP
  557. X${\fB=\fIspec\fR}
  558. XToggle the value of the \fBSH_WORD_SPLIT\fP option for the
  559. Xevaluation of \fIspec\fP.
  560. XWhen this option is set, parameter values are split into
  561. Xseparate words using \fBIFS\fP as a delimiter
  562. Xbefore substitution.
  563. XThis is done by default in most other shells.
  564. X.PD
  565. X.RE
  566. X.PP
  567. XIf the colon is omitted from one of the above expressions
  568. Xcontaining a colon, then the shell only checks whether
  569. X\fIname\fP is set or not, not whether it is null.
  570. X.SS Command Substitution
  571. XA command enclosed in parentheses
  572. Xpreceded by a dollar sign, like so: $(...) or quoted with grave
  573. Xaccents: `...` is replaced with its standard output.
  574. XIf the substitution is not enclosed in double quotes, the
  575. Xoutput is broken into words using the \fBIFS\fP parameter.
  576. XThe substitution \fB$(cat foo)\fP may be replaced
  577. Xby the equivalent but faster \fB$(<foo)\fP.
  578. X.SS Arithmetic Expansion
  579. XA string of the form \fB$[\fIexp\fB]\fR is substituted
  580. Xwith the value of the arithmetic expression \fIexp\fP.
  581. X\fIexp\fP is treated as if it were within single quotes.
  582. XSee \fBARITHMETIC EVALUATION\fP below.
  583. X.SS Brace Expansion
  584. XA string of the form
  585. X\fIfoo\fB{\fIxx\fB,\fIyy\fB,\fIzz\fB}\fIbar\fR
  586. Xis expanded to the individual words
  587. X\fIfooxxbar\fP, \fIfooyybar\fP, and \fIfoozzbar\fP.
  588. XLeft-to-right order is preserved.  This construct
  589. Xmay be nested.  Malformed brace expansion expressions,
  590. Xincluding expressions without a comma, are left unchanged
  591. Xby the shell.
  592. X.PP
  593. XAn expression of the form
  594. X\fB{\fIx\fB\-\fIy\fB}\fR,
  595. Xwhere \fIx\fP and \fIy\fP are single characters,
  596. Xis expanded to every character between
  597. X\fIx\fP and \fIy\fP, inclusive.
  598. X.SS Filename Generation
  599. XIf a word contains an unquoted instance of one of the characters
  600. X*, |, <, [, or ?, it is regarded
  601. Xas a pattern for filename generation, unless the \fBNOGLOB\fP option is set.
  602. XIf the \fBEXTENDED_GLOB\fP option is set, the
  603. X^ and # characters also denote a pattern; otherwise
  604. Xthey are not treated specially by the shell.
  605. XThe word is replaced with a list of sorted filenames that match
  606. Xthe pattern.  If no matching pattern is found, the shell gives
  607. Xan error message, unless the \fBNULLGLOB\fP option is set,
  608. Xin which case the word is deleted; or unless the \fBNO_NOMATCH\fP
  609. Xoption is set, in which case the word is left unchanged.
  610. XIn filename generation,
  611. Xthe character / must be matched explicitly; also, a . must be matched
  612. Xexplicitly at the beginning of a pattern or after a /, unless the
  613. X\fBGLOBDOTS\fP option is set.  No filename generation pattern
  614. Xmatches the files "." or "..".  In other instances of pattern
  615. Xmatching, the / and . are not treated specially.
  616. X.PP
  617. X.RS
  618. X.PD 0
  619. X.TP
  620. X.B *
  621. Xmatches any string, including the null string.
  622. X.TP
  623. X.B ?
  624. Xmatches any character.
  625. X.TP
  626. X\fB[ ... ]\fP
  627. Xmatches any of the enclosed characters.
  628. X.TP
  629. X\fB[^ ... ]\fP
  630. Xmatches any character except the enclosed characters.
  631. X.TP
  632. X\fB<x\-y>\fP
  633. Xmatches any number in the range x to y, inclusive.
  634. XIf x is omitted, the number must be less than or equal to y.
  635. XIf y is omitted, the number must be greater than or equal to x.
  636. XA pattern of the form \fB<\->\fP or
  637. Xsimply \fB<>\fP matches any number.
  638. X.TP
  639. X\fB^x\fP
  640. Xmatches anything except the pattern x.
  641. X.TP
  642. X\fBx|y\fP
  643. Xmatches either x or y.
  644. X.TP
  645. X\fBx#\fP
  646. Xmatches zero or more occurrences of the pattern x.
  647. X.TP
  648. X\fBx##\fP
  649. Xmatches one or more occurrences of the pattern x.
  650. X.RE
  651. X.PD
  652. X.PP
  653. XParentheses may be used for grouping.  Note that the \fB|\fP character
  654. Xmust be within parentheses, so that the lexical analyzer does
  655. Xnot think it is a pipe character.  Also note that "/" has a
  656. Xhigher precedence than "^"; that is:
  657. X.RS
  658. X.PP
  659. Xls
  660. X.BI ^ foo / bar
  661. X.RE
  662. X.PP
  663. Xwill search directories in "." except "./foo" for a file named bar.
  664. X.PP
  665. XA pathname component of the form
  666. X.BI ( foo /)#
  667. Xmatches a path consisting of zero or more directories
  668. Xmatching the pattern foo.
  669. XAs a shorthand,
  670. X.B **/
  671. Xis equivalent to
  672. X.BR (*/)# .
  673. XThus:
  674. X.RS
  675. X.PP
  676. Xls
  677. X.BI (*/)# bar
  678. X.RE
  679. X.PP
  680. Xor
  681. X.RS
  682. X.PP
  683. Xls
  684. X.BI **/ bar
  685. X.RE
  686. X.PP
  687. Xdoes a recursive directory search for files named bar.
  688. X.PP
  689. XIf used for filename generation, a pattern may contain an exclusion
  690. Xspecifier.  Such patterns are of the form \fIpat1\fB~\fIpat2\fR.
  691. XThis pattern will generate all files matching \fIpat1\fP, but which
  692. Xdo not match \fIpat2\fP.  For example, \fB*.c~lex.c\fP will match
  693. Xall files ending in .c, except the file \fBlex.c\fP.
  694. X.PP
  695. XPatterns used for filename generation may also end in a
  696. Xlist of qualifiers enclosed in parentheses.
  697. XThe qualifiers
  698. Xspecify which filenames that otherwise match the given pattern
  699. Xwill be inserted in the argument list.
  700. XA qualifier may be any one of the following:
  701. X.PD 0
  702. X.RS
  703. X.TP
  704. X.B /
  705. Xdirectories
  706. X.TP
  707. X.B .
  708. Xplain files
  709. X.TP
  710. X.B @
  711. Xsymbolic links
  712. X.TP
  713. X.B =
  714. Xsockets
  715. X.TP
  716. X.B p
  717. Xnamed pipes (FIFOs)
  718. X.TP
  719. X.B *
  720. Xexecutable plain files (0100)
  721. X.TP
  722. X.B %
  723. Xdevice files (character or block special)
  724. X.TP
  725. X.B r
  726. Xreadable files (0400)
  727. X.TP
  728. X.B w
  729. Xwritable files (0200)
  730. X.TP
  731. X.B x
  732. Xexecutable files (0100)
  733. X.TP
  734. X.B R
  735. Xworld-readable files (0004)
  736. X.TP
  737. X.B W
  738. Xworld-writable files (0002)
  739. X.TP
  740. X.B X
  741. Xworld-executable files (0001)
  742. X.TP
  743. X.B s
  744. Xsetuid files (04000)
  745. X.TP
  746. X.B S
  747. Xsetgid files (02000)
  748. X.TP
  749. X\fBd\fIdev\fR
  750. Xfiles on the device \fIdev\fP
  751. X.TP
  752. X\fBl\fIct\fR
  753. Xfiles having a link count of \fIct\fP
  754. X.TP
  755. X\fBU\fP
  756. Xfiles owned by the effective user id
  757. X.TP
  758. X\fBG\fP
  759. Xfiles owned by the effective group id
  760. X.TP
  761. X\fBu\fInum\fR
  762. Xfiles owned by user id \fInum\fP
  763. X.TP
  764. X\fBg\fInum\fR
  765. Xfiles owned by group id \fInum\fP
  766. X.TP
  767. X\fBa\fI[-|+]n\fR
  768. Xfiles accessed within last n days (-), more than n days ago (+), or
  769. Xn days ago.\fP
  770. X.TP
  771. X\fBm\fI[-|+]n\fR
  772. Xfiles modified within last n days (-), more than n days ago (+), or
  773. Xn days ago.\fP
  774. X.TP
  775. X\fBc\fI[-|+]n\fR
  776. Xfiles whose inode changed within last n days (-), more than n days ago (+), or
  777. Xn days ago.\fP
  778. X.TP
  779. X\fBL\fI[+|-]n\fR
  780. Xfiles less than n bytes (-), more than n bytes (+), or
  781. Xexactly n bytes in length.
  782. X.TP
  783. X\fB^\fP
  784. Xnegates all qualifiers following it
  785. X.TP
  786. X\fBM\fP
  787. Xsets the \fBMARKDIRS\fP option for the current pattern
  788. X.TP
  789. X\fBN\fP
  790. Xsets the \fBNULLGLOB\fP option for the current pattern
  791. X.TP
  792. X\fBD\fP
  793. Xsets the \fBGLOBDOTS\fP option for the current pattern
  794. X.PD
  795. X.RE
  796. X.PP
  797. XThus:
  798. X.RS
  799. X.PP
  800. Xls
  801. X.B
  802. X*(%W)
  803. X.RE
  804. X.PP
  805. Xlists all world-writable device files in the current directory,
  806. Xand
  807. X.RS
  808. X.PP
  809. Xls
  810. X.B /tmp/foo*(u0^@)
  811. X.RE
  812. X.PP
  813. Xlists all root-owned files beginning with the string
  814. X"foo" in /tmp, ignoring symlinks, and
  815. X.RS
  816. X.PP
  817. Xls
  818. X.B *.*~(lex|parse).[ch](^D^l1)
  819. X.RE
  820. X.PP
  821. Xlists all files having a link count of one whose names contain a dot
  822. X(but not those starting with a dot, since \fBGLOBDOTS\fP is explicitly
  823. Xswitched off) except for lex.c, lex.h, parse.c, and parse.h.
  824. XA "/" at the end of a pattern
  825. Xis equivalent to "(\|/\|)".
  826. X.SH REDIRECTION
  827. XBefore a command is executed, its input and output
  828. Xmay be redirected.
  829. XThe following may appear anywhere in a simple-command
  830. Xor may precede or follow a complex command.
  831. XSubstitution occurs before
  832. X.I word
  833. Xis used except as noted below.
  834. XIf the result of substitution on
  835. X.I word
  836. Xproduces more than one filename,
  837. Xredirection occurs for each
  838. Xseparate filename in turn.
  839. X.TP
  840. X.BI < word
  841. XOpen file
  842. X.I word
  843. Xas standard input.
  844. X.TP
  845. X.BI > word
  846. XOpen file
  847. X.I word
  848. Xas standard output.
  849. XIf the file does not exist then it is created.
  850. XIf the file exists, and the
  851. X.B NOCLOBBER
  852. Xoption is set,
  853. Xthis causes an error;
  854. Xotherwise, it is truncated to zero length.
  855. X.TP
  856. X.BI >! " word"
  857. XSame as
  858. X.BR > ,
  859. Xexcept that the file is truncated to zero length
  860. Xif it exists, even if
  861. X.B NOCLOBBER
  862. Xis set.
  863. X.TP
  864. X.BI >> word
  865. XOpen file
  866. X.I word
  867. Xas standard output.
  868. XIf the file exists then output is appended to it.
  869. XIf the file does not exist, and the
  870. X.B NOCLOBBER
  871. Xoption is set,
  872. Xthis causes an error;
  873. Xotherwise, the file is created.
  874. X.TP
  875. X.BI >>! " word"
  876. XSame as
  877. X.BR >> ,
  878. Xexcept that the file is created if it does not
  879. Xexist, even if
  880. X.B NOCLOBBER
  881. Xis set.
  882. X.TP
  883. X\fB<<\fP[\-] \fIword\fP
  884. XThe shell input is read up to a line that is the same as
  885. X.IR word ,
  886. Xor to an end-of-file.
  887. XNo parameter substitution, command substitution or
  888. Xfilename generation is performed on
  889. X.IR word .
  890. XThe resulting document,
  891. Xcalled a
  892. X.IR here-document ,
  893. Xbecomes
  894. Xthe standard input.
  895. XIf any character of \fIword\fP is quoted with
  896. Xsingle or double quotes or a \e,
  897. Xno interpretation
  898. Xis placed upon the characters of the document.
  899. XOtherwise, parameter and command substitution
  900. Xoccurs, \e followed by a newline is removed,
  901. Xand \e must be used to quote the characters
  902. X\e, $, `, and the first character of \fIword\fP.
  903. XIf <<\- is used, then all leading
  904. Xtabs are stripped from \fIword\fP and from the document.
  905. X.TP
  906. X.BI <<< word
  907. XOpen a file containing \fIword\fP, after expansion,
  908. Xas standard input.
  909. X.TP
  910. X.BI <& digit
  911. XThe standard input
  912. Xis duplicated from file descriptor
  913. X.I digit
  914. X(see
  915. X.IR dup (2)).
  916. XSimilarly for standard output using
  917. X\fB>&\fIdigit\fP.
  918. X.TP
  919. X.BI >& word
  920. XSame as
  921. X.BI > word
  922. X\fB2>&\fP1.
  923. X.TP
  924. X.BI >>& word
  925. XSame as
  926. X.BI >> word
  927. X\fB2>&\fP1.
  928. X.TP
  929. X.BI <&\-
  930. XClose the standard input.
  931. X.TP
  932. X.BI >&\-
  933. XClose the standard output.
  934. X.TP
  935. X.BI <&p
  936. XThe input from the coprocess is moved to the standard input.
  937. X.TP
  938. X.BI >&p
  939. XThe output to the coprocess is moved to the standard output.
  940. X.PP
  941. XIf one of the above is preceded by a digit, then the file
  942. Xdescriptor referred to is that specified by the digit
  943. X(instead of the default 0 or 1).
  944. XThe order in which redirections are specified is significant.
  945. XThe shell evaluates each redirection in terms of the
  946. X.RI ( "file descriptor" ", " file )
  947. Xassociation at the time of evaluation.
  948. XFor example:
  949. X.RS
  950. X.PP
  951. X\&.\|.\|. \|1>\fIfname\^\fP 2>&1
  952. X.RE
  953. X.PP
  954. Xfirst associates file descriptor 1 with file
  955. X.IR fname .
  956. XIt then associates file descriptor 2 with the file associated with file
  957. Xdescriptor 1 (that is,
  958. X.IR fname ).
  959. XIf the order of redirections were reversed, file descriptor 2 would be associated
  960. Xwith the terminal (assuming file descriptor 1 had been) and then file descriptor
  961. X1 would be associated with file
  962. X.IR fname .
  963. X.PP
  964. XIf the user tries to open a file descriptor for writing more than once,
  965. Xthe shell opens the file descriptor as a pipe to a process that copies
  966. Xits input to all the specified outputs, similar to tee(1).  Thus:
  967. X.RS
  968. X.PP
  969. X.B date >foo >bar
  970. X.RE
  971. X.PP
  972. Xwrites the date to two files, named "foo" and "bar".
  973. XNote that a pipe is an implicit indirection; thus
  974. X.RS
  975. X.PP
  976. X.B date >foo | cat
  977. X.RE
  978. X.PP
  979. Xwrites the date to the file "foo", and also pipes it to cat.
  980. X.PP
  981. XIf the user tries to open a file descriptor for reading more than once,
  982. Xthe shell opens the file descriptor as a pipe to a process that copies
  983. Xall the specified inputs to its output in the order
  984. Xspecified, similar to cat(1).  Thus
  985. X.RS
  986. X.PP
  987. X.B sort <foo <fubar
  988. X.RE
  989. X.PP
  990. Xor even
  991. X.RS
  992. X.PP
  993. X.B sort <f{oo,ubar}
  994. X.RE
  995. X.PP
  996. Xis equivalent to "cat foo bar | sort".  Note that
  997. Xa pipe is in implicit indirection; thus
  998. X.RS
  999. X.PP
  1000. X.B cat bar | sort <foo
  1001. X.RE
  1002. X.PP
  1003. Xis equivalent to "cat bar foo | sort" (note the order of the inputs).
  1004. X.PP
  1005. XIf a simple command consists of one or more redirection operators
  1006. Xand zero or more parameter assignments, but no command name,
  1007. Xthe command \fBcat\fP is assumed.  Thus
  1008. X.RS
  1009. X.PP
  1010. X.B < file
  1011. X.RE
  1012. X.PP
  1013. Xprints the contents of \fBfile\fP.
  1014. X.PP
  1015. XIf a command is followed by
  1016. X.B &
  1017. Xand job control is not active,
  1018. Xthen the default standard input
  1019. Xfor the command
  1020. Xis the empty file
  1021. X.BR /dev/null .
  1022. XOtherwise, the environment for the execution of a command contains the
  1023. Xfile descriptors of the invoking shell as modified by
  1024. Xinput/output specifications.
  1025. X.SH "COMMAND EXECUTION"
  1026. XIf a command name contains no slashes, the shell attempts to locate
  1027. Xit.  If there exists a shell function by that name, the function
  1028. Xis invoked as described below in \fBFUNCTIONS\fP.  If there exists
  1029. Xa shell builtin by that name, the builtin is invoked.
  1030. X.PP
  1031. XOtherwise, the shell searches each element of \fBpath\fP for a
  1032. Xdirectory containing an executable file by that name.  If the
  1033. Xsearch is unsuccessful, the shell prints an error message and returns
  1034. Xa nonzero exit status.
  1035. X.PP
  1036. XIf execution fails because the file is not in executable format,
  1037. Xand the file is not a directory, it is assumed to be a shell
  1038. Xscript.  /bin/sh is spawned to execute it.  If the program
  1039. Xis a file beginning with \fB#!\fP, the remainder of the first line
  1040. Xspecifies an interpreter for the program.  The shell will
  1041. Xexecute the specified interpreter on operating systems that do
  1042. Xnot handle this executable format in the kernel.
  1043. X.SH FUNCTIONS
  1044. X.PP
  1045. XThe
  1046. X.B function
  1047. Xreserved word is used to define shell functions.
  1048. XShell functions are read in and stored internally.
  1049. XAlias names are resolved when the function is read.
  1050. XFunctions are executed like commands with the arguments
  1051. Xpassed as positional parameters.
  1052. X(See
  1053. X.I Execution
  1054. Xbelow).
  1055. X.PP
  1056. XFunctions execute in the same process as the caller and
  1057. Xshare all files
  1058. Xand present working directory with the
  1059. Xcaller.
  1060. XA trap on
  1061. X.B EXIT
  1062. Xset inside a function
  1063. Xis executed after the function completes in the environment
  1064. Xof the caller.
  1065. X.PP
  1066. XThe
  1067. X.B return
  1068. Xbuiltin is used to return
  1069. Xfrom function calls.
  1070. X.PP
  1071. XFunction identifiers
  1072. Xcan be listed with the
  1073. X.B functions
  1074. Xbuiltin.
  1075. XFunctions can be undefined with the
  1076. X.B unfunction
  1077. Xbuiltin.
  1078. X.PP
  1079. XThe following functions, if defined, have special meaning to
  1080. Xthe shell:
  1081. X.PP
  1082. X.PD 0
  1083. X.TP
  1084. X\fBchpwd\fP
  1085. XExecuted whenever the current working directory is changed.
  1086. X.TP
  1087. X\fBprecmd\fP
  1088. XExecuted before each prompt.
  1089. X.TP
  1090. X\fBperiodic\fP
  1091. XIf the parameter
  1092. X.B PERIOD
  1093. Xis set, this function is executed every
  1094. X.B PERIOD
  1095. Xseconds, just before a prompt.
  1096. X.TP
  1097. X\fBTRAPxxx\fP
  1098. XIf defined and non-null,
  1099. Xthis function will be executed whenever the shell
  1100. Xcatches a signal \fBSIGxxx\fP, where \fBxxx\fP is a signal
  1101. Xname as specified for the \fBkill\fP builtin (see below).
  1102. XIn addition, \fBTRAPERR\fP is executed whenever a command has a non-zero
  1103. Xexit status, \fBTRAPDEBUG\fP is executed after each command, and
  1104. X\fBTRAPEXIT\fP
  1105. Xis executed when the shell exits,
  1106. Xor when the current function exits if defined
  1107. Xinside a function.
  1108. XIf a function of this form is defined and null,
  1109. Xthe shell and processes spawned by it will ignore \fBSIGxxx\fP.
  1110. X.PD
  1111. X.SH JOBS
  1112. X.PP
  1113. XIf the
  1114. X.B MONITOR
  1115. Xoption is set,
  1116. Xan interactive shell associates a \fIjob\fR with each pipeline.
  1117. XIt keeps
  1118. Xa table of current jobs, printed by the
  1119. X.B jobs
  1120. Xcommand, and assigns them small integer numbers.
  1121. XWhen a job is started asynchronously with
  1122. X.BR & ,
  1123. Xthe shell prints a line which looks
  1124. Xlike:
  1125. X.PP
  1126. X.DT
  1127. X    [1] 1234
  1128. X.PP
  1129. Xindicating that the job which was started asynchronously was job number
  1130. X1 and had one (top-level) process, whose process id was 1234.
  1131. X.PP
  1132. XIf you are running a job and wish to do something else you may hit the key
  1133. X\fB^Z\fR (control-Z) which sends a STOP signal to the current job.
  1134. XThe shell will then normally indicate that the job has been `suspended',
  1135. Xand print another prompt.
  1136. XYou can then manipulate the state of this job,
  1137. Xputting it in the background with the
  1138. X.B bg
  1139. Xcommand, or run some other
  1140. Xcommands and then eventually bring the job back into the foreground with
  1141. Xthe foreground command
  1142. X.BR fg .
  1143. XA \fB^Z\fR takes effect immediately and
  1144. Xis like an interrupt in that pending output and unread input are discarded
  1145. Xwhen it is typed.
  1146. X.PP
  1147. XA job being run in the background will suspend if it tries to read
  1148. Xfrom the terminal.
  1149. XBackground jobs are normally allowed to produce output,
  1150. Xbut this can be disabled by giving the command ``stty tostop''.
  1151. XIf you set this
  1152. Xtty option, then background jobs will suspend when they try to produce
  1153. Xoutput like they do when they try to read input.
  1154. X.PP
  1155. XThere are several ways to refer to jobs in the shell.
  1156. XA job can be referred to by the process id of any process of the job
  1157. Xor by one of the following:
  1158. X.PD 0
  1159. X.TP
  1160. X.BI % number
  1161. XThe job with the given number.
  1162. X.TP
  1163. X.BI % string
  1164. XAny job whose command line begins with
  1165. X.IR string .
  1166. X.TP
  1167. X.BI %? string
  1168. XAny job whose command line contains
  1169. X.IR string .
  1170. X.TP
  1171. X.BI %%
  1172. XCurrent job.
  1173. X.TP
  1174. X.BI %+
  1175. XEquivalent to
  1176. X.BR %% .
  1177. X.TP
  1178. X.BI %\-
  1179. XPrevious job.
  1180. X.PD
  1181. X.PP
  1182. XThe shell learns immediately whenever a process changes state.
  1183. XIt normally informs you whenever a job becomes blocked so that
  1184. Xno further progress is possible.  If
  1185. X.B notify
  1186. Xis not set, it waits until
  1187. Xjust before it prints
  1188. Xa prompt before it informs you.
  1189. X.PP
  1190. XWhen the monitor mode is on, each background job that completes
  1191. Xtriggers any trap set for
  1192. X.BR CHLD .
  1193. X.PP
  1194. XWhen you try to leave the shell while jobs are running or suspended, you will
  1195. Xbe warned that `You have suspended (running) jobs.'
  1196. XYou may use the
  1197. X.B jobs
  1198. Xcommand to see what they are.
  1199. XIf you do this or immediately try to
  1200. Xexit again, the shell will not warn you a second time; the suspended
  1201. Xjobs will be terminated, and the running jobs will be sent
  1202. Xa \fBSIGHUP\fP signal.
  1203. XTo avoid having the shell terminate the running jobs, either
  1204. Xuse the \fBnohup\fP(1) command or the \fBdisown\fP builtin (see below).
  1205. X.SH SIGNALS
  1206. XThe INT and QUIT signals for an invoked
  1207. Xcommand are ignored if the command is followed by
  1208. X.B &
  1209. Xand the job
  1210. X.B monitor
  1211. Xoption is not active.
  1212. XOtherwise, signals have the values
  1213. Xinherited by the shell from its parent
  1214. X(but see the \fBTRAPxxx\fP special function above).
  1215. X.SH HISTORY
  1216. XHistory substitution allows you to use words from previous command
  1217. Xlines in the command line you are typing.  This simplifies spelling
  1218. Xcorrections and the repetition of complicated commands or arguments.
  1219. XCommand lines are saved in the history list, the size of which
  1220. Xis controlled by the
  1221. X.B HISTSIZE
  1222. Xvariable.  The most recent command is retained in any case.
  1223. XA history substitution begins with a
  1224. X.B !
  1225. Xand may occur anywhere on the command line; history
  1226. Xsubstitutions do not nest.  The
  1227. X.B !
  1228. Xcan be escaped with
  1229. X.B \e
  1230. Xto suppress its special meaning.
  1231. XSingle or double quotes will \fInot\fP work for this.
  1232. X.PP
  1233. XInput lines containing history substitutions are echoed on the
  1234. Xterminal after being expanded, but before any other
  1235. Xsubstitutions take place or the command gets executed.
  1236. X.SS Event Designators
  1237. X.PP
  1238. XAn event designator is a reference to a command-line entry in
  1239. Xthe history list.
  1240. X.RS
  1241. X.PD 0
  1242. X.TP
  1243. X.B !
  1244. XStart a history substitution, except when followed by a blank, newline,
  1245. X.BR = ,
  1246. Xor
  1247. X.BR ( .
  1248. X.TP
  1249. X.B !!
  1250. XRefer to the previous command. 
  1251. XBy itself, this substitution
  1252. Xrepeats the previous command.
  1253. X.TP
  1254. X.BI ! n
  1255. XRefer to command-line
  1256. X.IR n .
  1257. X.TP
  1258. X.BI ! \-n
  1259. XRefer to the current command-line minus
  1260. X.IR n .
  1261. X.TP
  1262. X.BI  ! str
  1263. XRefer to the most recent command starting with
  1264. X.IR str .
  1265. X.TP
  1266. X.BI  !? str\fR[\fP ? \fR]\fP
  1267. XRefer to the most recent command containing
  1268. X.IR str .
  1269. X.TP
  1270. X.B !#
  1271. XRefer to the current command line typed in so far.
  1272. X.TP
  1273. X.BR !{ .\|.\|. }
  1274. XInsulate a history reference from adjacent characters (if necessary).
  1275. X.PD
  1276. X.RE
  1277. X.SS Word Designators
  1278. X.PP
  1279. XA
  1280. X.RB ` : '
  1281. Xseparates the event specification from the word designator. 
  1282. XIt can be omitted if the word designator begins with a
  1283. X.BR \*^ ,
  1284. X.BR $ ,
  1285. X.BR * ,
  1286. X.B \-
  1287. Xor
  1288. X.BR % .
  1289. XIf the word is to be selected from the previous command, the second
  1290. X.B !
  1291. Xcharacter can be omitted from the event specification.  For instance,
  1292. X.B !!:1
  1293. Xand
  1294. X.B !:1
  1295. Xboth refer to the first word of the previous command, while
  1296. X.B !!$
  1297. Xand
  1298. X.B !$
  1299. Xboth refer to the last word in the previous command. 
  1300. XWord designators include:
  1301. X.RS
  1302. X.PD 0
  1303. X.TP
  1304. X.B 0
  1305. XThe first input word (command).
  1306. X.TP
  1307. X.I n
  1308. XThe
  1309. X.IR n 'th
  1310. Xargument.
  1311. X.TP
  1312. X.B ^
  1313. XThe first argument, that is,
  1314. X.BR 1 .
  1315. X.TP
  1316. X.B $
  1317. XThe last argument.
  1318. X.TP
  1319. X.B %
  1320. XThe word matched by (the most recent)
  1321. X.BI ? s
  1322. Xsearch.
  1323. X.TP
  1324. X.IB x \- y
  1325. XA range of words;
  1326. X.BI \- y
  1327. Xabbreviates
  1328. X.BI 0\- y\fR.
  1329. X.TP
  1330. X.B *
  1331. XAll the arguments, or a null value if there is just
  1332. Xone word in the event.
  1333. X.TP
  1334. X.IB x *
  1335. XAbbreviates
  1336. X.IB x \-$ .
  1337. X.TP
  1338. X.IB x \-
  1339. XLike
  1340. X.I x*
  1341. Xbut omitting word
  1342. X.BR $ .
  1343. X.PD
  1344. X.RE
  1345. X.SS Modifiers
  1346. X.PP
  1347. XAfter the optional word designator, you can add
  1348. Xa sequence of one or more of the following modifiers,
  1349. Xeach preceded by a
  1350. X.BR : .
  1351. XThese modifiers also work on the result
  1352. Xof filename and parameter expansion.
  1353. X.RS
  1354. X.TP
  1355. X.B h
  1356. XRemove a trailing pathname component, leaving the head.
  1357. X.PD 0
  1358. X.TP
  1359. X.B r
  1360. XRemove a trailing suffix of the form
  1361. X.RB ` "\&.\fIxxx" ',
  1362. Xleaving the basename.
  1363. X.TP
  1364. X.B e
  1365. XRemove all but the suffix.
  1366. X.TP
  1367. X.B t
  1368. XRemove all leading pathname components, leaving the tail.
  1369. X.TP
  1370. X.B &
  1371. XRepeat the previous substitution.
  1372. X.TP
  1373. X.B g
  1374. XApply the change to the first occurrence of a match in each word,
  1375. Xby prefixing the above (for example,
  1376. X.BR g& ).
  1377. X.TP
  1378. X.B p
  1379. XPrint the new command but do not execute it.
  1380. X.TP
  1381. X.B q
  1382. XQuote the substituted words, escaping further substitutions.
  1383. X.TP
  1384. X.B x
  1385. XLike
  1386. X.BR q ,
  1387. Xbut break into words at each blank.
  1388. X.TP
  1389. X.B l
  1390. XConvert the words to all lowercase.
  1391. X.TP
  1392. X.B u
  1393. XConvert the words to all uppercase.
  1394. X.TP
  1395. X.BI s/ l / r\fR[\fP / \fR]\fP
  1396. XSubstitute
  1397. X.I r
  1398. Xfor
  1399. X.IR l .
  1400. X.PD
  1401. X.RE
  1402. X.PP
  1403. XUnless preceded by a
  1404. X.BR g ,
  1405. Xthe substitution is done only for the
  1406. Xfirst string that matches
  1407. X.IR l .
  1408. X.PP
  1409. XThe left-hand side of substitutions are not regular expressions,
  1410. Xbut character strings.
  1411. XAny character can be used as the delimiter in place of
  1412. X.BR / .
  1413. XA backslash quotes the delimiter character.
  1414. XThe character
  1415. X.BR & ,
  1416. Xin the right hand side, is replaced by the text
  1417. Xfrom the left-hand-side. 
  1418. XThe
  1419. X.B &
  1420. Xcan be quoted with a backslash. 
  1421. XA null
  1422. X.I l
  1423. Xuses the previous string either from a
  1424. X.I l
  1425. Xor from a contextual scan string
  1426. X.I s
  1427. Xfrom
  1428. X.BI !? s\fR.
  1429. XYou can omit the rightmost delimiter if a newline
  1430. Ximmediately follows
  1431. X.IR r ;
  1432. Xthe rightmost
  1433. X.B ?
  1434. Xin a context scan can similarly be omitted.
  1435. X.PP
  1436. XWithout an event specification, a history reference refers either to the
  1437. Xprevious command, or to a previous history reference on the command line
  1438. X(if any).
  1439. X.PP
  1440. XThe character sequence
  1441. X.BI ^ foo ^ bar
  1442. Xrepeats the last command, replacing the string "foo" with the
  1443. Xstring "bar".
  1444. X.PP
  1445. XIf the shell encounters the character sequence
  1446. X\fB!"\fP
  1447. Xin the input, the history mechanism is temporarily disabled until
  1448. Xthe current list is fully parsed.  The
  1449. X\fB!"\fP
  1450. Xis removed from the input, and any subsequent
  1451. X.B !
  1452. Xcharacters have no special significance.
  1453. X.PP
  1454. XA less convenient but more comprehensible
  1455. Xform of command history support
  1456. Xis provided by the
  1457. X.B fc
  1458. Xbuiltin (see below).
  1459. X.SH "ARITHMETIC EVALUATION"
  1460. XAn ability to perform integer arithmetic
  1461. Xis provided with the builtin
  1462. X.BR let .
  1463. XEvaluations are performed using
  1464. X.I long
  1465. Xarithmetic.
  1466. XConstants are of the form
  1467. X[\fIbase\fB#\^\fR]\fIn\^\fP
  1468. Xwhere
  1469. X.I base
  1470. Xis a decimal number between two and thirty-six
  1471. Xrepresenting the arithmetic base
  1472. Xand
  1473. X.I n
  1474. Xis a number in that base.
  1475. XIf
  1476. X.I base
  1477. Xis omitted
  1478. Xthen base 10 is used.
  1479. X.PP
  1480. XAn arithmetic expression uses nearly the same syntax, precedence, and
  1481. Xassociativity of
  1482. Xexpressions in C.
  1483. XThe following operators are supported (listed in decreasing order
  1484. Xof precedence):
  1485. X.PP
  1486. X.PD 0
  1487. X.RS
  1488. X.TP
  1489. X.B + \- ! \(ap ++ \-\|\-
  1490. Xunary plus/minus, logical NOT, complement, {pre,post}{in,de}crement
  1491. X.TP
  1492. X.B &
  1493. Xlogical AND
  1494. X.TP
  1495. X.B ^
  1496. Xlogical XOR
  1497. X.TP
  1498. X.B |
  1499. Xlogical OR
  1500. X.TP
  1501. X.B * / %
  1502. Xmultiplication, division, remainder
  1503. X.TP
  1504. X.B + \-
  1505. Xaddition, subtraction
  1506. X.TP
  1507. X.B << >>
  1508. Xlogical shift left, shift right
  1509. X.TP
  1510. X.B < > <= >=
  1511. Xcomparison
  1512. X.TP
  1513. X.B == !=
  1514. Xequality and inequality
  1515. X.TP
  1516. X.B &&
  1517. Xboolean AND
  1518. X.TP
  1519. X.B |\|| ^^
  1520. Xboolean OR, XOR
  1521. X.TP
  1522. X.B ? :
  1523. Xternary operator
  1524. X.TP
  1525. X.B
  1526. X= += \-= *= /= %= &= ^= |= <<= >>= &&= |\||= ^^=
  1527. Xassignment
  1528. X.TP
  1529. X.B ,
  1530. Xcomma operator
  1531. X.PD
  1532. X.RE
  1533. X.PP
  1534. XThe operators &&, |\||, &&=, and |\||= are short-circuiting,
  1535. Xand only one of the latter two expressions in a ternary operator
  1536. Xis evaluated.  Note the precedence of the logical AND, OR,
  1537. Xand XOR operators.
  1538. X.PP
  1539. XNamed parameters can be referenced by name within an arithmetic expression
  1540. Xwithout using the parameter substitution syntax.
  1541. X.PP
  1542. XAn internal integer representation of a named parameter
  1543. Xcan be specified with the
  1544. X.B integer
  1545. Xbuiltin.
  1546. XArithmetic evaluation is performed on the value of each
  1547. Xassignment to a named parameter declared integer
  1548. Xin this manner.
  1549. X.PP
  1550. XSince many of the arithmetic operators require
  1551. Xquoting, an alternative form of the
  1552. X.B let
  1553. Xcommand is provided.
  1554. XFor any command which begins with a
  1555. X.BR (( ,
  1556. Xall the characters until a matching
  1557. X.B ))
  1558. Xare treated as a quoted expression.
  1559. XMore precisely,
  1560. X.BR (( ... ))
  1561. Xis equivalent to
  1562. X.B let
  1563. X\fB"\fP...\fB"\fP.
  1564. X.SH "CONDITIONAL EXPRESSIONS"
  1565. XA \fIconditional expression\fP is used with the
  1566. X.B [[
  1567. Xcompound command to test attributes of files and to compare strings.
  1568. XEach expression can be constructed from one or more
  1569. Xof the following unary or binary expressions:
  1570. X.PD 0
  1571. X.TP
  1572. X\fB\-a\fP \fIfile\fP
  1573. Xtrue if
  1574. X.I file
  1575. Xexists.
  1576. X.TP
  1577. X\fB\-b\fP \fIfile\fP
  1578. Xtrue if
  1579. X.I file
  1580. Xexists and is a block special file.
  1581. X.TP
  1582. X\fB\-c\fP \fIfile\fP
  1583. Xtrue if
  1584. X.I file
  1585. Xexists and is a character special file.
  1586. X.TP
  1587. X\fB\-d\fP \fIfile\fP
  1588. Xtrue if
  1589. X.I file
  1590. Xexists and is a directory.
  1591. X.TP
  1592. X\fB\-e\fP \fIfile\fP
  1593. Xtrue if
  1594. X.I file
  1595. Xexists.
  1596. X.TP
  1597. X\fB\-f\fP \fIfile\fP
  1598. Xtrue if
  1599. X.I file
  1600. Xexists and is an ordinary file.
  1601. X.TP
  1602. X\fB\-g\fP \fIfile\fP
  1603. Xtrue if
  1604. X.I file
  1605. Xexists and has its setgid bit set.
  1606. X.TP
  1607. X\fB\-h\fP \fIfile\fP
  1608. Xtrue if
  1609. X.I file
  1610. Xexists and is a symbolic link.
  1611. X.TP
  1612. X\fB\-k\fP \fIfile\fP
  1613. Xtrue if
  1614. X.I file
  1615. Xexists and has its sticky bit set.
  1616. X.TP
  1617. X\fB\-n\fP \fIstring\fP
  1618. Xtrue if length of
  1619. X.I string
  1620. Xis non-zero.
  1621. X.TP
  1622. X\fB\-o\fP \fIoption\fP
  1623. Xtrue if option named
  1624. X.I option
  1625. Xis on.
  1626. X.TP
  1627. X\fB\-p\fP \fIfile\fP
  1628. Xtrue if
  1629. X.I file
  1630. Xexists and is a fifo special file or a pipe.
  1631. X.TP
  1632. X\fB\-r\fP \fIfile\fP
  1633. Xtrue if
  1634. X.I file
  1635. Xexists and is readable by current process.
  1636. X.TP
  1637. X\fB\-s\fP \fIfile\fP
  1638. Xtrue if
  1639. X.I file
  1640. Xexists and has size greater than zero.
  1641. X.TP
  1642. X\fB\-t\fP \fIfd\fP
  1643. Xtrue if file descriptor number
  1644. X.I fd
  1645. Xis open and associated with a terminal device.
  1646. X(note: \fIfd\fP is not optional)
  1647. X.TP
  1648. X\fB\-u\fP \fIfile\fP
  1649. Xtrue if
  1650. X.I file
  1651. Xexists and has its setuid bit set.
  1652. X.TP
  1653. X\fB\-w\fP \fIfile\fP
  1654. Xtrue if
  1655. X.I file
  1656. Xexists and is writable by current process.
  1657. X.TP
  1658. X\fB\-x\fP \fIfile\fP
  1659. Xtrue if
  1660. X.I file
  1661. Xexists and is executable by current process.
  1662. XIf
  1663. X.I file
  1664. Xexists and is a directory, then the current process
  1665. Xhas permission to search in the directory.
  1666. X.TP
  1667. X\fB\-z\fP \fIstring\fP
  1668. Xtrue if length of
  1669. X.I string
  1670. Xis zero.
  1671. X.TP
  1672. X\fB\-L\fP \fIfile\fP
  1673. Xtrue if
  1674. X.I file
  1675. Xexists and is a symbolic link.
  1676. X.TP
  1677. X\fB\-O\fP \fIfile\fP
  1678. Xtrue if
  1679. X.I file
  1680. Xexists and is owned by the effective user id of this process.
  1681. X.TP
  1682. X\fB\-G\fP \fIfile\fP
  1683. Xtrue if
  1684. X.I file
  1685. Xexists and its group matches the effective group id of this process.
  1686. X.TP
  1687. X\fB\-S\fP \fIfile\fP
  1688. Xtrue if
  1689. X.I file
  1690. Xexists and is a socket.
  1691. X.TP
  1692. X\fIfile1\fP \fB\-nt\fP \fIfile2\fP
  1693. Xtrue if
  1694. X.I file1
  1695. Xexists and is newer than
  1696. X.IR file2 .
  1697. X.TP
  1698. X\fIfile1\fP \fB\-ot\fP \fIfile2\fP
  1699. Xtrue if
  1700. X.I file1
  1701. Xexists and is older than
  1702. X.IR file2 .
  1703. X.TP
  1704. X\fIfile1\fP \fB\-ef\fP \fIfile2\fP
  1705. Xtrue if
  1706. X.I file1
  1707. Xand 
  1708. X.I file2
  1709. Xexist and refer to the same file.
  1710. X.TP
  1711. X\fIstring\fP \fB=\fP \fIpattern\fP
  1712. Xtrue if
  1713. X.I string
  1714. Xmatches
  1715. X.IR pattern .
  1716. X.TP
  1717. X\fIstring\fP \fB!=\fP \fIpattern\fP
  1718. Xtrue if
  1719. X.I string
  1720. Xdoes not match
  1721. X.IR pattern .
  1722. X.TP
  1723. X\fIstring1\fP \fB<\fP \fIstring2\fP
  1724. Xtrue if
  1725. X.I string1
  1726. Xcomes before
  1727. X.I string2
  1728. Xbased on ASCII value of their characters.
  1729. X.TP
  1730. X\fIstring1\fP \fB>\fP \fIstring2\fP
  1731. Xtrue if
  1732. X.I string1
  1733. Xcomes after
  1734. X.I string2
  1735. Xbased on ASCII value of their characters.
  1736. X.TP
  1737. X\fIexp1\fP \fB\-eq\fP \fIexp2\fP
  1738. Xtrue if
  1739. X.I exp1
  1740. Xis equal to
  1741. X.IR exp2.
  1742. X.TP
  1743. X\fIexp1\fP \fB\-ne\fP \fIexp2\fP
  1744. Xtrue if
  1745. X.I exp1
  1746. Xis not equal to
  1747. X.IR exp2.
  1748. X.TP
  1749. X\fIexp1\fP \fB\-lt\fP \fIexp2\fP
  1750. Xtrue if
  1751. X.I exp1
  1752. Xis less than
  1753. X.IR exp2.
  1754. X.TP
  1755. X\fIexp1\fP \fB\-gt\fP \fIexp2\fP
  1756. Xtrue if
  1757. X.I exp1
  1758. Xis greater than
  1759. X.IR exp2.
  1760. X.TP
  1761. X\fIexp1\fP \fB\-le\fP \fIexp2\fP
  1762. Xtrue if
  1763. X.I exp1
  1764. Xis less than or equal to
  1765. X.IR exp2.
  1766. X.TP
  1767. X\fIexp1\fP \fB\-ge\fP \fIexp2\fP
  1768. Xtrue if
  1769. X.I exp1
  1770. Xis greater than or equal to
  1771. X.IR exp2.
  1772. X.TP
  1773. X\fB(\fP \fIexp\fP \fB)\fP
  1774. Xtrue if \fIexp\fP is true.
  1775. X.TP
  1776. X\fB!\fP \fIexp\fP
  1777. Xtrue if \fIexp\fP is false.
  1778. X.TP
  1779. X\fIexp1\fP \fB&&\fP \fIexp2\fP
  1780. Xtrue if \fIexp1\fP and \fIexp2\fP are both true.
  1781. X.TP
  1782. X\fIexp1\fP \fB|\||\fP \fIexp2\fP
  1783. Xtrue if either \fIexp1\fP or \fIexp2\fP is true.
  1784. X.PD
  1785. X.PP
  1786. XIn each of the above expressions, if
  1787. X.I file
  1788. Xis of the form
  1789. X\fB/dev/fd/\fP\fIn\fR,
  1790. Xwhere
  1791. X.I n
  1792. Xis an integer,
  1793. Xthen the test applied to the open file whose
  1794. Xdescriptor number is
  1795. X.IR n ,
  1796. Xeven if the underlying system does not support
  1797. Xthe \fB/dev/fd\fP directory.
  1798. X.PD
  1799. X.SH "ZSH LINE EDITOR"
  1800. XIf the \fBZLE\fP option is set (it is by default)
  1801. Xand the shell input is attached to the terminal, the user
  1802. Xis allowed to edit command lines.
  1803. X.PP
  1804. XThere are two display modes.  The first, multiline mode, is the default.
  1805. XIt only works if the \fBTERM\fP parameter is set to a valid
  1806. Xterminal type that can move the cursor up.  The second,
  1807. Xsingle line mode, is used if \fBTERM\fP is invalid or incapable
  1808. Xof moving the cursor up, or if the \fBSINGLE_LINE_ZLE\fP
  1809. Xoption is set.  This mode is similar to ksh, and uses no
  1810. Xtermcap sequences.
  1811. X.SS Bindings
  1812. XCommand bindings may be set using the \fBbindkey\fP builtin.
  1813. XThere are two keymaps\-the main keymap and the alternate keymap.
  1814. XThe alternate keymap is bound to vi command mode.
  1815. XThe main keymap is bound to emacs mode by default.
  1816. XTo bind the main keymap to vi insert mode, use 
  1817. X\fBbindkey \-v\fP, or set one of the \fBVISUAL\fP or \fBEDITOR\fP
  1818. Xenvironment variables to a string containing \fBvi\fP.
  1819. X.PP
  1820. XThe following is a list of all the key commands
  1821. Xand their default bindings in emacs and vi command mode.
  1822. X.SS Movement
  1823. X.TP
  1824. X\fBvi-backward-blank-word\fP (unbound) (B)
  1825. XMove backward one word, where a word is defined as a series of
  1826. Xnon-blank characters.
  1827. X.TP
  1828. X\fBbackward-char\fP (^B ESC-[D) (\|)
  1829. XMove backward one character.
  1830. X.TP
  1831. X\fBvi-backward-char\fP (\|) (h)
  1832. XMove backward one character, without changing lines.
  1833. X.TP
  1834. X\fBbackward-word\fP (ESC-B ESC-b) (unbound)
  1835. XMove to the beginning of the previous word.
  1836. X.TP
  1837. X\fBemacs-backward-word\fP
  1838. XMove to the beginning of the previous word.
  1839. X.TP
  1840. X\fBvi-backward-word\fP (unbound) (b)
  1841. XMove to the beginning of the previous word, vi-style.
  1842. X.TP
  1843. X\fBbeginning-of-line\fP (^A) (0)
  1844. XMove to the beginning of the line.  If already at the beginning
  1845. Xof the line, move to the beginning of the previous line, if any.
  1846. X.TP
  1847. X\fBvi-beginning-of-line\fP
  1848. XMove to the beginning of the line, without changing lines.
  1849. X.TP
  1850. X\fBend-of-line\fP (^E)
  1851. XMove to the end of the line.  If already at the end 
  1852. Xof the line, move to the end of the next line, if any.
  1853. X.TP
  1854. X\fBvi-end-of-line\fP (unbound) ($)
  1855. XMove to the end of the line.
  1856. X.TP
  1857. X\fBvi-forward-blank-word\fP (unbound) (W)
  1858. XMove forward one word, where a word is defined as a series of
  1859. Xnon-blank characters.
  1860. X.TP
  1861. X\fBvi-forward-blank-word-end\fP (unbound) (E)
  1862. XMove to the end of the current word,
  1863. Xor, if at the end of the current word,
  1864. Xto the end of the next word,
  1865. Xwhere a word is defined as a series of
  1866. Xnon-blank characters.
  1867. X.TP
  1868. X\fBforward-char\fP (^F ESC-[C)
  1869. XMove forward one character.
  1870. X.TP
  1871. X\fBvi-forward-char\fP (unbound) (space l)
  1872. XMove forward one character.
  1873. X.TP
  1874. X\fBvi-find-next-char\fP (^X^F) (f)
  1875. XRead a character from the keyboard, and move to
  1876. Xthe next occurrence of it in the line.
  1877. X.TP
  1878. X\fBvi-find-next-char-skip\fP (unbound) (t)
  1879. XRead a character from the keyboard, and move to
  1880. Xthe position just before the next occurrence of it in the line.
  1881. X.TP
  1882. X\fBvi-find-prev-char\fP (unbound) (F)
  1883. XRead a character from the keyboard, and move to
  1884. Xthe previous occurrence of it in the line.
  1885. X.TP
  1886. X\fBvi-find-prev-char-skip\fP (unbound) (T)
  1887. XRead a character from the keyboard, and move to
  1888. Xthe position just after the previous occurrence of it in the line.
  1889. X.TP
  1890. X\fBvi-first-non-blank\fP (unbound) (^)
  1891. XMove to the first non-blank character in the line.
  1892. X.TP
  1893. X\fBvi-forward-word\fP (unbound) (w)
  1894. XMove forward one word, vi-style.
  1895. X.TP
  1896. X\fBforward-word\fP (ESC-F ESC-f) (unbound)
  1897. XMove to the beginning of the next word.
  1898. XThe editor's idea of a word is specified with the \fBWORDCHARS\fP
  1899. Xparameter.
  1900. X.TP
  1901. X\fBemacs-forward-word\fP
  1902. XMove to the end of the next word.
  1903. X.TP
  1904. X\fBvi-forward-word-end\fP (unbound) (e)
  1905. XMove to the end of the next word.
  1906. X.TP
  1907. X\fBvi-goto-column\fP (ESC-|) (|)
  1908. XMove to the column specified by the numeric argument.
  1909. X.TP
  1910. X\fBvi-goto-mark\fP (unbound) (`)
  1911. XMove to the specified mark.
  1912. X.TP
  1913. X\fBvi-goto-mark-line\fP (unbound) (')
  1914. XMove to beginning of the line containing the specified mark.
  1915. X.TP
  1916. X\fBvi-repeat-find\fP (unbound) (;)
  1917. XRepeat the last \fBvi-find\fP command.
  1918. X.TP
  1919. X\fBvi-rev-repeat-find\fP (unbound) (,)
  1920. XRepeat the last \fBvi-find\fP command in the opposite direction.
  1921. X.SS History
  1922. X.TP
  1923. X\fBbeginning-of-buffer-or-history\fP (ESC-<)
  1924. XMove to the beginning of the buffer, or if already there,
  1925. Xmove to the first event in the history list.
  1926. X.TP
  1927. X\fBbeginning-of-line-hist\fP
  1928. XMove to the beginning of the line.  If already at the
  1929. Xbeginning of the buffer, move to the previous history line.
  1930. X.TP
  1931. X\fBbeginning-of-history\fP
  1932. XMove to the first event in the history list.
  1933. X.TP
  1934. X\fBdown-line-or-history\fP (^N ESC-[B) (+ j)
  1935. XMove down a line in the buffer, or if already at the bottom line,
  1936. Xmove to the next event in the history list.
  1937. X.TP
  1938. X\fBdown-line-or-search\fP
  1939. XMove down a line in the buffer, or if already at the bottom line,
  1940. Xsearch forward in the history for a line beginning with the first
  1941. Xword in the buffer.
  1942. X.TP
  1943. X\fBdown-history\fP (unbound) (^N)
  1944. XMove to the next event in the history list.
  1945. X.TP
  1946. X\fBend-of-buffer-or-history\fP (ESC->)
  1947. XMove to the end of the buffer, or if already there,
  1948. Xmove to the last event in the history list.
  1949. X.TP
  1950. X\fBend-of-line-hist\fP
  1951. XMove to the end of the line.  If already at the end of
  1952. Xthe buffer, move to the next history line.
  1953. X.TP
  1954. X\fBend-of-history\fP
  1955. XMove to the last event in the history list.
  1956. X.TP
  1957. X\fBvi-fetch-history\fP (unbound) (G)
  1958. XFetch the history line specified by the numeric argument.
  1959. X.TP
  1960. X\fBhistory-incremental-search-backward\fP (^R ^Xr)
  1961. XSearch backward incrementally for a specified string.
  1962. XThe string may begin with `^' to anchor the search to the
  1963. Xbeginning of the line.
  1964. X.TP
  1965. X\fBhistory-incremental-search-forward\fP (^Xs)
  1966. XSearch forward incrementally for a specified string.
  1967. XThe string may begin with `^' to anchor the search to the
  1968. Xbeginning of the line.
  1969. X.TP
  1970. X\fBhistory-search-backward\fP (ESC-P ESC-p) (K)
  1971. XSearch backward in the history for a line beginning with the first
  1972. Xword in the buffer.
  1973. X.TP
  1974. X\fBvi-history-search-backward\fP (unbound) (/)
  1975. XSearch backward in the history for a specified string.
  1976. XThe string may begin with `^' to anchor the search to the
  1977. Xbeginning of the line.
  1978. X.TP
  1979. X\fBhistory-search-forward\fP (ESC-N ESC-n) (J)
  1980. XSearch forward in the history for a line beginning with the first
  1981. Xword in the buffer.
  1982. X.TP
  1983. X\fBvi-history-search-forward\fP (unbound) (?)
  1984. XSearch forward in the history for a specified string.
  1985. XThe string may begin with `^' to anchor the search to the
  1986. Xbeginning of the line.
  1987. X.TP
  1988. X\fBinfer-next-history\fP (^X^N)
  1989. END_OF_FILE
  1990.   if test 49329 -ne `wc -c <'man/man1/zsh.1.01'`; then
  1991.     echo shar: \"'man/man1/zsh.1.01'\" unpacked with wrong size!
  1992.   fi
  1993.   # end of 'man/man1/zsh.1.01'
  1994. fi
  1995. if test -f 'src/ztype.h' -a "${1}" != "-c" ; then 
  1996.   echo shar: Will not clobber existing file \"'src/ztype.h'\"
  1997. else
  1998.   echo shar: Extracting \"'src/ztype.h'\" \(1486 characters\)
  1999.   sed "s/^X//" >'src/ztype.h' <<'END_OF_FILE'
  2000. X/*
  2001. X *
  2002. X * ztype.h - character classification macros
  2003. X *
  2004. X * This file is part of zsh, the Z shell.
  2005. X *
  2006. X * This software is Copyright 1992 by Paul Falstad
  2007. X *
  2008. X * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  2009. X * use this software as long as: there is no monetary profit gained
  2010. X * specifically from the use or reproduction of this software, it is not
  2011. X * sold, rented, traded or otherwise marketed, and this copyright notice is
  2012. X * included prominently in any copy made. 
  2013. X *
  2014. X * The author make no claims as to the fitness or correctness of this software
  2015. X * for any use whatsoever, and it is provided as is. Any use of this software
  2016. X * is at the user's own risk. 
  2017. X *
  2018. X */
  2019. X
  2020. X#define IDIGIT  1
  2021. X#define IALNUM  2
  2022. X#define IBLANK  4
  2023. X#define INBLANK 8
  2024. X#define ITOK    16
  2025. X#define ISEP    32
  2026. X#define IALPHA  64
  2027. X#define IIDENT  128
  2028. X#define IUSER   256
  2029. X#define ICNTRL  512
  2030. X#define IWORD     1024
  2031. X#define ISPECIAL 2048
  2032. X#define _icom(X,Y) (typtab[(int) (unsigned char) (X)] & Y)
  2033. X#define idigit(X) _icom(X,IDIGIT)
  2034. X#define ialnum(X) _icom(X,IALNUM)
  2035. X#define iblank(X) _icom(X,IBLANK)        /* blank, not including \n */
  2036. X#define inblank(X) _icom(X,INBLANK)        /* blank or \n */
  2037. X#define itok(X) _icom(X,ITOK)
  2038. X#define isep(X) _icom(X,ISEP)
  2039. X#define ialpha(X) _icom(X,IALPHA)
  2040. X#define iident(X) _icom(X,IIDENT)
  2041. X#define iuser(X) _icom(X,IUSER)            /* username char */
  2042. X#define icntrl(X) _icom(X,ICNTRL)
  2043. X#define iword(X) _icom(X,IWORD)
  2044. X#define ispecial(X) _icom(X,ISPECIAL)
  2045. X
  2046. XEXTERN short int typtab[256];
  2047. X
  2048. END_OF_FILE
  2049.   if test 1486 -ne `wc -c <'src/ztype.h'`; then
  2050.     echo shar: \"'src/ztype.h'\" unpacked with wrong size!
  2051.   fi
  2052.   # end of 'src/ztype.h'
  2053. fi
  2054. echo shar: End of archive 7 \(of 22\).
  2055. cp /dev/null ark7isdone
  2056. MISSING=""
  2057. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ; do
  2058.     if test ! -f ark${I}isdone ; then
  2059.     MISSING="${MISSING} ${I}"
  2060.     fi
  2061. done
  2062. if test "${MISSING}" = "" ; then
  2063.     echo You have unpacked all 22 archives.
  2064.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2065. else
  2066.     echo You still must unpack the following archives:
  2067.     echo "        " ${MISSING}
  2068. fi
  2069. exit 0
  2070.  
  2071. exit 0 # Just in case...
  2072.