home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2320 < prev    next >
Internet Message Format  |  1990-12-28  |  79KB

  1. From: pfalstad@phoenix.Princeton.EDU (Paul John Falstad)
  2. Newsgroups: alt.sources
  3. Subject: zsh - a ksh/tcsh-like shell (part 1 of 8)
  4. Message-ID: <4742@idunno.Princeton.EDU>
  5. Date: 14 Dec 90 23:28:41 GMT
  6.  
  7. ---cut here---cut here---cut here---
  8. #! /bin/sh
  9. #
  10. # This is a shar file containing zsh, a ksh/tcsh-like shell.  To extract,
  11. # cat all 8 parts together and pipe the result through sh.  There is
  12. # a "cut here" at the beginning and end of each part--be sure to
  13. # remove everything outside of those.  I put the # man page first so
  14. # you can see what zsh is like.
  15. #
  16. # To unbundle, sh this file
  17. # Fri Dec 14 18:10:16 EST 1990
  18. mkdir readline
  19. echo zsh.1 1>&2
  20. sed 's/^-//' >zsh.1 <<'End of zsh.1'
  21. -.TH ZSH 1
  22. -.SH NAME
  23. -zsh \- the Z shell
  24. -.SH SYNTAX
  25. -\fBzsh\fP
  26. -[
  27. -.B \-aefikmnstuvx0123456789ABCDEFGHIJK
  28. -] [
  29. -.B \-c
  30. -string ]
  31. -[ arg .\|.\|. ]
  32. -.SH DESCRIPTION
  33. -\fBzsh\fP
  34. -is a command interpreter and programming language
  35. -that executes commands read from a terminal
  36. -or a file.
  37. -See
  38. -.B Invocation
  39. -for the meanings of arguments to \fBzsh\fP.
  40. -.SS Definitions
  41. -A metacharacter can one of the following characters:
  42. -.RS
  43. -.PP
  44. -\fB;   &   (   )   {   }   \(bv   <   >   blank   newline\fP
  45. -.RE
  46. -.PP
  47. -A blank is a
  48. -.B tab
  49. -or a
  50. -.BR space .
  51. -An identifier
  52. -is a sequence of letters, digits, or underscores
  53. -starting with a letter or underscore.
  54. -Identifiers are used as names for
  55. -`named parameters'.
  56. -A word is a sequence of
  57. -characters separated by one or more non-quoted
  58. -metacharacters.
  59. -.PP
  60. -A command
  61. -is a sequence of characters in the syntax
  62. -of the shell language.
  63. -\fBzsh\fP reads each command and
  64. -carries out the desired action either directly or by invoking
  65. -separate utilities.
  66. -A builtin is a command that is carried out by the
  67. -parent shell without creating a separate process.
  68. -.SS Commands
  69. -A simple-command is a sequence of blank
  70. -separated words
  71. -which may be preceded by a parameter assignment list.
  72. -See
  73. -.B Environment
  74. -below.
  75. -The first word specifies the name of the command to
  76. -be executed.
  77. -Except as specified below,
  78. -the remaining words are passed as arguments
  79. -to the invoked command.
  80. -The command name is passed as argument 0
  81. -(see
  82. -.BR exec (2)).
  83. -The value of a simple-command is its exit status
  84. -if it terminates normally, or (octal) 200+\fIstatus\^\fP if
  85. -it terminates abnormally (see
  86. -.B signal
  87. -for a list of
  88. -status values).
  89. -.PP
  90. -A pipeline
  91. -is a sequence of one or more
  92. -commands
  93. -separated by
  94. -.B \(bv
  95. -or
  96. -.B \(bv&
  97. -("\fB\(bv&\fP" is actually shorthand for "\fB2>&1\ \|\(bv\fP\|".  See
  98. -.B Input/Output
  99. -below).
  100. -The standard output of each command but the last
  101. -is connected by a
  102. -.B pipe 
  103. -to the standard input of the next command.
  104. -Each command is run as a separate process;
  105. -\fBzsh\fP waits for all the commands to terminate.
  106. -The exit status of a pipeline is the exit
  107. -status of the last command to terminate.  A pipeline may be preceded by
  108. -one of the following keywords:
  109. -.PP
  110. -.PD 0
  111. -.TP
  112. -\fBtime\fP
  113. -The user, system, and real times
  114. -of the commands in the pipeline are printed when the pipeline
  115. -completes.
  116. -.TP
  117. -\fBcoproc\fP
  118. -The processes are
  119. -run asynchronously with the input and output of the pipeline
  120. -connected to a two-way pipe to the parent shell.  The parent
  121. -communicates with the coprocess using the \fB>&p\fP
  122. -and \fB<&p\fP redirection operators.
  123. -.TP
  124. -\fB!\fP
  125. -The exit status of the pipeline is the boolean NOT of the
  126. -exit status of the last command.
  127. -.PD
  128. -.PP
  129. -A sublist is a sequence of one or more pipelines
  130. -separated by
  131. -.BR &&
  132. -or
  133. -.BR || .
  134. -The symbol \fB&&\fP (\fB||\fP) causes the list following it to be
  135. -executed only if the preceding pipeline returns
  136. -a zero (non-zero) value.
  137. -.PP
  138. -A list is a sequence of one or more sublists separated
  139. -by, and optionally terminated by, either
  140. -.BR ;
  141. -or
  142. -.BR & .
  143. -A \fB;\fP causes sequential execution of the preceding
  144. -sublist; a \fB&\fP causes asynchronous execution of the preceding
  145. -sublist (that is, it does not wait for that sublist to finish).
  146. -An arbitrary number of newlines may appear in a
  147. -list, instead of a semicolon,
  148. -to delimit a command.
  149. -.PP
  150. -A command
  151. -is either a simple-command
  152. -or one of the following.
  153. -Unless otherwise stated,
  154. -the value returned by a command is that of the
  155. -last simple-command executed in the command.
  156. -.TP
  157. -\fBfor\fP \fIidentifier\^\fP [ \fBin\fP \fIword\^\fP .\|.\|. ] \fB;do\fP \fIlist\^\fP \fB;done\fP
  158. -Each time a
  159. -.B for
  160. -command is executed, 
  161. -.I identifier 
  162. -is set to the next 
  163. -.I word 
  164. -taken from the
  165. -.B in
  166. -.I word list.
  167. -If
  168. -.B in 
  169. -.I word
  170. -\&.\|.\|.
  171. -is omitted, then the
  172. -.B for
  173. -command executes the \fBdo\fP \fIlist\^\fP once for each positional parameter
  174. -that is set
  175. -(see \fB"Parameter Substitution"\fP).
  176. -Execution ends when there are no more words in the list.
  177. -.TP
  178. -\fBselect\fP \fIidentifier\^\fP [ \fBin\fP \fIword\^\fP .\|.\|. ] \fB;do\fP \fIlist\^\fP \fB;done\fP
  179. -A
  180. -.B select
  181. -command prints on standard error (file descriptor 2), the set of
  182. -.IR word s,
  183. -each preceded by a number.
  184. -If
  185. -.BI in " word"
  186. -\&.\|.\|.
  187. -is omitted, then the positional parameters are used instead
  188. -(see
  189. -.B "Parameter Substitution"
  190. -below).
  191. -The
  192. -.B PROMPT3
  193. -prompt is printed
  194. -and a line is read from the standard input.
  195. -If this line consists of the number
  196. -of one of the listed
  197. -.IR word s,
  198. -then the value of the parameter
  199. -.I identifier
  200. -is set to the
  201. -.I word
  202. -corresponding to this number.
  203. -If this line is empty the selection list is
  204. -printed again.
  205. -Otherwise the value of the parameter
  206. -.I identifier
  207. -is set to null.  The contents of the line read from standard input is
  208. -saved in the parameter \fBREPLY\fP.  The
  209. -.I list
  210. -is executed for each selection until a
  211. -break or end-of-file is encountered.
  212. -.TP
  213. -\fBcase\fP \fIword\^\fP \fBin\fP [ \fIpattern\^\fP \fB)\fP \fIlist\^\fP \fB;;\fP ] .\|.\|. \fBesac\fP
  214. -A
  215. -.B case
  216. -command executes the
  217. -.I list
  218. -associated with the first
  219. -.I pattern
  220. -that matches
  221. -.IR word .
  222. -The form of the patterns is
  223. -the same as that used for
  224. -filename generation (see
  225. -.B "Filename Generation"
  226. -below).
  227. -.TP
  228. -\fBif\fP \fIlist\^\fP \fB;then\fP \fIlist\^\fP [ \
  229. -\fBelif\fP \fIlist\^\fP \fB;then\fP \fIlist\^\fP ] .\|.\|. \
  230. -[ \fB;else\fP \fIlist\^\fP ] \fB;f\&i\fP
  231. -The
  232. -.I list
  233. -following \fBif\fP is executed and,
  234. -if it
  235. -returns a zero exit status, the
  236. -.I list
  237. -following the first
  238. -.B then
  239. -is executed.  Otherwise, the
  240. -.I list
  241. -following \fBelif\fP
  242. -is executed and, if its value is zero, the
  243. -.I list
  244. -following the next
  245. -.B then
  246. -is executed.  Failing that, the
  247. -.B else
  248. -.I list
  249. -is executed.  If no
  250. -.B else
  251. -.I list
  252. -or
  253. -.B then
  254. -.I list
  255. -is executed, then the
  256. -.B if
  257. -command returns a zero exit status.
  258. -.TP
  259. -.PD 0
  260. -\fBwhile\fP \fIlist\^\fP \fB;do\fP \fIlist\^\fP \fB;done\fP
  261. -.TP
  262. -\fBuntil\fP \fIlist\^\fP \fB;do\fP \fIlist\^\fP \fB;done\fP
  263. -.PD
  264. -A
  265. -.B while
  266. -command repeatedly executes the
  267. -.B while
  268. -.I list
  269. -and, if the exit status of the last command in the list is zero, executes
  270. -the
  271. -.B do
  272. -.IR list ;
  273. -otherwise the loop terminates.
  274. -If no commands in the
  275. -.B do
  276. -.I list
  277. -are executed, then the
  278. -.B while
  279. -command returns a zero exit status;
  280. -.B until
  281. -may be used in place of
  282. -.B while
  283. -to negate
  284. -the loop termination test.
  285. -.TP
  286. -\fBrepeat\fP \fInum\fP\fB ;do\fP \fIlist\^\fP \fB;done\fP
  287. -A
  288. -.B repeat
  289. -command executes the
  290. -.I list
  291. -a certain number of times, as specified by
  292. -.IR num .
  293. -If the exit status of
  294. -.I list
  295. -is nonzero, the loop terminates.
  296. -.TP
  297. -\fB(\fP\fIlist\^\fP\fB)\fP
  298. -Execute
  299. -.I list
  300. -in a separate environment.
  301. -Note, that if two adjacent open parentheses are
  302. -needed for nesting, a space must be inserted to avoid
  303. -arithmetic evaluation as described below.
  304. -.TP
  305. -\fB{\fP\fIlist\^\fP\fB}\fP
  306. -The 
  307. -.I list
  308. -is simply executed.
  309. -.TP
  310. -.PD 0
  311. -\fBfunction\fP \fIidentifier\^\fP \fB{\fP\fIlist\fB}\fP
  312. -.TP
  313. -\fIidentifier\^\fP \fB() {\fP\fIlist\fB}\fP
  314. -.PD
  315. -Define a function which is referenced by
  316. -.IR identifier .
  317. -The body of the function is the
  318. -.I list
  319. -of commands between
  320. -.B {
  321. -and
  322. -.BR } .
  323. -(See
  324. -.B Functions
  325. -below).
  326. -.TP
  327. -\fBexec \fP\fIcommand\^\fP
  328. -.br
  329. -The
  330. -.I command
  331. -is executed in place of the parent shell, without forking.
  332. -.TP
  333. -\fBcommand \fP\fIcommand\^\fP
  334. -.br
  335. -The
  336. -.I command
  337. -is run, ignoring shell functions.
  338. -.PP
  339. -The following reserved words
  340. -are only recognized as the first word of a command
  341. -and when not quoted:
  342. -.RS
  343. -.PP
  344. -.B
  345. -if then else elif fi case esac for while until do done repeat function select time coproc ! exec command
  346. -.RE
  347. -.SS History Substitution
  348. -.LP
  349. -History substitution allows you to use words from previous command
  350. -lines in the command line you are typing.  This simplifies spelling
  351. -corrections and the repetition of complicated commands or arguments.
  352. -Command lines are saved in the history list, the size of which
  353. -is controlled by the
  354. -.B HISTSIZE
  355. -variable.  The most recent command is retained in any case.
  356. -A history substitution begins with a
  357. -.B !
  358. -and may occur anywhere on the command line; history
  359. -substitutions do not nest.  The
  360. -.B !
  361. -can be escaped with
  362. -.B \e
  363. -to suppress its special meaning.
  364. -.LP
  365. -Input lines containing history substitutions are echoed on the
  366. -terminal after being expanded, but before any other
  367. -substitutions take place or the command gets executed.
  368. -.SS \fIEvent Designators\fP
  369. -.LP
  370. -An event designator is a reference to a command-line entry in
  371. -the history list.
  372. -.RS
  373. -.PD 0
  374. -.TP
  375. -.B !
  376. -Start a history substitution, except when followed by a blank, newline,
  377. -.BR = ,
  378. -or
  379. -.BR ( .
  380. -.TP
  381. -.B !!
  382. -Refer to the previous command. 
  383. -By itself, this substitution
  384. -repeats the previous command.
  385. -.TP
  386. -.BI ! n
  387. -Refer to command-line
  388. -.IR n .
  389. -.TP
  390. -.BI ! \-n
  391. -Refer to the current command-line minus
  392. -.IR n .
  393. -.TP
  394. -.BI  ! str
  395. -Refer to the most recent command starting with
  396. -.IR str .
  397. -.TP
  398. -.BI  !? str\fR[\fP ? \fR]\fP
  399. -Refer to the most recent command containing
  400. -.IR str .
  401. -.TP
  402. -.B !#
  403. -Refer to the current command line typed in so far.
  404. -.TP
  405. -.BR !{ .\|.\|. }
  406. -Insulate a history reference from adjacent characters (if necessary).
  407. -.PD
  408. -.RE
  409. -.SS \fIWord Designators\fR
  410. -.LP
  411. -A
  412. -.RB ` : '
  413. -separates the event specification from the word designator. 
  414. -It can be omitted if the word designator begins with a
  415. -.BR \*^ ,
  416. -.BR $ ,
  417. -.BR * ,
  418. -.B \-
  419. -or
  420. -.BR % .
  421. -If the word is to be selected from the previous command, the second
  422. -.B !
  423. -character can be omitted from the event specification.  For instance,
  424. -.B !!:1
  425. -and
  426. -.B !:1
  427. -both refer to the first word of the previous command, while
  428. -.B !!$
  429. -and
  430. -.B !$
  431. -both refer to the last word in the previous command. 
  432. -Word designators include:
  433. -.RS
  434. -.PD 0
  435. -.TP
  436. -.B 0
  437. -The first input word (command).
  438. -.TP
  439. -.I n
  440. -The
  441. -.IR n 'th
  442. -argument.
  443. -.TP
  444. -.B ^
  445. -The first argument, that is,
  446. -.BR 1 .
  447. -.TP
  448. -.B $
  449. -The last argument.
  450. -.TP
  451. -.B %
  452. -The word matched by (the most recent)
  453. -.BI ? s
  454. -search.
  455. -.TP
  456. -.IB x \- y
  457. -A range of words;
  458. -.BI \- y
  459. -abbreviates
  460. -.BI 0\- y\fR.
  461. -.TP
  462. -.B *
  463. -All the arguments, or a null value if there is just
  464. -one word in the event.
  465. -.TP
  466. -.IB x *
  467. -Abbreviates
  468. -.IB x \-$ .
  469. -.TP
  470. -.IB x \-
  471. -Like
  472. -.I x*
  473. -but omitting word
  474. -.BR $ .
  475. -.PD
  476. -.RE
  477. -.SS \fIModifiers\fR
  478. -.IX "history substitution modifiers"
  479. -.IX ": modifiers" "" "\fL:\fR modifiers \(em history substitution \(em \fLcsh\fR"
  480. -.LP
  481. -After the optional word designator, you can add
  482. -a sequence of one or more of the following modifiers,
  483. -each preceded by a
  484. -.BR : .
  485. -.RS
  486. -.TP
  487. -.B h
  488. -Remove a trailing pathname component, leaving the head.
  489. -.PD 0
  490. -.TP
  491. -.B r
  492. -Remove a trailing suffix of the form
  493. -.RB ` "\&.\fIxxx" ',
  494. -leaving the basename.
  495. -.TP
  496. -.B e
  497. -Remove all but the suffix.
  498. -.TP
  499. -.BI s/ l / r\fR[\fP / \fR]\fP
  500. -Substitute
  501. -.I r
  502. -for
  503. -.IR l .
  504. -.TP
  505. -.B t
  506. -Remove all leading pathname components, leaving the tail.
  507. -.TP
  508. -.B &
  509. -Repeat the previous substitution.
  510. -.TP
  511. -.B g
  512. -Apply the change to the first occurrence of a match in each word,
  513. -by prefixing the above (for example,
  514. -.BR g& ).
  515. -.TP
  516. -.B p
  517. -Print the new command but do not execute it.
  518. -.TP
  519. -.B q
  520. -Quote the substituted words, escaping further substitutions.
  521. -.TP
  522. -.B x
  523. -Like
  524. -.BR q ,
  525. -but break into words at each blank.
  526. -.PD
  527. -.RE
  528. -.LP
  529. -Unless preceded by a
  530. -.BR g ,
  531. -the modification is applied only to the
  532. -first string that matches
  533. -.IR l ;
  534. -an error results if no string matches.
  535. -.LP
  536. -The left-hand side of substitutions are not regular expressions,
  537. -but character strings.
  538. -Any character can be used as the delimiter in place of
  539. -.BR / .
  540. -A backslash quotes the delimiter character.
  541. -The character
  542. -.BR & ,
  543. -in the right hand side, is replaced by the text
  544. -from the left-hand-side. 
  545. -The
  546. -.B &
  547. -can be quoted with a backslash. 
  548. -A null
  549. -.I l
  550. -uses the previous string either from a
  551. -.I l
  552. -or from a contextual scan string
  553. -.I s
  554. -from
  555. -.BI !? s\fR.
  556. -You can omit the rightmost delimiter if a newline
  557. -immediately follows
  558. -.IR r ;
  559. -the rightmost
  560. -.B ?
  561. -in a context scan can similarly be omitted.
  562. -.LP
  563. -Without an event specification, a history reference refers either to the
  564. -previous command, or to a previous history reference on the command line
  565. -(if any).
  566. -.PP
  567. -.LP
  568. -.PP
  569. -The character sequence
  570. -.BI ^ foo ^ bar
  571. -repeats the last command, replacing the string "foo" with the
  572. -string "bar".
  573. -.PP
  574. -If \fBzsh\fP encounters the character sequence
  575. -\fB!"\fP
  576. -in the input, the history mechanism is temporarily disabled until
  577. -the current list is fully parsed.  The
  578. -\fB!"\fP
  579. -is removed from the input, and any subsequent
  580. -.B !
  581. -characters have no special significance.
  582. -.PP
  583. -A less convenient but more comprehensible
  584. -form of command history support
  585. -is provided by the
  586. -.B fc
  587. -builtin (see below).
  588. -.SS Comments
  589. -In noninteractive shells,
  590. -a word beginning with
  591. -.B #
  592. -causes that word and all the following characters up to a newline
  593. -to be ignored.
  594. -.SS Aliasing
  595. -The first word of each command is replaced by the text of an
  596. -alias if an alias for this word has been defined.  
  597. -The replacement string can contain any
  598. -valid input
  599. -including the metacharacters listed above.
  600. -If the last character of the alias value is a blank
  601. -then the word following the alias will also be checked for alias
  602. -substitution.
  603. -Aliases can be nested.
  604. -If an alias is defined with using the \-a flag (see the
  605. -.B alias
  606. -builtin below), it will be replaced no matter where it
  607. -appears in the command line.
  608. -Aliases can be used to redefine 
  609. -builtin commands or the
  610. -`reserved words' listed above.
  611. -Aliases can be created and listed with the
  612. -alias
  613. -command and can be removed with the
  614. -unalias
  615. -command.
  616. -.PP
  617. -The following aliases
  618. -are compiled into \fBzsh\fP
  619. -but can be unset or redefined:
  620. -.RS 5
  621. -.PD 0
  622. -.TP
  623. -.B "false=\(fmlet 0\(fm"
  624. -.TP
  625. -.B "history=\(fmfc \-l\(fm"
  626. -.TP
  627. -.B "nohup=\(fmnohup\ \(fm"
  628. -.TP
  629. -.B "r=\(fmfc \-e \-\(fm"
  630. -.TP
  631. -.B "true=\(fm:\(fm"
  632. -.TP
  633. -.B "pwd=\(fmecho $PWD\(fm"
  634. -.PD
  635. -.RE
  636. -.SS Process Substitution
  637. -Each command argument of the form
  638. -\fB<(\fP\fIlist\^\fP\fB)\fP
  639. -or
  640. -\fB>(\fP\fIlist\^\fP\fB)\fP
  641. -or
  642. -\fB=(\fP\fIlist\^\fP\fB)\fP
  643. -is subject to process substitution.
  644. -In the case of the
  645. -.B <
  646. -or
  647. -.B >
  648. -forms, \fBzsh\fP
  649. -will run process
  650. -.I list
  651. -asynchronously connected to a named pipe (FIFO).
  652. -The name of this pipe will become the argument to the command.
  653. -If the form with
  654. -.B >
  655. -is selected then writing on this file will provide input for
  656. -.IR list .
  657. -If
  658. -.B <
  659. -is used,
  660. -then the file passed as an argument will
  661. -be a named pipe connected to the output of the
  662. -.I list
  663. -process.
  664. -For example,
  665. -.RS
  666. -.PP
  667. -\fBpaste <(cut \-f1\fP \fIfile1\fP\fB) <(cut \-f3\fP \fIfile2\fB) | tee >(\fP\fIprocess1\fP\fB) >(\fP\fIprocess2\fP\fB)\fP >/dev/null
  668. -.RE
  669. -.PP
  670. -.BR cut s
  671. -fields 1 and 3 from
  672. -the files
  673. -.I file1
  674. -and
  675. -.I file2
  676. -respectively,
  677. -.BR paste s
  678. -the results together, and sends it to the processes
  679. -.I process1
  680. -and
  681. -.IR process2 .
  682. -Note that the file, which is passed as an argument to the command,
  683. -is a system
  684. -pipe 
  685. -so programs that expect to
  686. -.BR lseek (2)
  687. -on the file will not work.
  688. -Also note that the previous example can be more compactly and
  689. -efficiently written as:
  690. -.RS
  691. -.PP
  692. -\fBpaste <(cut \-f1\fP \fIfile1\fP\fB) <(cut \-f3\fP \fIfile2\fB) > >(\fP\fIprocess1\fP\fB) > >(\fP\fIprocess2\fP\fB)\fP
  693. -.RE
  694. -.PP
  695. -\fBzsh\fP uses socketpairs (pipes) instead of a FIFOs to implement the latter
  696. -two process substitutions in the above example.
  697. -.PP
  698. -If
  699. -.B =
  700. -is used,
  701. -then the file passed as an argument will be the name
  702. -of a temporary file containing
  703. -the output of the
  704. -.I list
  705. -process.  This may be used instead of the
  706. -.B <
  707. -form for a program that expects to lseek on the input file.
  708. -.SS Parameter Substitution
  709. -A parameter is an identifier,
  710. -one or more digits,
  711. -or any of the characters
  712. -.BR \(** ,
  713. -.BR # ,
  714. -.BR ? ,
  715. -.BR \- ,
  716. -.BR $ ,
  717. -and
  718. -.BR !\\^ .
  719. -The value of a named
  720. -parameter may also be assigned by writing:
  721. -.RS
  722. -.PP
  723. -.IB name = value\^\|
  724. -[
  725. -.IB name = value
  726. -] .\|.\|.
  727. -.RE
  728. -.PP
  729. -If
  730. -.I name
  731. -was declared integer with the
  732. -.B integer
  733. -builtin, the
  734. -.I value
  735. -is subject to arithmetic evaluation as described below.
  736. -.PP
  737. -Positional parameters,
  738. -parameters denoted by a number,
  739. -may be assigned values with the
  740. -\fBset\fP
  741. -builtin.  Parameter
  742. -.B $0
  743. -is set from argument zero when \fBzsh\fP
  744. -is invoked.
  745. -.PP
  746. -The character
  747. -.B $
  748. -is used to introduce parameter substitution.
  749. -Note that the results of such
  750. -substitution are quoted from all
  751. -further substitution.
  752. -.PP
  753. -.PD 0
  754. -.RS
  755. -.TP
  756. -\fB${\fP\fIparameter\^\fP\fB}\fP
  757. -The value, if any, of the parameter is substituted.
  758. -The braces are required when
  759. -.I parameter
  760. -is followed by a letter, digit, or underscore
  761. -that is not to be interpreted as part of its name
  762. -or when a named parameter is subscripted.
  763. -If
  764. -.I parameter
  765. -is one or more digits then it is a positional parameter.
  766. -.I parameter
  767. -may be followed by zero or more of any of the modifiers allowed in the
  768. -history mechanism except \fBq\fP and \fBx\fP.
  769. -.TP
  770. -\fB$*\fP
  771. -All the positional
  772. -parameters, starting with
  773. -.BR $1 ,
  774. -are substituted.
  775. -.TP
  776. -\fB${\fP\fIparameter\^\fP\fB:\-\fP\fIword\^\fP\fB}\fP
  777. -If
  778. -.I parameter
  779. -is set and is non-null then substitute its value;
  780. -otherwise substitute
  781. -.IR word .
  782. -.TP
  783. -\fB${\fP\fIparameter\^\fP\fB:=\fP\fIword\^\fP\fB}\fP
  784. -If
  785. -.I parameter
  786. -is not set or is null then set it to
  787. -.IR word ;
  788. -the value of the parameter is then substituted.
  789. -Positional parameters may be assigned to
  790. -in this way.
  791. -.TP
  792. -\fB${\fP\fIparameter\^\fP\fB:?\fP\fIword\^\fP\fB}\fP
  793. -If
  794. -.I parameter
  795. -is set and is non-null then substitute its value;
  796. -otherwise, print
  797. -.I word
  798. -and exit.
  799. -If
  800. -.I word
  801. -is omitted then a standard message is printed.
  802. -.TP
  803. -\fB${\fP\fIparameter\^\fP\fB:+\fP\fIword\^\fP\fB}\fP
  804. -If
  805. -.I parameter
  806. -is set and is non-null then substitute
  807. -.IR word ;
  808. -otherwise substitute nothing.
  809. -.TP
  810. -\fB${\fP\fIparameter\^\fP\fB#\fP\fIpattern\^\fP\fB}\fP
  811. -.TP
  812. -\fB${\fP\fIparameter\^\fP\fB##\fP\fIpattern\^\fP\fB}\fP
  813. -If the shell
  814. -.I pattern
  815. -matches the beginning of the value of
  816. -.IR parameter ,
  817. -then the value of
  818. -this substitution is the value of the
  819. -.I parameter
  820. -with the matched portion deleted;
  821. -otherwise the value of this
  822. -.I parameter
  823. -is substituted.
  824. -In the first form the smallest matching pattern is deleted and in the
  825. -second form the largest matching pattern is deleted.
  826. -.TP
  827. -\fB${\fP\fIparameter\^\fP\fB%\fP\fIpattern\^\fP\fB}\fP
  828. -.TP
  829. -\fB${\fP\fIparameter\^\fP\fB%%\fP\fIpattern\^\fP\fB}\fP
  830. -If
  831. -the shell
  832. -.I pattern
  833. -matches the end of the value of
  834. -.IR parameter ,
  835. -then the value of
  836. -this substitution is the value of the
  837. -.I parameter
  838. -with the matched part deleted;
  839. -otherwise substitute the value of
  840. -.IR parameter .
  841. -In the first form the smallest matching pattern is deleted and in the
  842. -second form the largest matching pattern is deleted.
  843. -.PD
  844. -.RE
  845. -.PP
  846. -In the above,
  847. -.I word
  848. -is not evaluated unless it is
  849. -to be used as the substituted string,
  850. -so that, in the following example,
  851. -pwd
  852. -is executed only if
  853. -.B d
  854. -is not set or is null:
  855. -.RS
  856. -.PP
  857. -.B "echo \|${d:\-\^$(\^pwd\^)\^}"
  858. -.RE
  859. -.PP
  860. -If the
  861. -.B :
  862. -is omitted from the above expressions,
  863. -then \fBzsh\fP only checks whether
  864. -.I parameter
  865. -is set or not.
  866. -.PP
  867. -The following parameters are automatically set by \fBzsh\fP:
  868. -.RS
  869. -.PD 0
  870. -.TP 10
  871. -.B #
  872. -The number of positional parameters in decimal.
  873. -.TP
  874. -.B \-
  875. -Flags supplied to \fBzsh\fP on invocation or by
  876. -the
  877. -.B setopt
  878. -command.
  879. -.TP
  880. -.B ?
  881. -The decimal value returned by the last executed command.
  882. -.TP
  883. -.B $
  884. -The process number of this shell.
  885. -.TP
  886. -.B !
  887. -The process number of the last background command invoked.
  888. -.TP
  889. -.B EUID
  890. -The effective user id of the shell process.
  891. -.TP
  892. -.B HOSTTYPE
  893. -A string corresponding to the architecture \fBzsh\fP is running on.
  894. -.TP
  895. -.B PPID
  896. -The process number of the parent of this shell.
  897. -.TP
  898. -.B PWD
  899. -The present working directory set by the
  900. -cd
  901. -command.
  902. -.TP
  903. -.B RANDOM
  904. -Each time this parameter is referenced, a random integer,
  905. -uniformly distributed between 0 and 32767, is generated.
  906. -The sequence of random numbers can be initialized by assigning
  907. -a numeric value to
  908. -RANDOM.
  909. -.TP
  910. -.B LINENO
  911. -In a script, the current line number.
  912. -.TP
  913. -.B REPLY
  914. -This parameter is set by the
  915. -.B select
  916. -statement and by
  917. -the
  918. -.B read
  919. -builtin when no arguments are supplied.
  920. -.TP
  921. -.B SECONDS
  922. -Each time this parameter is referenced, the number of
  923. -seconds since shell invocation is returned.
  924. -If this parameter is
  925. -assigned a value, then the value returned upon reference will
  926. -be the value that was assigned plus the number of seconds since the assignment.
  927. -.TP
  928. -.B TCxx
  929. -The string or value corresponding to the termcap entry \fBxx\fP.
  930. -.TP
  931. -.B UID
  932. -The user id of the shell process.
  933. -.TP
  934. -.B USERNAME
  935. -The name corresponding to the real user id of this shell process.
  936. -.TP
  937. -.B VERSION
  938. -The version number of this \fBzsh\fP.
  939. -.PD
  940. -.RE
  941. -.PP
  942. -The following parameters are used by \fBzsh\fP:
  943. -.RS
  944. -.PD 0
  945. -.TP
  946. -.B ARGV0
  947. -If placed in the environment for a command, \fBzsh\fP
  948. -will use its value as argv[0] for the \fBexec\fP(2) call
  949. -rather than the specified command name.
  950. -.TP
  951. -.B CDPATH
  952. -The search path for the
  953. -cd
  954. -command.
  955. -.TP
  956. -.B FCEDIT
  957. -The default editor name for the
  958. -.B fc
  959. -command.
  960. -.TP
  961. -.B IFS
  962. -Internal field separators,
  963. -normally
  964. -.BR space ,
  965. -.BR tab ,
  966. -and
  967. -.B newline
  968. -that is used to separate command words which result from
  969. -command or parameter substitution
  970. -and for separating words with the 
  971. -.B read
  972. -builtin.
  973. -.TP
  974. -.B HISTSIZE
  975. -If this parameter is set when \fBzsh\fP is invoked, then
  976. -the number of previously entered commands that
  977. -are accessible by this shell
  978. -will be greater than or equal to this number.
  979. -The default is 128.
  980. -.TP
  981. -.B HOME
  982. -The default argument (home directory) for the
  983. -.B cd
  984. -command.
  985. -.TP
  986. -.B MAIL
  987. -If this parameter is set to the name of a mail file
  988. -then \fBzsh\fP informs the user of arrival of mail
  989. -in the specified file.
  990. -.TP
  991. -.B MAILCHECK
  992. -This variable specifies how often (in seconds) \fBzsh\fP
  993. -will check for changes in the modification time
  994. -of any of the files specified by the
  995. -.B MAIL
  996. -parameter.
  997. -The default value is 60 seconds.
  998. -When the time has elapsed
  999. -\fBzsh\fP will check before issuing the next prompt.
  1000. -.TP
  1001. -.B PROMPT
  1002. -The value of this parameter is expanded
  1003. -much like printf(3S),
  1004. -using "%<char>" to signal an expansion.
  1005. -The available sequences are:
  1006. -.RS
  1007. -.PP
  1008. -.TP
  1009. -.B %d \fPor\fB %/
  1010. -The current working directory.
  1011. -.TP
  1012. -.B %\(ap
  1013. -The current working directory; if it starts with $HOME, that part is 
  1014. -replaced by a \(ap.
  1015. -.TP
  1016. -.B %c \fPor\fB %.
  1017. -The trailing component of the current working directory.
  1018. -.TP
  1019. -.B %h \fPor\fB %!
  1020. -The current history event number.
  1021. -.TP
  1022. -.B %M
  1023. -The full machine hostname.
  1024. -.TP
  1025. -.B %m
  1026. -The hostname up to the first ".".
  1027. -.TP
  1028. -.BR %S\  ( %s )
  1029. -Start (stop) standout mode.
  1030. -.TP
  1031. -.BR %B\  ( %b )
  1032. -Start (stop) boldfacing mode.
  1033. -.TP
  1034. -.BR %U\  ( %u )
  1035. -Start (stop) underline mode.
  1036. -.TP
  1037. -.B %t \fPor\fB %@
  1038. -Current time of day, in 12-hour, am/pm format.
  1039. -.TP
  1040. -.B %T
  1041. -Current time of day, in 24-hour format. 
  1042. -.TP
  1043. -.B %n
  1044. -The user name (contents of \fB$USERNAME\fP).
  1045. -.TP
  1046. -.B %w
  1047. -The date in <Mon> dd format.
  1048. -.TP
  1049. -.B %W
  1050. -The date in mm/dd/yy format.
  1051. -.TP
  1052. -.B %D
  1053. -The date in yy-mm-dd format.
  1054. -.TP
  1055. -.B %l
  1056. -The line (tty) the user is logged on.
  1057. -.TP
  1058. -.B %#
  1059. -A `#' if \fBzsh\fP is run as a root shell, a `%' if not.
  1060. -.TP
  1061. -.B %%
  1062. -A single %.
  1063. -.RE
  1064. -.PD
  1065. -.PP
  1066. -.PD 0
  1067. -.B PROMPT2
  1068. -Secondary prompt string,
  1069. -expanded in the
  1070. -same manner as
  1071. -.BR PROMPT .
  1072. -.TP
  1073. -.B PROMPT3
  1074. -Selection prompt string
  1075. -used within a
  1076. -.B select
  1077. -loop, by default
  1078. -.RB `` "#? \|" ''.
  1079. -.TP
  1080. -.B SHELL
  1081. -The pathname of the user's shell.
  1082. -.TP
  1083. -.B WATCH
  1084. -A colon-separated list of users to be checked for login and logout
  1085. -activity.  If set to `all', the login and logout activity
  1086. -of all users will be monitored.
  1087. -.TP
  1088. -.B WATCHFMT
  1089. -The format of the login/logout reports.
  1090. -The following
  1091. -sequences are available for the format specification:
  1092. -.RS
  1093. -.PP
  1094. -.TP
  1095. -.B %n
  1096. -The name of the user that logged in/out.
  1097. -.TP
  1098. -.B %a
  1099. -The observed action, i.e. "logged on" or "logged off".
  1100. -.TP
  1101. -.B %l
  1102. -The line (tty) the user is logged on.
  1103. -.TP
  1104. -.BR %S\  ( %s )
  1105. -Start (stop) standout mode.
  1106. -.TP
  1107. -.BR %B\  ( %b )
  1108. -Start (stop) boldfacing mode.
  1109. -.TP
  1110. -.BR %U\  ( %u )
  1111. -Start (stop) underline mode.
  1112. -.TP
  1113. -.B %M
  1114. -The full hostname of the remote host.
  1115. -.TP
  1116. -.B %m
  1117. -The hostname up to the first ".". If only 
  1118. -the ip address is available or the utmp 
  1119. -field contains the name of an X-windows 
  1120. -display, the whole name is printed.
  1121. -.TP
  1122. -.B %t or %@
  1123. -The time, in 12-hour, am/pm format (logout 
  1124. -time is approximated if unavailable).
  1125. -.TP
  1126. -.B %T
  1127. -The time, in 24-hour format.
  1128. -.TP
  1129. -.B %w
  1130. -The date in <Mon> dd format.
  1131. -.TP
  1132. -.B %W
  1133. -The date in mm/dd/yy format.
  1134. -.TP
  1135. -.B %D
  1136. -The date in yy-mm-dd format.
  1137. -.RE
  1138. -.PD
  1139. -.PP
  1140. -If
  1141. -.B WATCHFMT
  1142. -is not set, the format defaults to
  1143. -"%n has %a %l from %m."
  1144. -.RE
  1145. -.PP
  1146. -\fBzsh\fP gives default values to
  1147. -\fBPATH\fP, \fBPROMPT\fP, \fBPROMPT2\fP, \fBPROMPT3\fP,
  1148. -and \fBIFS\fP,
  1149. -while
  1150. -.B SHELL
  1151. -and
  1152. -.B MAIL
  1153. -are
  1154. -not set at all by \fBzsh\fP (although
  1155. -.B HOME
  1156. -.I is
  1157. -set by
  1158. -.IR login (1)).
  1159. -On some systems
  1160. -.B MAIL
  1161. -and
  1162. -.B SHELL
  1163. -are also
  1164. -set by
  1165. -.IR login (1)).
  1166. -.B \fBzsh\fP
  1167. -expands the value of
  1168. -.B HOME
  1169. -so that it does not contain any symbolic links.
  1170. -.SS Arithmetic Substitution
  1171. -An arithmetic expression of the form
  1172. -.B $[...]
  1173. -is replaced by the value of the arithmetic expression
  1174. -within the brackets.  See
  1175. -.B
  1176. -Arithmetic Evaluation
  1177. -below.
  1178. -.SS Command Substitution
  1179. -The standard output from a command of the form
  1180. -.B $(...)
  1181. -or
  1182. -.B `...`
  1183. -may be used as part or all
  1184. -of a word;
  1185. -trailing newlines are removed.
  1186. -In the second (archaic) form, the string between the quotes is processed
  1187. -for special quoting characters before the command is executed. (See
  1188. -.BR Quoting ).
  1189. -The command substitution
  1190. -\^\fB$(\^cat\ file\^)\fP\^
  1191. -can be replaced by the equivalent but faster
  1192. -\^\fB$(\^<file\^)\fP\^.
  1193. -.SS Brace Expansion
  1194. -A string of the form
  1195. -.B {str,str,...}
  1196. -is expanded to each string in the comma-separated list in the
  1197. -specified order.  This construct may be nested.
  1198. -.PP
  1199. -A five-character string of the form
  1200. -.B {x\-y}
  1201. -is expanded to each character in the range from x to y, inclusive.
  1202. -.SS Filename Substitution
  1203. -After alias substitution is performed, each word
  1204. -is checked to see if it begins with an unquoted
  1205. -.B \(ap 
  1206. -or
  1207. -.BI = .
  1208. -If it begins with a
  1209. -.BI \(ap ,
  1210. -then the word up to a
  1211. -.B /
  1212. -is checked to see if it matches a user name on the system.
  1213. -If a match is found, the
  1214. -.B \(ap
  1215. -and the matched login name is replaced by the
  1216. -login directory of the matched user.
  1217. -A
  1218. -.B \(ap
  1219. -by itself, or in front of a
  1220. -.BR / ,
  1221. -is replaced by \fB$HOME\fP.
  1222. -A
  1223. -.B \(ap
  1224. -followed by a
  1225. -.B +
  1226. -or
  1227. -.B \-
  1228. -is replaced by \fB$PWD\fP and \fB$OLDPWD\fP respectively.
  1229. -.PP
  1230. -If the word begins with a
  1231. -.B =
  1232. -followed by a letter, the word
  1233. -is replaced by the full pathname of the command name
  1234. -following the
  1235. -.BI = .
  1236. -Thus
  1237. -.BI = foo
  1238. -is a shorthand for
  1239. -\^\fB$(\^which\ \fIfoo\fB\^)\fR\^.
  1240. -If the word is of the form
  1241. -.B =number
  1242. -or
  1243. -.BR =number/... ,
  1244. -then the first part of the word is replaced
  1245. -by the appopriate element of the directory stack,
  1246. -corresponding to the specified number.
  1247. -The stack is viewed as zero-based, i.e.,
  1248. -.B =0
  1249. -is the same as
  1250. -.BR $PWD .
  1251. -As a special
  1252. -case,
  1253. -.B =\-
  1254. -is recognized as indicating the last directory in the stack.
  1255. -.PP
  1256. -All of the above forms of filename substitution
  1257. -may be followed by any of the modifiers allowed in the
  1258. -history mechanism except \fBq\fP and \fBx\fP.
  1259. -.SS Filename Generation
  1260. -Following substitution, each command
  1261. -.I word
  1262. -is scanned for
  1263. -the characters
  1264. -.BR \(** ,
  1265. -.BR ? ,
  1266. -.BR [ ,
  1267. -.BR ^ ,
  1268. -.BR # ,
  1269. -.BR < ,
  1270. -and
  1271. -.BR | .
  1272. -If one of these characters appears
  1273. -then the word is regarded as a
  1274. -.IR pattern .
  1275. -The word is replaced with alphabetically sorted filenames that match the pattern.
  1276. -If no filename is found that matches the pattern, then
  1277. -the word is left unchanged.
  1278. -When a
  1279. -.I pattern
  1280. -is used for filename generation,
  1281. -the character
  1282. -.B .
  1283. -at the start of a filename
  1284. -or immediately following a
  1285. -.BR /
  1286. -must be matched explicitly, unless the 
  1287. -.B globdots
  1288. -option is set.
  1289. -Also, the
  1290. -.B /
  1291. -character itself must be matched explicitly.
  1292. -In filename generation, no pattern matches "." or "..".
  1293. -In other instances of pattern matching the
  1294. -.B /
  1295. -and
  1296. -.B .
  1297. -are not treated specially.
  1298. -.PP
  1299. -.PD 0
  1300. -.RS
  1301. -.TP
  1302. -.B \(**
  1303. -Matches any string, including the null string.
  1304. -.TP
  1305. -.B ?
  1306. -Matches any single character.
  1307. -.TP
  1308. -.BR [ \^.\|.\|.\^ ]
  1309. -Matches any one of the enclosed characters.
  1310. -A pair of characters separated by
  1311. -.B \-
  1312. -matches any
  1313. -character lexically between the pair, inclusive.
  1314. -If the first character following the opening "["
  1315. -is a "^" then any character not enclosed is matched.
  1316. -A
  1317. -.B \-
  1318. -can be included in the character set by putting it as the
  1319. -first or last character.
  1320. -.TP
  1321. -.B <...>
  1322. -Matches a numeric field.  A pattern of the form
  1323. -.BR <x\-y> ,
  1324. -where x and y are decimal integers, matches any number between
  1325. -x and y inclusive.  Patterns of the form
  1326. -.B <x\->
  1327. -and
  1328. -.B <\-y>
  1329. -match any number greater than or equal to x, and less than or
  1330. -equal to y, respectively.  The degenerate
  1331. -.B <\->
  1332. -or simply
  1333. -.B <>
  1334. -matches any number.  Note that a
  1335. -.B <...>
  1336. -pattern eats up
  1337. -any numbers it encounters; thus
  1338. -.B foo<1\-5>7
  1339. -does not match
  1340. -"foo27", even though 2 is between 1 and 5.
  1341. -.TP
  1342. -.B x#
  1343. -Matches zero or more occurrences of the pattern x.
  1344. -.TP
  1345. -.B x##
  1346. -Matches one or more occurrences of the pattern x.
  1347. -.TP
  1348. -.B ^pattern
  1349. -Matches anything but the specified pattern.
  1350. -.TP
  1351. -.B foo|bar
  1352. -Matches either foo or bar.
  1353. -.PD
  1354. -.RE
  1355. -.PP
  1356. -Parentheses may be used for grouping.  Note that the \fB|\fP character
  1357. -must be within parentheses, so that the lexical analyzer does
  1358. -not think it is a pipe character.  Also note that "/" has a
  1359. -higher precedence than "^"; that is:
  1360. -.RS
  1361. -.PP
  1362. -ls
  1363. -.BI ^ foo / bar
  1364. -.RE
  1365. -.PP
  1366. -will search directories in "." except "./foo" for a file named bar.
  1367. -.PP
  1368. -A pathname component of the form
  1369. -.BI ( foo /)#
  1370. -matches a path consisting of zero or more directories
  1371. -matching the pattern foo.
  1372. -As a shorthand,
  1373. -.B ..../
  1374. -is equivalent to
  1375. -.BR (*/)# .
  1376. -Thus:
  1377. -.RS
  1378. -.PP
  1379. -ls
  1380. -.BI (*/)# bar
  1381. -.RE
  1382. -.PP
  1383. -or
  1384. -.RS
  1385. -.PP
  1386. -ls
  1387. -.BI ..../ bar
  1388. -.RE
  1389. -.PP
  1390. -does a recursive directory search for files named bar.
  1391. -.PP
  1392. -If used for filename generation, a pattern may end in a qualifier
  1393. -of the form \fB(X)\fP or \fB(^X)\fP, where \fBX\fP is a character that
  1394. -specifies which filenames that otherwise match the given pattern
  1395. -will be inserted in the argument list.  \fBX\fP may be any one of the
  1396. -following:
  1397. -.PD 0
  1398. -.RS
  1399. -.TP
  1400. -.B /
  1401. -directories
  1402. -.TP
  1403. -.B .
  1404. -plain files
  1405. -.TP
  1406. -.B @
  1407. -symbolic links
  1408. -.TP
  1409. -.B =
  1410. -sockets
  1411. -.TP
  1412. -.B <
  1413. -named pipes (FIFOs)
  1414. -.TP
  1415. -.B *
  1416. -executable files (0100)
  1417. -.TP
  1418. -.B %
  1419. -device files (character or block special)
  1420. -.TP
  1421. -.B r
  1422. -readable files (0400)
  1423. -.TP
  1424. -.B w
  1425. -writeable files (0200)
  1426. -.TP
  1427. -.B x
  1428. -executable files (0100, same as *)
  1429. -.TP
  1430. -.B R
  1431. -world-readable files (0004)
  1432. -.TP
  1433. -.B W
  1434. -world-writeable files (0002)
  1435. -.TP
  1436. -.B X
  1437. -world-executable files (0001)
  1438. -.PD
  1439. -.RE
  1440. -.PP
  1441. -Thus:
  1442. -.RS
  1443. -.PP
  1444. -ls
  1445. -.B
  1446. -*(%)
  1447. -.RE
  1448. -.PP
  1449. -lists all device files in the current directory,
  1450. -and
  1451. -.RS
  1452. -.PP
  1453. -ls
  1454. -.B /tmp/foo*(^@)
  1455. -.RE
  1456. -.PP
  1457. -lists all files beginning with the string
  1458. -"foo" in /tmp, ignoring symlinks.  A "/" at the end of a pattern
  1459. -is equivalent to "(/)".
  1460. -.SS Quoting
  1461. -Each of the
  1462. -.I metacharacters
  1463. -listed above (See
  1464. -.I Definitions
  1465. -above)
  1466. -has a special meaning to \fBzsh\fP
  1467. -and causes termination of a word unless quoted.
  1468. -A character may be
  1469. -.I quoted
  1470. -(that is, made to stand for itself)
  1471. -by preceding
  1472. -it with a
  1473. -.BR \e .
  1474. -The pair
  1475. -.B \enewline
  1476. -is ignored.
  1477. -All characters enclosed between a pair of single quote marks (\^\fB\(fm\^\(fm\fP\^),
  1478. -are quoted.
  1479. -A single quote cannot appear within single quotes.
  1480. -Inside double quote marks
  1481. -(\fB"\^"\fP),
  1482. -parameter and command substitution occurs and
  1483. -.B \e
  1484. -quotes the characters
  1485. -.BR \e ,
  1486. -.BR \f(CW`\fP ,
  1487. -\fB"\fP,
  1488. -and
  1489. -.BR $ .
  1490. -Inside grave quote marks
  1491. -.Pn ( `` )
  1492. -.B \e
  1493. -quotes the characters
  1494. -.BR \e ,
  1495. -` ,
  1496. -and
  1497. -.PP $ .
  1498. -If the grave quotes occur within double quotes then
  1499. -.BR \e
  1500. -also quotes the character
  1501. -\fB"\fP.
  1502. -.PP
  1503. -The special meaning of reserved words or aliases can be removed by quoting any
  1504. -character of the reserved word.
  1505. -The recognition of function names or builtin names listed below
  1506. -cannot be altered by quoting them.
  1507. -.SS Arithmetic Evaluation
  1508. -An ability to perform integer arithmetic
  1509. -is provided with the builtin
  1510. -.BR let .
  1511. -Evaluations are performed using
  1512. -.I long
  1513. -arithmetic.
  1514. -Constants are of the form
  1515. -[\fIbase\fB#\^\fR]\fIn\^\fP
  1516. -where
  1517. -.I base
  1518. -is a decimal number between two and thirty-six
  1519. -representing the arithmetic base
  1520. -and
  1521. -.I n
  1522. -is a number in that base.
  1523. -If
  1524. -.I base
  1525. -is omitted
  1526. -then base 10 is used.
  1527. -.PP
  1528. -An arithmetic expression uses nearly the same syntax, precedence, and
  1529. -associativity of
  1530. -expressions in C.
  1531. -The following operators are supported (listed in decreasing order
  1532. -of precedence):
  1533. -.PP
  1534. -.PD 0
  1535. -.RS
  1536. -.TP
  1537. -.B + \- ! \(ap ++ \-\-
  1538. -unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement
  1539. -.TP
  1540. -.B &
  1541. -logical AND
  1542. -.TP
  1543. -.B ^
  1544. -logical XOR
  1545. -.TP
  1546. -.B |
  1547. -logical OR
  1548. -.TP
  1549. -.B * / %
  1550. -multiplication, division, remainder
  1551. -.TP
  1552. -.B + \-
  1553. -addition, subtraction
  1554. -.TP
  1555. -.B << >>
  1556. -logical shift left, shift right
  1557. -.TP
  1558. -.B < > <= >=
  1559. -comparison
  1560. -.TP
  1561. -.B == !=
  1562. -equality and inequality
  1563. -.TP
  1564. -.B &&
  1565. -boolean AND
  1566. -.TP
  1567. -.B || ^^
  1568. -boolean OR, XOR
  1569. -.TP
  1570. -.B ? :
  1571. -ternary operator
  1572. -.TP
  1573. -.B
  1574. -= += \-= *= /= %= &= ^= |= <<= >>= &&= ||= ^^=
  1575. -assignment
  1576. -.TP
  1577. -.B ,
  1578. -comma operator
  1579. -.PD
  1580. -.RE
  1581. -.PP
  1582. -The operators &&, ||, &&=, and ||= are short-circuiting,
  1583. -and only one of the latter two expressions in a ternary operator
  1584. -is evaluated.  Note the precedence of the logical AND, OR,
  1585. -and XOR operators.
  1586. -.PP
  1587. -Named parameters can be referenced by name within an arithmetic expression
  1588. -without using the parameter substitution syntax.
  1589. -.PP
  1590. -An internal integer representation of a named parameter
  1591. -can be specified with the
  1592. -.B integer
  1593. -builtin.
  1594. -Arithmetic evaluation is performed on the value of each
  1595. -assignment to a named parameter declared integer
  1596. -in this manner.
  1597. -.PP
  1598. -Since many of the arithmetic operators require
  1599. -quoting, an alternative form of the
  1600. -.B let
  1601. -command is provided.
  1602. -For any command which begins with a
  1603. -.BR (( ,
  1604. -all the characters until a matching
  1605. -.B ))
  1606. -are treated as a quoted expression.
  1607. -More precisely,
  1608. -.BR (( .\|.\|. ))
  1609. -is equivalent to
  1610. -.B let
  1611. -\fB"\fP\|.\|.\|.\fB"\fP.
  1612. -.SS Prompting
  1613. -When used interactively,
  1614. -\fBzsh\fP prompts with the value of
  1615. -.B PROMPT
  1616. -before reading a command.
  1617. -If at any time a newline is typed and further input is needed
  1618. -to complete a command, then the secondary prompt
  1619. -(that is, the value of
  1620. -.BR PROMPT2 )
  1621. -is issued.
  1622. -.SS Input/Output
  1623. -Before a command is executed, its input and output
  1624. -may be redirected using a special notation interpreted by \fBzsh\fP.
  1625. -The following may appear anywhere in a simple-command
  1626. -or may precede or follow a
  1627. -.I command
  1628. -and are
  1629. -.I not
  1630. -passed on to the invoked command.
  1631. -Substitution occurs before
  1632. -.I word
  1633. -is used except as noted below.
  1634. -If the result of substitution on
  1635. -.I word
  1636. -produces more than one filename,
  1637. -redirection occurs for each
  1638. -separate filename in turn.
  1639. -.TP 14
  1640. -.BI < word
  1641. -Use file
  1642. -.I word
  1643. -as standard input (file descriptor 0).
  1644. -.TP
  1645. -.BI > word
  1646. -Use file
  1647. -.I word
  1648. -as standard output (file descriptor 1).
  1649. -If the file does not exist then it is created.
  1650. -If the file exists, and the
  1651. -.B clobber
  1652. -option is not set,
  1653. -this causes an error;
  1654. -otherwise, it is truncated to zero length.
  1655. -.TP
  1656. -.BI >! " word"
  1657. -Same as
  1658. -.BR > ,
  1659. -except that the file is truncated to zero length
  1660. -if it exists, even if
  1661. -.B clobber
  1662. -is not set.
  1663. -.TP
  1664. -.BI >> word
  1665. -Use file
  1666. -.I word
  1667. -as standard output.
  1668. -If the file exists then output is appended to it.
  1669. -If the file does not exist, and the
  1670. -.B clobber
  1671. -option is not set,
  1672. -this causes an error;
  1673. -otherwise, the file is created.
  1674. -.TP
  1675. -.BI >>! " word"
  1676. -Same as
  1677. -.BR >> ,
  1678. -except that the file is created if it does not
  1679. -exist, even if
  1680. -.B clobber
  1681. -is not set.
  1682. -.TP
  1683. -.BI << word
  1684. -The shell input is read up to a line that is the same as
  1685. -.IR word ,
  1686. -or to an end-of-file.
  1687. -No parameter substitution, command substitution or
  1688. -filename generation is performed on
  1689. -.IR word .
  1690. -The resulting document,
  1691. -called a
  1692. -.IR here-document ,
  1693. -becomes
  1694. -the standard input.
  1695. -No interpretation
  1696. -is placed upon the characters of the document.
  1697. -.TP
  1698. -.BI <& digit
  1699. -The standard input is duplicated from file descriptor
  1700. -.I digit
  1701. -(see
  1702. -.IR dup (2)).
  1703. -Similarly for the standard output using
  1704. -.BR >&
  1705. -.IR digit .
  1706. -.TP
  1707. -.BI >& word
  1708. -Same as
  1709. -.BI > word
  1710. -.B 2>&1 .
  1711. -.TP
  1712. -.BI >>& word
  1713. -Same as
  1714. -.BI >> word
  1715. -.B 2>&1 .
  1716. -.TP
  1717. -.B <&\-
  1718. -The standard input is closed.
  1719. -Similarly for the standard output using
  1720. -.BR >&\- .
  1721. -.TP
  1722. -.BI <&! " digit"
  1723. -Same as
  1724. -.B <&\-
  1725. -.BI <& digit .
  1726. -.TP
  1727. -.BI >&! " digit"
  1728. -Same as
  1729. -.B >&\-
  1730. -.BI >& digit .
  1731. -.TP
  1732. -.B <&p
  1733. -The input from the coprocess is moved to standard input.
  1734. -.TP
  1735. -.B >&p
  1736. -The output to the coprocess is moved to standard output.
  1737. -.PP
  1738. -If one of the above is preceded by a digit,
  1739. -then the
  1740. -file descriptor number referred to is that specified
  1741. -by the digit
  1742. -(instead of the default 0 or 1).
  1743. -For example:
  1744. -.RS
  1745. -.PP
  1746. -\&.\|.\|. \|2>&1
  1747. -.RE
  1748. -.PP
  1749. -means file descriptor 2 is to be opened
  1750. -for writing as a duplicate
  1751. -of file descriptor 1.
  1752. -.PP
  1753. -The order in which redirections are specified is significant.
  1754. -\fBzsh\fP evaluates each redirection in terms of the
  1755. -.RI ( "file descriptor" ", " file )
  1756. -association at the time of evaluation.
  1757. -For example:
  1758. -.RS
  1759. -.PP
  1760. -\&.\|.\|. \|1>\fIfname\^\fP 2>&1
  1761. -.RE
  1762. -.PP
  1763. -first associates file descriptor 1 with file
  1764. -.IR fname .
  1765. -It then associates file descriptor 2 with the file associated with file
  1766. -descriptor 1 (that is,
  1767. -.IR fname ).
  1768. -If the order of redirections were reversed, file descriptor 2 would be associated
  1769. -with the terminal (assuming file descriptor 1 had been) and then file descriptor
  1770. -1 would be associated with file
  1771. -.IR fname .
  1772. -.PP
  1773. -If the user tries to open a file descriptor for writing more than once,
  1774. -\fBzsh\fP opens the file descriptor as a pipe to a process that copies
  1775. -its input to all the specified outputs, similar to tee(1).  Thus:
  1776. -.RS
  1777. -.PP
  1778. -.B date >foo >bar
  1779. -.RE
  1780. -.PP
  1781. -writes the date to two files, named "foo" and "bar".
  1782. -Note that a pipe is an implicit indirection; thus
  1783. -.RS
  1784. -.PP
  1785. -.B date >foo | cat
  1786. -.RE
  1787. -.PP
  1788. -writes the date to the file "foo", and also pipes it to cat.
  1789. -.PP
  1790. -If the user tries to open a file descritor for reading more than once,
  1791. -\fBzsh\fP opens the file descriptor as a pipe to a process that copies
  1792. -all the specified inputs to its output in the order
  1793. -specified, similar to cat(1).  Thus
  1794. -.RS
  1795. -.PP
  1796. -.B sort <foo <fubar
  1797. -.RE
  1798. -.PP
  1799. -or even
  1800. -.RS
  1801. -.PP
  1802. -.B sort <f{oo,ubar}
  1803. -.RE
  1804. -.PP
  1805. -is equivalent to "cat foo bar | sort".  Note that
  1806. -a pipe is in implicit indirection; thus
  1807. -.RS
  1808. -.PP
  1809. -.B cat bar | sort <foo
  1810. -.RE
  1811. -.PP
  1812. -is equivalent to "cat bar foo | sort" (note the order of the inputs).
  1813. -.PP
  1814. -If a simple command consists of one or more redirection operators
  1815. -and zero or more parameter assignments, but no command name,
  1816. -the command \fBcat\fP is assumed.  Thus
  1817. -.RS
  1818. -.PP
  1819. -.B < file
  1820. -.RE
  1821. -.PP
  1822. -prints the contents of \fBfile\fP.
  1823. -.PP
  1824. -If a command is followed by
  1825. -.B &
  1826. -and job control is not active,
  1827. -then the default standard input
  1828. -for the command
  1829. -is the empty file
  1830. -.BR /dev/null .
  1831. -Otherwise, the environment for the execution of a command contains the
  1832. -file descriptors of the invoking shell as modified by
  1833. -input/output specifications.
  1834. -.SS Environment
  1835. -The
  1836. -.I environment
  1837. -(see
  1838. -.IR environ (7))
  1839. -is a list of name-value pairs that is passed to
  1840. -an executed program in the same way as a normal argument list.
  1841. -The names must be
  1842. -.I identifiers
  1843. -and the values are character strings.
  1844. -\fBzsh\fP interacts with the environment in several ways.
  1845. -On invocation, \fBzsh\fP scans the environment
  1846. -and creates a
  1847. -parameter
  1848. -for each name found,
  1849. -giving it the corresponding value and marking it exported.
  1850. -Executed commands inherit the environment.
  1851. -If the user modifies the values of these
  1852. -parameters
  1853. -or creates new ones,
  1854. -using the
  1855. -.B export
  1856. -command they become part of the
  1857. -environment.
  1858. -The environment seen by any executed command is thus composed
  1859. -of any name-value pairs originally inherited by \fBzsh\fP,
  1860. -whose values may be modified by the current shell,
  1861. -plus any additions
  1862. -which must be noted in
  1863. -.B export
  1864. -commands.
  1865. -.PP
  1866. -The environment for any
  1867. -.I simple-command
  1868. -or function
  1869. -may be augmented by prefixing it with one or more parameter assignments.
  1870. -A parameter assignment argument is a word of the form
  1871. -.IR identifier=value .
  1872. -Thus:
  1873. -.RS
  1874. -.PP
  1875. -TERM=450 \|cmd \|args                and
  1876. -.br
  1877. -(export \|TERM; \|TERM=450; \|cmd \|args)
  1878. -.RE
  1879. -.PP
  1880. -are equivalent (as far as the above execution of
  1881. -.I cmd
  1882. -is concerned).
  1883. -.PP
  1884. -If the
  1885. -.B keyword
  1886. -flag is set,
  1887. -.I all
  1888. -parameter assignment arguments are placed in the environment,
  1889. -even if they occur after the command name.
  1890. -.SS Function
  1891. -.PP
  1892. -The
  1893. -.B function
  1894. -reserved word, described in the
  1895. -.I Commands
  1896. -section above,
  1897. -is used to define shell functions.
  1898. -Shell functions are read in and stored internally.
  1899. -Alias names are resolved when the function is read.
  1900. -Functions are executed like commands with the arguments
  1901. -passed as positional parameters.
  1902. -(See
  1903. -.I Execution
  1904. -below).
  1905. -.PP
  1906. -Functions execute in the same process as the caller and
  1907. -share all files
  1908. -and present working directory with the
  1909. -caller.
  1910. -A trap on
  1911. -.B EXIT
  1912. -set inside a function
  1913. -is executed after the function completes in the environment
  1914. -of the caller.
  1915. -.PP
  1916. -The builtin
  1917. -.B return
  1918. -is used to return
  1919. -from function calls.
  1920. -Errors within functions return control to the caller.
  1921. -.PP
  1922. -Function identifiers
  1923. -can be listed with the
  1924. -.B function
  1925. -builtin.
  1926. -Functions can be undefined with the
  1927. -.B unfunction
  1928. -builtin.
  1929. -.PP
  1930. -The following functions, if defined, have special meaning to \fBzsh\fP:
  1931. -.PP
  1932. -.PD 0
  1933. -.RS
  1934. -.TP
  1935. -\fBchpwd\fP
  1936. -Executed whenever the current working directory is changed.
  1937. -.TP
  1938. -\fBprecmd\fP
  1939. -Executed before each prompt.
  1940. -.TP
  1941. -\fBperiodic\fP
  1942. -If the parameter
  1943. -.B PERIOD
  1944. -is set, this function is executed every
  1945. -.B PERIOD
  1946. -minutes, just before a prompt.
  1947. -.TP
  1948. -\fBTRAPxxx\fP
  1949. -If defined and non-null,
  1950. -this function will be executed whenever \fBzsh\fP 
  1951. -catches a signal \fBSIGxxx\fP, where \fBxxx\fP is a signal
  1952. -name as specified for the \fBkill\fP builtin (see below).
  1953. -In addition, \fBTRAPERR\fP is executed whenever a command has a non-zero
  1954. -exit status, \fBTRAPDEBUG\fP is executed after each command, and
  1955. -\fBTRAPEXIT\fP
  1956. -is executed when \fBzsh\fP exits,
  1957. -or when the current function exits if defined
  1958. -inside a function.
  1959. -If a function of this form is defined and null,
  1960. -\fBzsh\fP and processes spawned by it will ignore \fBSIGxxx\fP.
  1961. -.PD
  1962. -.RE
  1963. -.SS Jobs
  1964. -.PP
  1965. -If the
  1966. -.B monitor
  1967. -option of the
  1968. -.B set
  1969. -command is turned on,
  1970. -an interactive shell associates a \fIjob\fR with each pipeline.
  1971. -It keeps
  1972. -a table of current jobs, printed by the
  1973. -.B jobs
  1974. -command, and assigns them small integer numbers.
  1975. -When a job is started asynchronously with
  1976. -.BR & ,
  1977. -\fBzsh\fP prints a line which looks
  1978. -like:
  1979. -.PP
  1980. -.DT
  1981. -    [1] 1234
  1982. -.PP
  1983. -indicating that the job which was started asynchronously was job number
  1984. -1 and had one (top-level) process, whose process id was 1234.
  1985. -.PP
  1986. -If you are running a job and wish to do something else you may hit the key
  1987. -\fB^Z\fR (control-Z) which sends a STOP signal to the current job.
  1988. -\fBzsh\fP will then normally indicate that the job has been `suspended',
  1989. -and print another prompt.
  1990. -You can then manipulate the state of this job,
  1991. -putting it in the background with the
  1992. -.B bg
  1993. -command, or run some other
  1994. -commands and then eventually bring the job back into the foreground with
  1995. -the foreground command
  1996. -.BR fg .
  1997. -A \fB^Z\fR takes effect immediately and
  1998. -is like an interrupt in that pending output and unread input are discarded
  1999. -when it is typed.
  2000. -.PP
  2001. -A job being run in the background will suspend if it tries to read
  2002. -from the terminal.
  2003. -Background jobs are normally allowed to produce output,
  2004. -but this can be disabled by giving the command ``stty tostop''.
  2005. -If you set this
  2006. -tty option, then background jobs will suspend when they try to produce
  2007. -output like they do when they try to read input.
  2008. -.PP
  2009. -There are several ways to refer to jobs in \fBzsh\fP.
  2010. -A job can be referred to by the process id of any process of the job
  2011. -or by one of the following:
  2012. -.PD 0
  2013. -.TP
  2014. -.BI % number
  2015. -The job with the given number.
  2016. -.TP
  2017. -.BI % string
  2018. -Any job whose command line begins with
  2019. -.IR string .
  2020. -.TP
  2021. -.BI %? string
  2022. -Any job whose command line contains
  2023. -.IR string .
  2024. -.TP
  2025. -.BI %%
  2026. -Current job.
  2027. -.TP
  2028. -.BI %+
  2029. -Equivalent to
  2030. -.BR %% .
  2031. -.TP
  2032. -.BI %\-
  2033. -Previous job.
  2034. -.PD
  2035. -.PP
  2036. -\fBzsh\fP learns immediately whenever a process changes state.
  2037. -It normally informs you whenever a job becomes blocked so that
  2038. -no further progress is possible.  If
  2039. -.B notify
  2040. -is not set, it waits until
  2041. -just before it prints
  2042. -a prompt before it informs you.
  2043. -.PP
  2044. -When the monitor mode is on, each background job that completes
  2045. -triggers any trap set for
  2046. -.BR CHLD .
  2047. -.PP
  2048. -When you try to leave \fBzsh\fP while jobs are running or suspended, you will
  2049. -be warned that `You have suspended (running) jobs.'
  2050. -You may use the
  2051. -.B jobs
  2052. -command to see what they are.
  2053. -If you do this or immediately try to
  2054. -exit again, \fBzsh\fP will not warn you a second time; the suspended
  2055. -jobs will be terminated, and the running jobs will be sent
  2056. -a \fBSIGHUP\fP signal.
  2057. -To avoid having \fBzsh\fP terminate the running jobs, either
  2058. -use the \fBnohup\fP(1) command or the \fBdisown\fP builtin (see below).
  2059. -.SS Signals
  2060. -The INT and QUIT signals for an invoked
  2061. -command are ignored if the command is followed by
  2062. -.B &
  2063. -and job
  2064. -.B monitor
  2065. -option is not active.
  2066. -Otherwise, signals have the values
  2067. -inherited by \fBzsh\fP from its parent
  2068. -(but see the \fBTRAPxxx\fP special function above).
  2069. -.SS Execution
  2070. -Each time a command is executed, the above substitutions
  2071. -are carried out.
  2072. -If the command name matches one
  2073. -of the
  2074. -.I builtins
  2075. -listed below,
  2076. -it is executed within the
  2077. -current shell process.
  2078. -Next, the command name is checked to see if
  2079. -it matches one of the user defined functions.
  2080. -If it does,
  2081. -the positional parameters are saved
  2082. -and then reset to the arguments of the
  2083. -.I function
  2084. -call.
  2085. -When the
  2086. -.I function
  2087. -completes or issues a
  2088. -.BR return ,
  2089. -the positional parameter list is restored
  2090. -and any trap set on
  2091. -.B EXIT
  2092. -within the function is executed.
  2093. -The value of a
  2094. -.I function
  2095. -is the value of the last command executed.
  2096. -A function is also executed in the
  2097. -current shell process.
  2098. -If a command name is not a
  2099. -.I builtin
  2100. -or a user defined
  2101. -.IR function ,
  2102. -a process is created and
  2103. -an attempt is made to execute the command via
  2104. -.IR exec (2).
  2105. -.PP
  2106. -The shell parameter
  2107. -.B PATH
  2108. -defines the search path for
  2109. -the directory containing the command.
  2110. -Alternative directory names are separated by
  2111. -a colon.
  2112. -The default path is
  2113. -.B /bin:/usr/bin:
  2114. -(specifying
  2115. -.BR /bin ,
  2116. -.BR /usr/bin ,
  2117. -and the current directory
  2118. -in that order).
  2119. -The current directory can be specified by
  2120. -two or more adjacent colons, or by a colon
  2121. -at the beginning or end of the path list.
  2122. -If the command name contains a \fB/\fP then the search path
  2123. -is not used.
  2124. -Otherwise, each directory in the path is
  2125. -searched for an executable file.
  2126. -.PP
  2127. -Whenever \fBzsh\fP executes an external command, it gives
  2128. -control of the tty to the command.  If the command
  2129. -completes with a zero return code, \fBzsh\fP does not reset
  2130. -the tty; otherwise, the tty modes are reset to what they were
  2131. -before the command was executed.  If a process is suspended,
  2132. -\fBzsh\fP saves the state of the tty and resets the tty modes;
  2133. -if the process is later restarted, the tty modes are restored
  2134. -to what they were when the process was suspended.
  2135. -.SS Command Re-entry.
  2136. -The text of the last
  2137. -.B HISTSIZE
  2138. -(default 128)
  2139. -commands entered from a terminal device
  2140. -is saved in memory.
  2141. -The builtin
  2142. -.B fc
  2143. -is used to list or
  2144. -edit a portion of this file.
  2145. -The portion of the file to be edited or listed can be selected by
  2146. -number or by giving the first character or
  2147. -characters of the command.
  2148. -A single command or range of commands can be specified.
  2149. -If you do not specify an editor program as
  2150. -an argument to
  2151. -.B fc
  2152. -then the value of the parameter
  2153. -.B FCEDIT
  2154. -is used.
  2155. -If
  2156. -.B FCEDIT
  2157. -is not defined then
  2158. -.B /usr/ucb/vi
  2159. -is used.
  2160. -The edited command(s) is printed and re-executed upon
  2161. -leaving the editor.
  2162. -The editor name
  2163. -.B \-
  2164. -is used to skip the editing phase and
  2165. -to re-execute the command.
  2166. -In this case a substitution parameter of the form
  2167. -\fIold\fP\fB=\fP\fInew\fP
  2168. -can be used to modify the command before execution.
  2169. -For example, if
  2170. -.B r
  2171. -is aliased to
  2172. -.B \(fmfc \-e \-\(fm
  2173. -then typing
  2174. -`\fBr bad=good c\fP'
  2175. -will re-execute the most recent command which starts with the letter
  2176. -.BR c ,
  2177. -replacing the first occurrence of the string
  2178. -.B bad
  2179. -with the string
  2180. -.BR good .
  2181. -.SS Readline
  2182. -This is the library that handles reading input when using an interactive
  2183. -shell.
  2184. -By default, the line editing commands
  2185. -are similar to those of Emacs.
  2186. -A vi-style line editing interface is also available.
  2187. -.PP
  2188. -In this section, the Emacs\-style notation is used to denote
  2189. -keystrokes.  Control keys are denoted by C\-\fIkey\fR, e.g. C\-n
  2190. -means Control\-N.  Similarly, 
  2191. -.I meta
  2192. -keys are denoted by M\-\fIkey\fR, so M\-x means Meta\-X.  (On keyboards
  2193. -without a 
  2194. -.I meta
  2195. -key, M\-\fIx\fP means ESC \fIx\fP, i.e. press the Escape key
  2196. -then the
  2197. -.I x
  2198. -key.
  2199. -The combination M\-C\-\fIx\fP means ESC\-Control\-\fIx\fP,
  2200. -or press the Escape key
  2201. -then hold the Control key while pressing the
  2202. -.I x
  2203. -key.)
  2204. -.PP
  2205. -You may change the default key\-bindings with an
  2206. -.B \(ap/.inputrc 
  2207. -file.  Other 
  2208. -programs that use this library may add their own commands and bindings.
  2209. -.PP
  2210. -For example, if you wanted to make M\-C\-u execute the command
  2211. -.IR universal\-argument ,
  2212. -then 
  2213. -in your
  2214. -.B \(ap/.inputrc
  2215. -file you would put:
  2216. -.RS
  2217. -.PP
  2218. -M\-Control\-u: universal\-argument
  2219. -.RE
  2220. -or
  2221. -.RS
  2222. -C\-Meta\-u: universal\-argument
  2223. -.RE
  2224. -.PP
  2225. -You can use the following names for characters: RUBOUT, DEL, ESC,
  2226. -NEWLINE, SPACE, RETURN, LFD, TAB.
  2227. -.PP
  2228. -You can start with a vi-like editing mode by placing
  2229. -.RS
  2230. -.PP
  2231. -set editing-mode vi
  2232. -.RE
  2233. -.PP
  2234. -in your 
  2235. -.B \(ap/.inputrc
  2236. -file.
  2237. -.PP
  2238. -You can have readline use a single line for display, scrolling the input
  2239. -between the two borders by placing
  2240. -.RS
  2241. -.PP
  2242. -set horizontal\-scroll\-mode On
  2243. -.RE
  2244. -.PP
  2245. -in your 
  2246. -.B \(ap/.inputrc
  2247. -file.
  2248. -.PP
  2249. -The following is a list of the names of the commands and the default
  2250. -key-strokes to get them.
  2251. -.SS Commands for Moving
  2252. -.PP
  2253. -.PD 0
  2254. -.TP
  2255. -.B beginning\-of\-line (C\-a)
  2256. -Move to the start of the current line.
  2257. -.TP
  2258. -.B end\-of\-line (C\-e)
  2259. -Move to the end of the line.
  2260. -.TP
  2261. -.B forward\-char (C\-f)
  2262. -Move forward a character.
  2263. -.TP
  2264. -.B backward\-char (C\-b)
  2265. -Move back a character.
  2266. -.TP
  2267. -.B forward\-word (M\-f)
  2268. -Move forward to the end of the next word.
  2269. -.TP
  2270. -.B backward\-word (M\-b)
  2271. -Move back to the start of this, or the previous, word.
  2272. -.TP
  2273. -.B clear\-screen (C\-l)
  2274. -Clear the screen leaving the current line at the top of the screen.
  2275. -.PD
  2276. -.SS Commands for Manipulating the History
  2277. -.PP
  2278. -.PD 0
  2279. -.TP
  2280. -.B accept\-line (Newline, Return)
  2281. -Accept the line regardless of where the cursor is.
  2282. -.TP
  2283. -.B previous\-history (C\-p)
  2284. -Fetch the previous command from the history list, moving back in
  2285. -the list.
  2286. -.TP
  2287. -.B next\-history (C\-n)
  2288. -Fetch the next command from the history list, moving forward in the
  2289. -list.
  2290. -.TP
  2291. -.B beginning\-of\-history (M\-<)
  2292. -Move to the first line in the history, the first line entered.
  2293. -.TP
  2294. -.B end\-of\-history (M\->)
  2295. -Move to the end of the input history, i.e., the line you are entering.
  2296. -.PD
  2297. -.SS Commands for Changing Text
  2298. -.PP
  2299. -.PD 0
  2300. -.TP
  2301. -.B delete\-char (C\-d)
  2302. -Delete the character under the cursor.  If the cursor is at the
  2303. -beginning of the line, and there are no characters in the line, and
  2304. -the last character typed was not C\-d, then return EOF.
  2305. -.TP
  2306. -.B backward\-delete\-char (Rubout)
  2307. -Delete the character behind the cursor.  A numeric arg says to kill
  2308. -the characters instead of deleting them.
  2309. -.TP
  2310. -.B quoted\-insert (C\-q, C\-v)
  2311. -Add the next character that you type to the line verbatim.  This is
  2312. -how to insert characters like C\-q, for example.
  2313. -.TP
  2314. -.B self\-insert (a,\ b,\ A,\ 1,\ !,\ ...)
  2315. -Insert the character typed.
  2316. -.TP
  2317. -.B transpose\-chars (C\-t)
  2318. -Drag the character before point forward over the character at point.
  2319. -Point moves forward as well.  If point is at the end of the line, then
  2320. -transpose the two characters before point.  Negative arguments don't work.
  2321. -.TP
  2322. -.B transpose\-words (M\-t)
  2323. -Drag the word behind the cursor past the word in front of the cursor
  2324. -moving the cursor over that word as well.
  2325. -.TP
  2326. -.B upcase\-word (M\-u)
  2327. -Uppercase the current (or following) word.  With a negative argument,
  2328. -do the previous word, but do not move point.
  2329. -.TP
  2330. -.B downcase\-word (M\-l)
  2331. -Lowercase the current (or following) word.  With a negative argument,
  2332. -do the previous word, but do not move point.
  2333. -.TP
  2334. -.B capitalize\-word (M\-c)
  2335. -Capitalize the current (or following) word.  With a negative argument,
  2336. -do the previous word, but do not move point.
  2337. -.PD
  2338. -.SS Killing and Yanking
  2339. -.PP
  2340. -.PD 0
  2341. -.TP
  2342. -.B kill\-line (C\-k)
  2343. -Kill the text from the current cursor position to the end of the line.
  2344. -This saves the killed text on the kill\-ring.  (see below)
  2345. -.TP
  2346. -.B backward\-kill\-line
  2347. -Kill backward to the beginning of the line.  This is normally unbound,
  2348. -in favor of \fBunix-line-discard\fP, which emulates the behavior of
  2349. -the standard Unix terminal driver.
  2350. -.TP
  2351. -.B kill\-word  (M\-d)
  2352. -Kill from the cursor to the end of the current word, or if between
  2353. -words, to the end of the next word.
  2354. -.TP
  2355. -.B backward\-kill\-word (M\-Rubout)
  2356. -Kill the word behind the cursor.
  2357. -.TP
  2358. -.B unix\-line\-discard (C\-u)
  2359. -Do what C\-u used to do in Unix line input.  We save the killed text on
  2360. -the kill\-ring, though.
  2361. -.TP
  2362. -.B unix\-word\-rubout (C\-w)
  2363. -Do what C\-w used to do in Unix line input.  The killed text is saved
  2364. -on the kill\-ring.  This is different than backward\-kill\-word because
  2365. -the word boundaries differ.
  2366. -.TP
  2367. -.B yank (C\-y)
  2368. -Yank the top of the kill ring into the buffer at point.
  2369. -.TP
  2370. -.B yank\-pop (M\-y)
  2371. -Rotate the kill\-ring, and yank the new top.  Only works following
  2372. -`yank' or `yank\-pop'.
  2373. -.PD
  2374. -.SS Arguments
  2375. -.PP
  2376. -.PD 0
  2377. -.TP
  2378. -.B digit\-argument (M\-0, M\-1, ..., M\-\-)
  2379. -Add this digit to the argument already accumulating, or start a new
  2380. -argument.  M\-\- starts a negative argument.
  2381. -.TP
  2382. -.B universal\-argument
  2383. -Do what C\-u does in 
  2384. -.I Emacs.
  2385. -By default, this is not bound to a key.
  2386. -.PD
  2387. -.SS Completing
  2388. -.PP
  2389. -.PD 0
  2390. -.TP
  2391. -.B complete (TAB)
  2392. -Perform substitution on the text before point.
  2393. -If no substitutions can be performed, attempt
  2394. -filename completion.
  2395. -If the text before point is a tilde followed by
  2396. -a word which is a prefix of one of the usernames
  2397. -in
  2398. -.BR \(ap/.zfriends ,
  2399. -substitute the text with the
  2400. -home directory of that user.
  2401. -.TP
  2402. -.B possible\-completions (M-?)
  2403. -List the possible completions of the text before point.
  2404. -.PD
  2405. -.SS Miscellaneous
  2406. -.PP
  2407. -.PD 0
  2408. -.TP
  2409. -.B abort (C\-g)
  2410. -Abort the current editing command and
  2411. -ring the terminal's bell.
  2412. -.TP
  2413. -.B do\-uppercase\-version (M\-a, M\-b, ...)
  2414. -Run the command that is bound to the uppercased key.
  2415. -.TP
  2416. -.B prefix\-meta (ESC)
  2417. -Metafy the next character typed.  This is for
  2418. -people without a meta key.  ESC f is equivalent to Meta\-f.
  2419. -.TP
  2420. -.B undo (C\-_)
  2421. -Incremental undo, separately remembered for each line.
  2422. -.TP
  2423. -.B revert\-line (M\-r)
  2424. -Undo all changes made to this line.  This is like typing the `undo'
  2425. -command enough times to get back to the beginning.
  2426. -.TP
  2427. -.B history\-expand (M\-Space)
  2428. -Perform history expansion on this line.
  2429. -.TP
  2430. -.B check\-spelling (M\-$)
  2431. -Check the spelling of the word before the point.
  2432. -.PD
  2433. -.SS Builtins
  2434. -The following simple-commands are executed in the shell process.
  2435. -Input/Output redirection is permitted.
  2436. -Unless otherwise indicated, the output is written on file descriptor 1
  2437. -and the exit status, when there is no syntax error, is zero.
  2438. -.PD
  2439. -.TP
  2440. -\fB:\fP [ \fIarg\^\fP .\|.\|. ]
  2441. -The command only expands parameters.
  2442. -.br
  2443. -.ne 2
  2444. -.TP
  2445. -\fB\|. \fIfile\fP
  2446. -Read commands from
  2447. -.IR file .
  2448. -The commands are executed in the current shell environment.
  2449. -The exit status is the exit status of the last command executed.
  2450. -.TP
  2451. -\fBalias\fP [ \fB\-a\fP ]  [ \fIname\fP [ \fIstr\^\fP .\|.\|. ] ]
  2452. -.B alias
  2453. -with no arguments prints the list of aliases
  2454. -on standard output.
  2455. -If
  2456. -.I name
  2457. -is supplied with no
  2458. -.IR str ,
  2459. -the alias associated with
  2460. -.I name
  2461. -is printed.
  2462. -Otherwise
  2463. -.I name
  2464. -is defined as an alias having the specified value.
  2465. -A trailing space in the value
  2466. -causes the next word to be checked for
  2467. -alias substitution.
  2468. -Unless the
  2469. -.B \-a
  2470. -flag is used, the alias will only be substituted with its value
  2471. -if it appears as a command word.
  2472. -.TP
  2473. -.PD 0
  2474. -\fBbg\fP [ \fIjob\fP ]
  2475. -.TP
  2476. -\fIjob\fP \fB&\fP
  2477. -.PD
  2478. -Puts the specified
  2479. -.I job
  2480. -into the background.
  2481. -The current job is put in the background
  2482. -if
  2483. -.I job
  2484. -is not specified.
  2485. -See
  2486. -.I Jobs
  2487. -for a description of the format of
  2488. -.IR job .
  2489. -.TP
  2490. -\fBbreak\fP [ \fIn\^\fP ]
  2491. -Exit from the enclosing
  2492. -.BR for
  2493. -.BR while
  2494. -.BR until
  2495. -or
  2496. -.B select
  2497. -loop, if any.
  2498. -If
  2499. -.I n
  2500. -is specified then break
  2501. -.I n
  2502. -levels.
  2503. -.TP
  2504. -\fBcontinue\fP [ \fIn\^\fP ]
  2505. -Resume the next iteration of the enclosing
  2506. -.BR for
  2507. -.BR while
  2508. -.BR until
  2509. -or
  2510. -.B select
  2511. -loop.
  2512. -If
  2513. -.I n
  2514. -is specified then resume at the
  2515. -.IR n -th
  2516. -enclosing loop.
  2517. -.TP
  2518. -.PD 0
  2519. -\fBcd\fP [ \fIarg\^\fP ]
  2520. -.TP
  2521. -\fBcd\fP \fIold\^\fP \fInew\^\fP
  2522. -.PD
  2523. -This command can be in either of two forms.
  2524. -In the first form it
  2525. -changes the current directory to
  2526. -.IR arg .
  2527. -If
  2528. -.I arg
  2529. -is
  2530. -.B \-
  2531. -the directory is changed to the previous
  2532. -directory.
  2533. -The shell
  2534. -parameter
  2535. -.B HOME
  2536. -is the default
  2537. -.IR arg .
  2538. -The parameter
  2539. -.B PWD
  2540. -is set to the current directory.
  2541. -The shell parameter
  2542. -.B CDPATH
  2543. -defines the search path for
  2544. -the directory containing
  2545. -.IR arg .
  2546. -Alternative directory names are separated by
  2547. -a colon.
  2548. -The default path is
  2549. -the current directory.
  2550. -If
  2551. -.I arg
  2552. -begins with a \fB/\fP then the search path
  2553. -is not used.
  2554. -Otherwise, each directory in the path is
  2555. -searched for
  2556. -.IR arg .
  2557. -.IP
  2558. -The second form of
  2559. -.B cd
  2560. -substitutes the string
  2561. -.I new
  2562. -for the string
  2563. -.I old
  2564. -in the current directory name,
  2565. -.B PWD
  2566. -and tries to change to this new directory.
  2567. -.TP
  2568. -\fBdirs\fP [ \fIdirs\fP .\|.\|. ]
  2569. -If no \fIdirs\fP are specified, prints the directory stack.
  2570. -Otherwise loads the directory stack with the arguments,
  2571. -which must be directory names, and puts \fB$PWD\fP at the top
  2572. -of the stack.
  2573. -.TP
  2574. -\fBdisown\fP [ \fIjob\fP .\|.\|. ]
  2575. -The specified jobs are removed from the job table.
  2576. -This means that the status of these jobs will no longer
  2577. -be monitored, and the user can exit safely from an interactive
  2578. -shell without sending a \fBSIGHUP\fP to these jobs.
  2579. -.TP
  2580. -\fBecho\fP [ \fB\-n\fP ] [ \fIarg\^\fP .\|.\|. ]
  2581. -Echos the arguments to the standard output.  Prints
  2582. -a final newline if the \fB\-n\fP flag is not specified.
  2583. -.TP
  2584. -\fBeval\fP [ \fIarg\^\fP .\|.\|. ]
  2585. -The arguments are read as input
  2586. -to the shell
  2587. -and the resulting command(s) executed.
  2588. -.TP
  2589. -\fBexit\fP [ \fIn\^\fP ]
  2590. -Causes the shell to exit
  2591. -with the exit status specified by
  2592. -.IR n .
  2593. -If
  2594. -.I n
  2595. -is omitted then the exit status is that of the last command executed.
  2596. -An end-of-file will also cause the shell to exit
  2597. -except for a
  2598. -shell which has the
  2599. -.I ignoreeof
  2600. -option (See
  2601. -.B setopt
  2602. -below) turned on.
  2603. -.TP
  2604. -\fBexport\fP [ \fIname\fP[\fB=\fP\fIvalue\^\fP] ] .\|.\|.
  2605. -The given
  2606. -.IR name s
  2607. -are marked for automatic
  2608. -export to the
  2609. -.I environment
  2610. -of subsequently-executed commands.
  2611. -.TP
  2612. -.PD 0
  2613. -\fBfc\fP [ \fB\-e\fP \fIename\^\fP \ ] [ \fB\-nlr\^\fP ] [ \fIold=new\fP .\|.\|. ] [ \fIfirst\^\fP [ \fIlast\^\fP ] ]
  2614. -.PD
  2615. -A range of commands from
  2616. -.I first
  2617. -to
  2618. -.I last
  2619. -is selected from the last
  2620. -.B HISTSIZE
  2621. -commands that were typed at the terminal.
  2622. -The arguments
  2623. -.I first
  2624. -and
  2625. -.I last
  2626. -may be specified as a number or as a string.
  2627. -A string is used to locate the most recent command starting with
  2628. -the given string.
  2629. -A negative number is used as an offset to the current command number.
  2630. -Any number of substitutions
  2631. -.I old=new
  2632. -are performed.
  2633. -If the flag
  2634. -.BR \-l ,
  2635. -is selected,
  2636. -the commands are listed on standard output.
  2637. -Otherwise, the editor program
  2638. -.I ename
  2639. -is invoked on a file containing these
  2640. -keyboard commands.
  2641. -If
  2642. -.I ename
  2643. -is not supplied, then the value of the parameter
  2644. -.B FCEDIT
  2645. -(default /usr/ucb/vi)
  2646. -is used as the editor.
  2647. -If
  2648. -.I ename
  2649. -is `\-', no editor is invoked.
  2650. -When editing is complete, the edited command(s)
  2651. -are executed.
  2652. -If
  2653. -.I last
  2654. -is not specified
  2655. -then it will be set to
  2656. -.IR first .
  2657. -If
  2658. -.I first
  2659. -is not specified
  2660. -the default is the previous command
  2661. -for editing and \-16 for listing.
  2662. -The flag
  2663. -.B \-r
  2664. -reverses the order of the commands and
  2665. -the flag
  2666. -.B \-n
  2667. -suppresses command numbers when listing.
  2668. -.TP
  2669. -.PD 0
  2670. -\fBfg\fP [ \fIjob\fP ]
  2671. -.TP
  2672. -\fIjob\fP
  2673. -.PD
  2674. -The
  2675. -specified
  2676. -.I job
  2677. -is brought to the foreground.
  2678. -Otherwise, the current job is
  2679. -brought into the foreground.
  2680. -See
  2681. -.I Jobs
  2682. -for a description of the format of
  2683. -.IR job .
  2684. -.TP
  2685. -\fBglob\fP \fIname\fP .\|.\|.
  2686. -Marks \fIname\fP, which must be a command name,
  2687. -for normal filename generation.
  2688. -See \fBnoglob\fP below.
  2689. -.TP
  2690. -\fBhash\fP \fIname\fP \fIfile\fP
  2691. -Adds an entry to the command hash table corresponding
  2692. -to \fIname\fP.  \fIfile\fP is an executable file to be run
  2693. -whenever \fIname\fP is specified in a simple command.
  2694. -.TP
  2695. -\fBinteger\fP \fIname\fP .\|.\|.
  2696. -The specified named parameters are marked for an internal
  2697. -integer representation.
  2698. -.TP
  2699. -\fBjobs\fP [ \fB\-lp\^\fP ] [ \fIjob\^\fP .\|.\|. ]
  2700. -Lists information about each given job; or all active jobs if
  2701. -.I job
  2702. -is omitted.
  2703. -The
  2704. -.B \-l
  2705. -flag lists process ids in addition to the normal information.
  2706. -The
  2707. -.B \-p
  2708. -flag causes only the process group to be listed.
  2709. -See
  2710. -.I Jobs
  2711. -for a description of the format of
  2712. -.IR job .
  2713. -.TP
  2714. -.PD 0
  2715. -\fBkill\fP [ \fB\-\fP\fIsig\^\fP ] \fIjob\^\fP .\|.\|.
  2716. -.TP
  2717. -\fBkill\fP \fB\-l\fP
  2718. -.PD
  2719. -Sends either the TERM (terminate) signal or the
  2720. -specified signal to the specified jobs or processes.
  2721. -Signals are either given by number or by names (as given in
  2722. -.BR /usr/include/signal.h ,
  2723. -stripped of the prefix ``SIG'').
  2724. -If the job is suspended, it will be send a CONT (continue) signal
  2725. -after the specified signal is delivered.
  2726. -The argument
  2727. -.I job
  2728. -can the process id of a process that is not a member of one of the
  2729. -active jobs.
  2730. -See
  2731. -.I Jobs
  2732. -for a description of the format of
  2733. -.IR job .
  2734. -In the second form,
  2735. -.BR "kill \-l" ,
  2736. -the signal numbers and names are listed.
  2737. -.TP
  2738. -\fBlet\fP \fIarg\^\fP .\|.\|.
  2739. -Each
  2740. -.I arg
  2741. -is a separate
  2742. -.IR "arithmetic expression"
  2743. -to be evaluated.
  2744. -See
  2745. -.I "Arithmetic Evaluation"
  2746. -above, for a description of arithmetic expression evaluation.
  2747. -The exit status is
  2748. -0 if the value of the last expression
  2749. -is non-zero, and 1 otherwise.
  2750. -.TP
  2751. -\fBlimit\fP [ \fB\-h\fP ] [ \fIresource\fP [ \fImax-use\fP ] ]
  2752. -.PD 0
  2753. -.TP
  2754. -.B "limit \-s"
  2755. -.PD
  2756. -.br
  2757. -Limit the consumption by any process the shell spawns,
  2758. -each not to exceed
  2759. -.I max-use
  2760. -on the specified
  2761. -.IR resource .
  2762. -If
  2763. -.I max-use
  2764. -is omitted, print the current limit; if
  2765. -.I resource
  2766. -is omitted, display all limits.
  2767. -.RS
  2768. -.TP
  2769. -.B \-h
  2770. -Use hard limits instead of the current limits.  Hard limits impose a
  2771. -ceiling on the values of the current limits.  Only the super-user may
  2772. -raise the hard limits.
  2773. -.LP
  2774. -.I resource
  2775. -is one of:
  2776. -.RS
  2777. -.TP 15
  2778. -.B cputime
  2779. -Maximum
  2780. -.B CPU
  2781. -seconds per process.
  2782. -.PD 0
  2783. -.TP
  2784. -.B filesize
  2785. -Largest single file allowed.
  2786. -.TP
  2787. -.B datasize
  2788. -Maximum data size (including stack) for the process.
  2789. -.TP
  2790. -.B stacksize
  2791. -Maximum stack size for the process.
  2792. -.TP
  2793. -.B coredumpsize
  2794. -Maximum size of a core dump (file).
  2795. -.TP
  2796. -.B descriptors
  2797. -Maximum value for a file descriptor.
  2798. -.PD
  2799. -.RE
  2800. -.LP
  2801. -.I max-use
  2802. -is a number, with an optional scaling factor, as follows:
  2803. -.RS
  2804. -.TP 15
  2805. -.IB n h
  2806. -Hours (for
  2807. -.BR cputime ).
  2808. -.PD 0
  2809. -.TP
  2810. -.IB n k
  2811. -.I n
  2812. -kilobytes. 
  2813. -This is the default for all but
  2814. -.BR cputime .
  2815. -.TP
  2816. -.IB n m
  2817. -.I n
  2818. -megabytes or minutes (for
  2819. -.BR cputime ).
  2820. -.TP
  2821. -.IB mm : ss
  2822. -Minutes and seconds (for
  2823. -.BR cputime ).
  2824. -.PD
  2825. -.RE
  2826. -.RE
  2827. -.IP
  2828. -If
  2829. -.B limit
  2830. -is invoked solely with the
  2831. -.B s
  2832. -option, the current limits are taken to apply
  2833. -to the parent shell as well as to all processes
  2834. -spawned by it.
  2835. -.TP
  2836. -.B log
  2837. -Inform the user of all users
  2838. -affected by
  2839. -.B WATCH
  2840. -whether they have been announced before or not.
  2841. -.TP
  2842. -\fBmostglob\fP \fIname\fP .\|.\|.
  2843. -Marks \fIname\fP, which must be a command name,
  2844. -for modified filename generation.  Whenever \fIname\fP
  2845. -is used as a command name in a simple command,
  2846. -filename generation is not performed on the first argument
  2847. -following the command name.
  2848. -If there are one or more initial arguments beginning with a
  2849. -dash (corresponding to option arguments), they and the
  2850. -first argument following them
  2851. -are not subject to filename generation.
  2852. -.TP
  2853. -\fBnoglob\fP \fIname\fP .\|.\|.
  2854. -Marks \fIname\fP, which must be a command name,
  2855. -for no filename generation.  Whenever \fIname\fP
  2856. -is used as a command name in a simple command,
  2857. -filename generation is not performed on its arguments.
  2858. -.TP
  2859. -.B popd [ \fB+\fIn\fP ]
  2860. -Pop the directory stack, and
  2861. -.BR cd s
  2862. -to the new top directory.
  2863. -The elements of the directory stack are numbered from 0 starting at the top.
  2864. -.RS
  2865. -.TP 8
  2866. -.BI + n
  2867. -Discard the
  2868. -.IR n 'th
  2869. -entry in the stack.
  2870. -.RE
  2871. -.HP
  2872. -.B pushd
  2873. -.RB [ +\c
  2874. -.IR n " |"
  2875. -.IR dir ]
  2876. -.br
  2877. -Push a directory onto the directory stack.
  2878. -With no arguments, exchange the top two elements,
  2879. -unless the option
  2880. -.B pushdtohome
  2881. -is set, in which case push the current directory
  2882. -onto the stack and change to \fB$HOME\fP.
  2883. -.RS
  2884. -.TP
  2885. -.BI + n
  2886. -Rotate the
  2887. -.IR n 'th
  2888. -entry to the top of the stack and
  2889. -.B cd
  2890. -to it.  If the option
  2891. -.B dextract
  2892. -is set, extract the
  2893. -.IR n 'th
  2894. -entry from the directory stack
  2895. -and
  2896. -.B cd
  2897. -to it.
  2898. -.PD 0
  2899. -.TP
  2900. -.I dir
  2901. -Push the current working directory onto the stack and change to
  2902. -.IR dir .
  2903. -.PD
  2904. -.RE
  2905. -.TP
  2906. -\fBpwd\fP
  2907. -Equivalent to
  2908. -\fBecho $PWD\fP.
  2909. -.TP
  2910. -\fBread\fP [ \fIname\fB?\fIprompt\^\fR ] [ \fIname\^\fP .\|.\|. ]
  2911. -The shell input mechanism.
  2912. -One line is read and
  2913. -is broken up into fields using the characters in
  2914. -.B IFS
  2915. -as separators.
  2916. -If
  2917. -.IR name
  2918. -is omitted then
  2919. -.B REPLY
  2920. -is used as the default
  2921. -.IR name.
  2922. -The exit status is 0 unless an end-of-file is encountered.
  2923. -If the first argument contains a
  2924. -.BR ? ,
  2925. -the remainder of this word is used as a
  2926. -.I prompt
  2927. -on standard error
  2928. -when the shell is interactive.
  2929. -The exit status is 0 unless an end-of-file is encountered.
  2930. -.TP
  2931. -\fBrehash\fP
  2932. -Rebuilds the command hash table.  This command is executed
  2933. -automatically whenever the value of \fB$PATH\fP is changed.
  2934. -.TP
  2935. -\fBreturn\fP [ \fIn\^\fP ]
  2936. -Causes a shell
  2937. -.I function
  2938. -to return
  2939. -to the invoking script
  2940. -with the return status specified by
  2941. -.IR n .
  2942. -If
  2943. -.I n
  2944. -is omitted then the return status is that of the last command executed.
  2945. -If
  2946. -.B return
  2947. -is invoked while not in a
  2948. -.I function
  2949. -or a
  2950. -\fB\|.\fP
  2951. -script,
  2952. -then it is the same as an
  2953. -.BR exit .
  2954. -.TP
  2955. -\fBsched\fP [+]hh:mm \fIcommand\fP
  2956. -Schedule a command for execution at a later time.
  2957. -.TP
  2958. -\fBset\fP [ \fIarg\fP .\|.\|. ]
  2959. -Assign the arguments to the positional parameters, in order.
  2960. -If no arguments are given, then the names and values of
  2961. -all named parameters are printed on the standard output.
  2962. -.TP
  2963. -\fBsetopt\fP [ \fB\(+-aefikmnsuvxABCDEFGHIJK1234567890\fP ] \
  2964. -[ \fIopt\fP .\|.\|. ]
  2965. -Sets the options by letter or by name.  If no options
  2966. -are specified, the current option settings are printed.
  2967. -Valid options are as follows:
  2968. -.RS
  2969. -.PD 0
  2970. -.TP 8
  2971. -.B allexport (\-a)
  2972. -All subsequent parameters that are defined are automatically exported.
  2973. -.TP 8
  2974. -.B errexit (\-e)
  2975. -If a command has a non-zero exit status,
  2976. -execute the
  2977. -.B ERR
  2978. -trap, if set,
  2979. -and exit.
  2980. -.TP 8
  2981. -.B norcs (\-f)
  2982. -\fBzsh\fP will not read the .zshrc, .zlogin, or .zlogout files.
  2983. -.TP 8
  2984. -.B keyword (\-k)
  2985. -All parameter assigment arguments are placed in the environment
  2986. -for a command, not just those that precede the command name.
  2987. -.TP 8
  2988. -.B interactive (\-i)
  2989. -This is an interactive shell.
  2990. -.TP 8
  2991. -.B monitor (\-m)
  2992. -Background jobs will run in a separate process group
  2993. -and a line will print upon completion.
  2994. -The exit status of background jobs is reported in a completion message.
  2995. -This flag is turned on automatically for
  2996. -interactive shells.
  2997. -.TP 8
  2998. -.B noexec (\-n)
  2999. -Read commands and check them for syntax errors, but do not execute them.
  3000. -.TP 8
  3001. -.B \-t
  3002. -Exit after reading and executing one command.
  3003. -.TP 8
  3004. -.B shinstdin (\-s)
  3005. -Read commands from the standard input rather than from a file.
  3006. -.TP 8
  3007. -.B nounset (\-u)
  3008. -Treat unset parameters as an error when substituting.
  3009. -.TP 8
  3010. -.B verbose (\-v)
  3011. -Print shell input lines as they are read.
  3012. -.TP 8
  3013. -.B xtrace (\-x)
  3014. -Print commands and their arguments as they are executed.
  3015. -.TP 8
  3016. -.B clobber (\-1)
  3017. -Permits \fB>\fP redirection to truncate existing files.
  3018. -Also allows \fB>>\fP redirection to create files.
  3019. -.TP 8
  3020. -.B nobadpattern (\-2)
  3021. -In filename generation, do not report an error
  3022. -when given a malformed pattern.
  3023. -Instead, pass the pattern unchanged
  3024. -as an argument.
  3025. -.TP 8
  3026. -.B nonomatch (\-3)
  3027. -In filename generation,
  3028. -do not report an error when pattern matches no filenames.
  3029. -Instead, pass the pattern unchanged
  3030. -as an argument.
  3031. -.TP 8
  3032. -.B globdots (\-4)
  3033. -In filename generation, do not require that an initial \fB.\fP
  3034. -be matched explicitly.
  3035. -.TP 8
  3036. -.B notify (\-5)
  3037. -Notify the user immediately when jobs are completed, rather
  3038. -than wait until just before issuing a prompt.  This is
  3039. -the default mode.
  3040. -.TP 8
  3041. -.B bgnice (\-6)
  3042. -All background jobs are run at a lower priority.  This is the
  3043. -default mode.
  3044. -.TP 8
  3045. -.B ignoreeof (\-7)
  3046. -The shell will not exit on end-of-file.  Either
  3047. -\fBexit\fP or \fBlogout\fP must be used.
  3048. -.TP 8
  3049. -.B markdirs (\-8)
  3050. -All directory names resulting from filename generation
  3051. -have a trailing / appended.
  3052. -.TP 8
  3053. -.B autolist (\-9)
  3054. -List possilities on an ambiguous completion.
  3055. -.TP 8
  3056. -.B correct (\-0)
  3057. -Automatically try to correct the spelling of commands.
  3058. -.TP 8
  3059. -.B dextract (\-A)
  3060. -See \fBpushd\fP above.
  3061. -.TP 8
  3062. -.B nobeep (\-B)
  3063. -Prevent the shell from beeping.
  3064. -.TP 8
  3065. -.B printexitvalue (\-C)
  3066. -If an interactive program exits non-zero, print the
  3067. -exit value.
  3068. -.TP 8
  3069. -.B pushdtohome (\-D)
  3070. -Make pushd with no arguments do the equivalent
  3071. -of \fBpushd \(ap\fP, like \fBcd\fP.
  3072. -.TP 8
  3073. -.B pushdsilent (\-E)
  3074. -Prevent \fBpushd\fP and \fBpopd\fP from printing
  3075. -the directory stack.
  3076. -.TP 8
  3077. -.B nullglob (\-G)
  3078. -If a pattern for filename generation does not match any
  3079. -filenames, delete it from the argument list rather than
  3080. -report an error.
  3081. -.TP 8
  3082. -.B rmstarsilent (\-H)
  3083. -Do not prompt the user before execution of `rm *'.
  3084. -.TP 8
  3085. -.B ignorebraces (\-I)
  3086. -Do not perform brace expansion.
  3087. -.TP 8
  3088. -.B cdablevars (\-J)
  3089. -If a named parameter (without the \fB$\fP) is specified
  3090. -to the \fBcd\fP, \fBpushd\fP, or \fBpopd\fP commands,
  3091. -and the value of the named parameter begins with a `/',
  3092. -\fBzsh\fP will act as if the \fB$\fP had been supplied.
  3093. -.TP 8
  3094. -.B nobanghist (\-K)
  3095. -Do not perform `\fB!\fP' history substitution;
  3096. -do not treat the `\fB!\fP' character
  3097. -specially.
  3098. -.RE
  3099. -.PD
  3100. -.TP
  3101. -\fBshift\fP [ \fIn\^\fP ]
  3102. -.br
  3103. -The positional parameters from
  3104. -\fB$\fP\fIn\fP\fB+1\fP
  3105. -\&.\|.\|.
  3106. -are renamed
  3107. -.B $1
  3108. -\&.\|.\|.\^
  3109. -, default
  3110. -.I n
  3111. -is 1.
  3112. -.PD
  3113. -.PP
  3114. -.PD 0
  3115. -\fBtest\fP \fIexpr\fP
  3116. -.TP
  3117. -\fB[\fP \fIexpr\fP \fB]\fP
  3118. -Return a status of 0 (true) or 1 (false) depending on
  3119. -the evaluation of
  3120. -the conditional expression
  3121. -.IR expr .
  3122. -Expressions may be unary or binary.  Unary
  3123. -expressions are often used to examine the status of a file.  There
  3124. -are string operators
  3125. -and numeric comparison operators as well.
  3126. -.RS
  3127. -.PD 0
  3128. -.TP
  3129. -.B \-b \fIfile\fP
  3130. -True if \fIfile\fP exists and is block special.
  3131. -.TP
  3132. -.B \-c \fIfile\fP
  3133. -True if \fIfile\fP exists and is character special.
  3134. -.TP
  3135. -.B \-d \fIfile\fP
  3136. -True if \fIfile\fP exists and is a directory.
  3137. -.TP
  3138. -.B \-f \fIfile\fP
  3139. -True if \fIfile\fP exists and is a regular file.
  3140. -.TP
  3141. -.B \-g \fIfile\fP
  3142. -True if \fIfile\fP exists and is set-group-id.
  3143. -.TP
  3144. -.B \-k \fIfile\fP
  3145. -True if \fIfile\fP has its ``sticky'' bit set.
  3146. -.TP
  3147. -.B \-L \fIfile\fP
  3148. -True if \fIfile\fP exists and is a symbolic link.
  3149. -.TP
  3150. -.B \-p \fIfile\fP
  3151. -True if \fIfile\fP exists and is a named pipe.
  3152. -.TP
  3153. -.B \-r \fIfile\fP
  3154. -True if file exists and is readable.
  3155. -.TP
  3156. -.B \-s \fIfile\fP
  3157. -True if \fIfile\fP exists and has a non-zero size.
  3158. -.TP
  3159. -.B \-S \fIfile\fP
  3160. -True if \fIfile\fP exists and is a socket.
  3161. -.TP
  3162. -.B \-t [\fIfd\fP]
  3163. -True if
  3164. -.I fd
  3165. -is opened on a terminal.  If
  3166. -.I fd
  3167. -is omitted, it defaults to 1 (standard output).
  3168. -.TP
  3169. -.B \-u \fIfile\fP
  3170. -True if the \fIfile\fP exists and its set-user-id bit is set.
  3171. -.TP
  3172. -.B \-w \fIfile\fP
  3173. -True if the \fIfile\fP exists and is writable.
  3174. -.TP
  3175. -.B \-x \fIfile\fP
  3176. -True if the \fIfile\fP exists and is executable.
  3177. -.TP
  3178. -.B \-O \fIfile\fP
  3179. -True if the \fIfile\fP exists and is owned by the effective user id.
  3180. -.TP
  3181. -.B \-G \fIfile\fP
  3182. -True if the \fIfile\fP exists and is owned by the effective group id.
  3183. -.TP
  3184. -\fIfile1\fP \-\fBnt\fP \fIfile2\fP
  3185. -True if \fIfile1\fP is newer (according to
  3186. -modification date) than \fIfile2\fP.
  3187. -.TP
  3188. -\fIfile1\fP \-\fBot\fP \fIfile2\fP
  3189. -True if \fIfile1\fP is older than file2.
  3190. -.TP
  3191. -\fIfile1\fP \fB\-ef\fP \fIfile\fP
  3192. -True if \fIfile1\fP and \fIfile2\fP have the same device and
  3193. -inode numbers.
  3194. -.TP
  3195. -.B \-z \fIstring\fP
  3196. -True if the length of \fIstring\fP is zero.
  3197. -.TP
  3198. -.B \-n \fIstring\fP
  3199. -.TP
  3200. -\fIstring\fP
  3201. -True if the length of
  3202. -.I string
  3203. -is non-zero.
  3204. -.TP
  3205. -\fIstring1\fP \fB=\fP \fIstring2\fP
  3206. -True if the strings are equal.
  3207. -.TP
  3208. -\fIstring1\fP \fB!=\fP \fIstring2\fP
  3209. -True if the strings are not equal.
  3210. -.TP
  3211. -.B ! \fIexpr\fP
  3212. -True if
  3213. -.I expr
  3214. -is false.
  3215. -.TP
  3216. -\fIexpr1\fP \-\fBa\fP \fIexpr2\fP
  3217. -True if both
  3218. -.I expr1
  3219. -AND
  3220. -.I expr2
  3221. -are true.
  3222. -.TP
  3223. -\fIexpr1\fP \-\fBo\fP \fIexpr2\fP
  3224. -True if either
  3225. -.I expr1
  3226. -OR
  3227. -.I expr2
  3228. -is true.
  3229. -.TP
  3230. -.I arg1 \fBOP\fP arg2
  3231. -OP is one of
  3232. -.BR \-eq ,
  3233. -.BR \-ne ,
  3234. -.BR \-lt ,
  3235. -.BR \-le ,
  3236. -.BR \-gt ,
  3237. -or
  3238. -.BR \-ge .
  3239. -These arithmetic binary operators return true if \fIarg1\fP
  3240. -is equal, not-equal, less-than, less-than-or-equal,
  3241. -greater-than, or greater-than-or-equal than \fIarg2\fP,
  3242. -respectively.
  3243. -.I Arg1
  3244. -and
  3245. -.I arg2
  3246. -may be positive integers, negative integers, or the special
  3247. -expression \fB\-l\fP \fIstring\fP, which evaluates to the
  3248. -length of 
  3249. -.IR string .
  3250. -.PD
  3251. -.RE
  3252. -.TP
  3253. -\fBumask\fP [ \fImask\^\fP ]
  3254. -The user file-creation mask is set to
  3255. -.I mask
  3256. -(see
  3257. -.IR umask (2)).
  3258. -.I mask
  3259. -must be an octal number.
  3260. -If
  3261. -.I mask
  3262. -is omitted, the current value of the mask is printed.
  3263. -.TP
  3264. -\fBunalias\fP \fIname\^\fP .\|.\|.
  3265. -The
  3266. -.IR
  3267. -parameters
  3268. -given by the list of
  3269. -.IR name s
  3270. -are removed from the
  3271. -.I alias
  3272. -list.
  3273. -.TP
  3274. -\fBunfunction\fP \fIname\fP .\|.\|.
  3275. -The
  3276. -.IR
  3277. -functions
  3278. -given by the list of
  3279. -.IR name s
  3280. -are removed from the
  3281. -.I function
  3282. -list.
  3283. -.TP
  3284. -\fBunhash\fP \fIname\fP .\|.\|.
  3285. -Removes \fIname\fP from the command hash table.
  3286. -Shell builtins may be undefined in this way.
  3287. -.TP
  3288. -\fBunlimit [ \fB\-h\fP ] [ \fIresource\fP .\|.\|. ]\fP
  3289. -Remove a limitation on
  3290. -.IR resource .
  3291. -If no
  3292. -.I resource
  3293. -is specified, then all
  3294. -.I resource
  3295. -limitations are removed.
  3296. -See the description of the
  3297. -.B limit
  3298. -command for the list of
  3299. -.I resource
  3300. -names.
  3301. -.RS
  3302. -.TP 8
  3303. -.B \-h
  3304. -Remove corresponding hard limits.  Only the super-user may do this.
  3305. -.RE
  3306. -.TP
  3307. -\fBunset\fP \fIname\^\fP .\|.\|.
  3308. -The parameters given by the list of
  3309. -.IR name s
  3310. -are unset.
  3311. -.TP
  3312. -\fBunsetopt\fP [ \fIopt\fP .\|.\|.\| ]
  3313. -The named options are unset.  See \fBsetopt\fP above.
  3314. -.SS Invocation
  3315. -The shell first executes the the file
  3316. -\fB/etc/zshrc\fP
  3317. -and then
  3318. -\fB\(ap/.zshrc\fP,
  3319. -if it exists.
  3320. -If the shell is invoked by
  3321. -.IR exec (2),
  3322. -and the first character of argument zero
  3323. -.RB ( $0 )
  3324. -is
  3325. -.BR \- ,
  3326. -then the shell is assumed to be a
  3327. -.I login
  3328. -shell and
  3329. -commands are read from
  3330. -.B /etc/zlogin
  3331. -and
  3332. -.BR \(ap/.zshrc ,
  3333. -if it exists.
  3334. -If the
  3335. -.B \-s
  3336. -flag is not present and
  3337. -.I arg
  3338. -is, then the first
  3339. -.I arg
  3340. -is taken as the name of the script to execute.
  3341. -The script
  3342. -.I arg
  3343. -must have read permission and any
  3344. -.I setuid
  3345. -and
  3346. -.I getgid
  3347. -settings will be ignored.
  3348. -Commands are then read as described below;
  3349. -the following flags are interpreted by the shell
  3350. -when it is invoked:
  3351. -.PP
  3352. -.PD 0
  3353. -.TP 10
  3354. -.BI \-c "\| string"
  3355. -If the
  3356. -.B \-c
  3357. -flag is present then
  3358. -commands are read from
  3359. -.IR string .
  3360. -.TP
  3361. -.B \-s
  3362. -If the
  3363. -.B \-s
  3364. -flag is present or if no
  3365. -arguments remain
  3366. -then commands are read from the standard input.
  3367. -Shell output,
  3368. -except for the output of the
  3369. -.I builtins
  3370. -listed above,
  3371. -is written to
  3372. -file descriptor 2.
  3373. -.TP
  3374. -.B \-i
  3375. -If the
  3376. -.B \-i
  3377. -flag is present or
  3378. -if the shell input and output are attached to a terminal (as told by
  3379. -.IR ioctl (2))
  3380. -then this shell is
  3381. -.IR interactive .
  3382. -In this case TERM is ignored (so that \fBkill 0\fP
  3383. -does not kill an interactive shell) and INTR is caught and ignored.
  3384. -In all cases, QUIT is ignored by the shell.
  3385. -.PD
  3386. -.PP
  3387. -The remaining flags and arguments are described under the
  3388. -.B setopt
  3389. -command above.
  3390. -.SH EXIT STATUS
  3391. -Errors detected by the shell, such as syntax errors,
  3392. -cause the shell
  3393. -to return a non-zero exit status.
  3394. -Otherwise, the shell returns the exit status of
  3395. -the last command executed (see also the
  3396. -.B exit
  3397. -command above).
  3398. -If the shell is being used non-interactively
  3399. -then execution of the shell file is abandoned.
  3400. -.SH FILES
  3401. -\(ap/.zshrc
  3402. -.br
  3403. -\(ap/.zlogin
  3404. -.br
  3405. -\(ap/.zlogout
  3406. -.br
  3407. -\(ap/.zfriends
  3408. -.br
  3409. -\(ap/.inputrc
  3410. -.br
  3411. -/etc/zshrc
  3412. -.br
  3413. -/etc/zlogin
  3414. -.br
  3415. -/tmp/zsh\(**
  3416. -.SH SEE ALSO
  3417. -sh(1),
  3418. -csh(1),
  3419. -tcsh(1),
  3420. -itcsh(1),
  3421. ---cut here---cut here---cut here---
  3422.