home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume1 / bourne / part9 < prev    next >
Internet Message Format  |  1986-11-30  |  28KB

  1. Date: Fri, 7 Jun 85 14:20:16 edt
  2. From: Arnold Robbins <gatech!arnold>
  3. Subject: Bourne shell history + tilde + job control + more (Part 9 of 9)
  4. Newsgroups: mod.sources
  5.  
  6. This is part 9 of 9.  It contains the diffs for the manual page for the
  7. System V Release 2 Bourne shell that comes with BRL Unix.  The original
  8. man page is in /usr/5lib/man/u_man/man1/sh.1.
  9.  
  10. Arnold Robbins
  11. arnold@gatech.{UUCP, CSNET}
  12. --------------- You know what to do here -----------------------
  13. *** ../orig.u/sh.1    Wed May 15 17:22:38 1985
  14. --- sh.1    Wed Jun  5 11:08:21 1985
  15. ***************
  16. *** 34,40
  17.   .SH SYNOPSIS
  18.   .B sh
  19.   [
  20. ! .B \-acefhiknrstuvxEIJ
  21.   ] [ args ]
  22.   .SH DESCRIPTION
  23.   .I Sh\^
  24.  
  25. --- 34,40 -----
  26.   .SH SYNOPSIS
  27.   .B sh
  28.   [
  29. ! .B \-acefhiknqrstuvxEHIJ
  30.   ] [ args ]
  31.   .SH DESCRIPTION
  32.   .I Sh\^
  33. ***************
  34. *** 62,67
  35.   .BR ? ,
  36.   .BR \- ,
  37.   .BR $ ,
  38.   and
  39.   .BR !\\^ .
  40.   .SS Commands
  41.  
  42. --- 62,68 -----
  43.   .BR ? ,
  44.   .BR \- ,
  45.   .BR $ ,
  46. + .BR + ,
  47.   and
  48.   .BR !\\^ .
  49.   .SS Commands
  50. ***************
  51. *** 436,441
  52.   .B $
  53.   The process number of this shell.
  54.   .TP
  55.   .B !
  56.   The process number of the last background command invoked.
  57.   .PD
  58.  
  59. --- 437,454 -----
  60.   .B $
  61.   The process number of this shell.
  62.   .TP
  63. + .B +
  64. + The process number of the parent of this shell.  In particular,
  65. + the value of
  66. + .B $+
  67. + will track the value of the
  68. + .IR getppid (2)
  69. + system call.  I.e. if
  70. + .I init
  71. + should inherit this shell,
  72. + .B $+
  73. + will become 1.
  74. + .TP
  75.   .B !
  76.   The process number of the last background command invoked.
  77.   .PD
  78. ***************
  79. *** 525,530
  80.   \f3\s-1PS1\s+1\fP
  81.   prompt causes the shell to auto-terminate.
  82.   Set to 0 to disable this BRL feature.
  83.   .PD
  84.   .RE
  85.   .PP
  86.  
  87. --- 538,549 -----
  88.   \f3\s-1PS1\s+1\fP
  89.   prompt causes the shell to auto-terminate.
  90.   Set to 0 to disable this BRL feature.
  91. + .TP
  92. + .B
  93. + .SM HISTFILE
  94. + The file where command history is saved across login sessions.
  95. + The default value is
  96. + .BR \s-1$HOME\s+1/.history .
  97.   .PD
  98.   .RE
  99.   .PP
  100. ***************
  101. *** 529,535
  102.   .RE
  103.   .PP
  104.   The shell gives default values to
  105. ! \f3\s-1PATH\s+1\fP, \f3\s-1PS1\s+1\fP, \f3\s-1PS2\s+1\fP, \f3\s-1MAILCHECK\s+1\fP and \f3\s-1IFS\s+1\fP.
  106.   .SM
  107.   .B HOME
  108.   and
  109.  
  110. --- 548,554 -----
  111.   .RE
  112.   .PP
  113.   The shell gives default values to
  114. ! \f3\s-1HISTFILE\s+1\fP, \f3\s-1PATH\s+1\fP, \f3\s-1PS1\s+1\fP, \f3\s-1PS2\s+1\fP, \f3\s-1MAILCHECK\s+1\fP and \f3\s-1IFS\s+1\fP.
  115.   .SM
  116.   .B HOME
  117.   and
  118. ***************
  119. *** 537,542
  120.   .B MAIL
  121.   are set by
  122.   .IR login (1).
  123.   .SS Blank Interpretation
  124.   After parameter and command substitution,
  125.   the results of substitution are scanned for internal field separator
  126.  
  127. --- 556,782 -----
  128.   .B MAIL
  129.   are set by
  130.   .IR login (1).
  131. + .SS Tilde Substitution
  132. + An unquoted tilde character
  133. + .RB ( ~ )
  134. + will cause the shell to attempt a tilde substituion.  Tilde substitutions
  135. + are used to automatically determine home directories.  Both the current
  136. + user's home directory, and the home directory of any other user on
  137. + the system may be found.
  138. + .PP
  139. + A
  140. + .B ~
  141. + by itself is equivalent to using
  142. + .BR \s-1$HOME\s+1 .
  143. + E.g.
  144. + .B ~/bin
  145. + is the same as saying
  146. + .BR \s-1$HOME\s+1/bin .
  147. + The notation
  148. + .B ~person
  149. + will cause the shell to look up
  150. + .BR person 's
  151. + home directory in the
  152. + .B /etc/passwd
  153. + file, and substitute it in.  For example, if user
  154. + .BR arnold 's
  155. + home directory is
  156. + .BR /user/arnold ,
  157. + the shell would replace
  158. + .BR ~arnold/bin
  159. + with
  160. + .BR /user/arnold/bin .
  161. + .PP
  162. + Tilde substitutions are recognized at the beginning of words, after
  163. + equal signs (for shell variable assignment), in the middle of single letter
  164. + flag arguments to commands (e.g. \fBecho \-t~arnold\fP), and after
  165. + colons inside the
  166. + .B
  167. + .SM PATH
  168. + and
  169. + .B
  170. + .SM CDPATH
  171. + shell parameters.
  172. + .PP
  173. + If
  174. + .B /etc/passwd
  175. + cannot be read, or if
  176. + no user can be found to match the attempted tilde substitution,
  177. + the text is left unmodified.
  178. + .SS History Substitution
  179. + When reading input from an interactive terminal, a
  180. + .RB `` ! ''
  181. + character, anywhere on the line,
  182. + signals the shell that it should attempt
  183. + to perform a history substitution.
  184. + A history substitution is a shorthand method which allows the user
  185. + to recall all or part of a previous command, possibly editing the
  186. + recalled portion.
  187. + The recalled (and possibly changed) command line is then placed into
  188. + the current command line,
  189. + to be passed on to the rest of the shell for normal processing.
  190. + A history substitution takes the form:
  191. + .PP
  192. + .if t .RS
  193. + \fB!\fP\^[ \fIstr\fP | \fB?\fIstr\fB?\fR | \fInum\fP ]\c
  194. + [ \fB\(ga\fInum\fR [ \- [ \fInum\fP ] ]\c
  195. + { \fB^\fIstr\fB^\fIstr\fB^\fR [\fBg\fP] }
  196. + .if t .RE
  197. + .PP
  198. + A history substitution contains three parts;
  199. + command selection, argument selection, and editing.
  200. + .I Command selection
  201. + chooses what command will be retrieved from the stored
  202. + history.
  203. + .I Argument selection
  204. + chooses which arguments from that command will be extracted.
  205. + .I Editing
  206. + allows the user to change spelling or make a substitution.
  207. + .PP
  208. + The history substitution is triggered by the
  209. + .RB `` ! '',
  210. + and continues until another
  211. + .RB `` ! ''
  212. + is encountered, or until
  213. + something that could not be part of a history substitution is seen.
  214. + This is so that the
  215. + history substitution will be properly concatenated with the following text.
  216. + Whenever a history substitution is encountered and properly performed,
  217. + the shell echoes the resulting line to the terminal and then executes the
  218. + command.
  219. + .PP
  220. + History substitution occurs inside double quotes and grave accents, but will
  221. + not occur inside single quotes.  To get a literal
  222. + .RB `` ! ''
  223. + character, outside of single quotes, precede it with a
  224. + .BR \e .
  225. + The
  226. + .BR ? ,
  227. + .BR \(ga ,
  228. + and
  229. + .B ^
  230. + characters are treated specially by the history mechanism only when preceded
  231. + by a
  232. + .RB `` ! '',
  233. + otherwise they have their normal meaning
  234. + of ``match a single character'',
  235. + ``enclose a command substitution'',
  236. + and as a synonym for the \fB\(bv\fP
  237. + character.
  238. + .PP
  239. + The full meaning of the history syntax is as follows:
  240. + .RS
  241. + .TP
  242. + \fB!\fP\^[ \fIstr\fP | \fB?\fIstr\fB?\fR | \fInum\fP ]
  243. + The first thing in a history substitution is
  244. + .IR "command selection" .
  245. + This is used to retrieve a given command line for use, or for further
  246. + processing.  In a history command selection, \fB!\fIstr\fR
  247. + will find the most recent command line that started with the
  248. + characters in
  249. + .IR str .
  250. + \fB!?\fIstr\fB?\fR will find the most recent command line that contained
  251. + .I str
  252. + anywhere on the line.  It also allows
  253. + .I str
  254. + to contain blanks and tabs, whereas the first form does not.
  255. + \fB!\fInum\fR allows the user to specify the number of a command, according
  256. + to the output of the
  257. + .B history
  258. + command (see the section on special commands, below).
  259. + .TP
  260. + \fB\(ga\fInum\fR [ \- [ \fInum\fP ]
  261. + The next portion of a history substitution is an optional
  262. + .IR "argument selection" .
  263. + This chooses which portions of the command are to be kept.
  264. + History arguments are not exactly the same as the arguments the rest of
  265. + the shell uses, since history expansion occurs before argument collection.
  266. + Arguments in this context are blank or tab separated words on the command line.
  267. + Single or double quoted strings, strings inside grave accents, shell regular
  268. + expressions, commands in parentheses (which get executed in a subshell),
  269. + and commands enclosed in braces,
  270. + are all treated as single arguments for the history mechanism, even though
  271. + they may have white space in them.
  272. + .sp
  273. + Arguments are numbered from zero, starting at the leftmost portion of the
  274. + line.  In an argument selection, \fB\(ga\fInum\fR specifies that only argument
  275. + .I num
  276. + is to be extracted and kept for further processing or use, and the rest
  277. + of the command line is to be dropped.
  278. + \fB\(ga\fInum\fB\-\fInum\fR
  279. + specifies that the arguments from the first
  280. + .I num
  281. + to the last
  282. + .I num
  283. + are to be kept. In place of any
  284. + .IR num ,
  285. + .B $
  286. + may be specified to obtain the last argument on the line.
  287. + The form \fB\(ga\-\fInum\fR is a shorthand for \fB\(ga\fP1\fB\-\fInum\fR
  288. + and
  289. + \fB\(ga\fInum\fB\-\fR
  290. + is a short form for
  291. + \fB\(ga\fInum\fB\-$\fR.
  292. + Finally, the notation
  293. + \fB\(ga\-\fP
  294. + indicates all the arguments.  That is, \fB\(ga\-\fP implies
  295. + \fB\(ga1\-$\fP.
  296. + .TP
  297. + \fB^\fIstr\fB^\fIstr\fB^\fR [\fBg\fP]
  298. + The last portion of a history substitution is also optional, and is the
  299. + .I editing
  300. + phase.  This allows the remaining portions of the retrieved
  301. + command line to modified, like the substitute command in
  302. + .IR ed (1),
  303. + although in a much more limited fashion.
  304. + In the history mechanism,
  305. + .I str
  306. + is not a regular expression, as in
  307. + .IR ed,
  308. + but just a simple string.
  309. + The history mechanism does not recognize
  310. + either the shell's pattern matching characters or the editor's
  311. + regular expression characters.
  312. + Each substitution happens only once on a line, unless a trailing ``g''
  313. + is appended to the substitution.  In this case, the substitution occurs
  314. + globally (everywhere) on the line.
  315. + Substitutions may be strung together,
  316. + so that more than one can be done at once.
  317. + The trailing ``g'' may be in either upper or lower case.
  318. + .RE
  319. + .PP
  320. + Some examples of history substitution are given below.
  321. + Should a history substitution fail, the errant command will
  322. + .I not
  323. + be added to the history buffers.
  324. + .PP
  325. + The history mechanism recognizes lines that end with unbalanced quotes.
  326. + When the quotes are balanced on the next line(s), 
  327. + It will join this line with the one that opened the quotes, keeping the
  328. + embedded newline(s). So, e.g.,
  329. + .RS
  330. + .sp
  331. + .nf
  332. + .RB "$ " "echo 'open"
  333. + .RB "> " "close'"
  334. + .fi
  335. + .RE
  336. + .sp
  337. + will be saved as one history ``event.''
  338. + This does
  339. + .I not
  340. + extend to other shell constructs, like balancing parentheses across
  341. + newlines.
  342. + .PP
  343. + The history mechanism keeps a maximum of
  344. + 256
  345. + stored commands at any one time, and the total text of the
  346. + stored history may occupy no more than
  347. + 4096
  348. + characters.
  349. + Experience indicates that it is not necessary to store more than this,
  350. + and the extra history buffers should not make the shell too large for
  351. + machines with small address spaces (e.g. PDP-11's).
  352.   .SS Blank Interpretation
  353.   After history, tilde, parameter and command substitution,
  354.   the results of substitution are scanned for internal field separator
  355. ***************
  356. *** 538,544
  357.   are set by
  358.   .IR login (1).
  359.   .SS Blank Interpretation
  360. ! After parameter and command substitution,
  361.   the results of substitution are scanned for internal field separator
  362.   characters (those found in
  363.   .BR \s-1IFS\s+1 )
  364.  
  365. --- 778,784 -----
  366.   and the extra history buffers should not make the shell too large for
  367.   machines with small address spaces (e.g. PDP-11's).
  368.   .SS Blank Interpretation
  369. ! After history, tilde, parameter and command substitution,
  370.   the results of substitution are scanned for internal field separator
  371.   characters (those found in
  372.   .BR \s-1IFS\s+1 )
  373. ***************
  374. *** 593,598
  375.   is a
  376.   .RB `` ! ''
  377.   any character not enclosed is matched.
  378.   .PD
  379.   .RE
  380.   .SS Quoting
  381.  
  382. --- 833,843 -----
  383.   is a
  384.   .RB `` ! ''
  385.   any character not enclosed is matched.
  386. + Note that when typing input from the terminal, the
  387. + .RB `` ! ''
  388. + should be preceded by a
  389. + .BR \e ,
  390. + so that the shell does not attempt to perform a history substitution.
  391.   .PD
  392.   .RE
  393.   .SS Quoting
  394. ***************
  395. *** 617,623
  396.   are quoted.
  397.   Inside double quote marks
  398.   (\f3"\^"\fP),
  399. ! parameter and command substitution occurs and
  400.   .B \e
  401.   quotes the characters
  402.   .BR \e ,
  403.  
  404. --- 862,868 -----
  405.   are quoted.
  406.   Inside double quote marks
  407.   (\f3"\^"\fP),
  408. ! history, parameter, and command substitution occurs and
  409.   .B \e
  410.   quotes the characters
  411.   .BR \e ,
  412. ***************
  413. *** 623,628
  414.   .BR \e ,
  415.   .BR \*` ,
  416.   \f3"\fP,
  417.   and
  418.   .BR $ .
  419.   .B
  420.  
  421. --- 868,874 -----
  422.   .BR \e ,
  423.   .BR \*` ,
  424.   \f3"\fP,
  425. + .BR ! ,
  426.   and
  427.   .BR $ .
  428.   .B
  429. ***************
  430. *** 660,665
  431.   (i.e., the value of
  432.   .BR \s-1PS2\s+1 )
  433.   is issued.
  434.   .SS Input/Output
  435.   Before a command is executed, its input and output
  436.   may be redirected using a special notation interpreted by the shell.
  437.  
  438. --- 906,971 -----
  439.   (i.e., the value of
  440.   .BR \s-1PS2\s+1 )
  441.   is issued.
  442. + .PP
  443. + Many people like to have the shell provide them with useful information
  444. + in their prompt.  To accomadate this, the shell will recognize special
  445. + sequences of characters in the value of
  446. + .BR PS1 ,
  447. + and substitute the appropriate information for them.
  448. + The special sequences and what they signify are:
  449. + .RS
  450. + .TP
  451. + .B %d
  452. + Place the current working directory into the prompt.
  453. + .TP
  454. + .B %e
  455. + Place the current event number (as defined by the
  456. + .B history
  457. + command) into the prompt.
  458. + If history evaluation has been turned off (via
  459. + .BR "set -H" ),
  460. + no number will be substituted in (i.e. the
  461. + .B %e
  462. + will be removed).
  463. + .TP
  464. + .B %h
  465. + Place the machine's host name into the prompt.  The host name is usually
  466. + the name by which the machine is known to the outside world for electronic
  467. + mail addressing.
  468. + .ig
  469. + At Georgia Tech, a leading ``gt'' or ``gt-'' in the host name will be removed.
  470. + ..
  471. + .TP
  472. + .B %l
  473. + Place the user's login name into the prompt.
  474. + The login name selected is the first entry in the
  475. + .B /etc/passwd
  476. + file whose
  477. + .I uid
  478. + matches the value of the
  479. + .IR getuid (2)
  480. + system call.
  481. + This will be a problem on systems where multiple users share the same
  482. + user-id number.
  483. + .TP
  484. + .B %t
  485. + Place the current time of day, in the form \s-1HH:MM\s+1 into the prompt.
  486. + The time is on a 24 hour clock, i.e. 1:30 in the afternoon will be 13:30.
  487. + .TP
  488. + .BI % x
  489. + Place the character
  490. + .I x
  491. + into the prompt.
  492. + If the user wishes to put a literal
  493. + .B %
  494. + into the prompt, then
  495. + .B PS1
  496. + should have
  497. + .B %%
  498. + in it.
  499. + .RE
  500. + .PP
  501. + Some of these facilities are of more use than others.
  502.   .SS Input/Output
  503.   Before a command is executed, its input and output
  504.   may be redirected using a special notation interpreted by the shell.
  505. ***************
  506. *** 725,730
  507.   all leading tabs are stripped from
  508.   .I word\^
  509.   and from the document.
  510.   .TP
  511.   .B <\h@-.1m@&digit
  512.   Use the file associated with file descriptor
  513.  
  514. --- 1031,1038 -----
  515.   all leading tabs are stripped from
  516.   .I word\^
  517.   and from the document.
  518. + History substitution is turned off
  519. + while processing the document.
  520.   .TP
  521.   .B <\h@-.1m@&digit
  522.   Use the file associated with file descriptor
  523. ***************
  524. *** 737,742
  525.   The standard input is closed.
  526.   Similarly for the standard output using
  527.   .BR >\h@-.1m@&\h@-.1m@\- .
  528.   .PD
  529.   .PP
  530.   If any of the above is preceded by a digit,
  531.  
  532. --- 1045,1058 -----
  533.   The standard input is closed.
  534.   Similarly for the standard output using
  535.   .BR >\h@-.1m@&\h@-.1m@\- .
  536. + .TP
  537. + .B <\&>\&word
  538. + Use file
  539. + .I word
  540. + for standard input (file descriptor 0),
  541. + but open it for reading
  542. + .I and
  543. + writing.
  544.   .PD
  545.   .PP
  546.   If any of the above is preceded by a digit,
  547. ***************
  548. *** 806,812
  549.   .BR "set -a" ).
  550.   A parameter may be removed from the environment
  551.   with the 
  552. ! .BR unset command.
  553.   The environment seen by any executed command is thus composed
  554.   of any unmodified name-value pairs originally inherited by the shell,
  555.   minus any pairs removed by
  556.  
  557. --- 1122,1129 -----
  558.   .BR "set -a" ).
  559.   A parameter may be removed from the environment
  560.   with the 
  561. ! .B unset
  562. ! command.
  563.   The environment seen by any executed command is thus composed
  564.   of any unmodified name-value pairs originally inherited by the shell,
  565.   minus any pairs removed by
  566. ***************
  567. *** 823,829
  568.   Thus:
  569.   .RS
  570.   .PP
  571. ! \s-1TERM\s+1=450 \|cmd                 and
  572.   .br
  573.   (export \|\s-1TERM\s+1; \|\s-1TERM\s+1=450; \|cmd)
  574.   .RE
  575.  
  576. --- 1140,1146 -----
  577.   Thus:
  578.   .RS
  579.   .PP
  580. ! \s-1TERM\s+1=450 \|cmd                          and
  581.   .br
  582.   (export \|\s-1TERM\s+1; \|\s-1TERM\s+1=450; \|cmd)
  583.   .RE
  584. ***************
  585. *** 1083,1088
  586.   adjacent to the \f2hits\fR information.
  587.   \f2Cost\fR will be incremented when the recalculation is done.
  588.   .TP
  589.   \f3login\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
  590.   Equivalent to
  591.   .BI "exec login" " arg\^"
  592.  
  593. --- 1400,1448 -----
  594.   adjacent to the \f2hits\fR information.
  595.   \f2Cost\fR will be incremented when the recalculation is done.
  596.   .TP
  597. + \fBhistory\fP \*(OK \fB\-irs\fP \*(OK \fIfilename\fP \*(CK \*(CK
  598. + The \fBhistory\fP command, with no arguments, will print all the commands that
  599. + are currently saved in the shell's history buffers.  As new commands are
  600. + executed, and space in the buffers runs out, old commands will be deleted.  The
  601. + .B history
  602. + commands prints out the stored commands with sequence numbers.  Negative
  603. + numbered commands, through command number zero, are commands that were
  604. + retrieved from the saved history file.  Commands starting at one were
  605. + entered during the current login session.
  606. + If a saved command contains embedded newlines, these will be printed out
  607. + as the sequence
  608. + .BR \en ,
  609. + so that individual command stay on one line.
  610. + .sp
  611. + The \fBhistory\fP command takes two optional arguments.  If the first
  612. + argument is \fB\-s\fP, the shell will save its current history buffers
  613. + in the file named as the third argument. If no file is given, it will
  614. + use the value of
  615. + .BR \s-1HISTFILE\s+1 .
  616. + .sp
  617. + Similarly, if the first argument is \fB\-r\fP, the shell will reset its
  618. + history buffers from the saved history in the file given as the third argument.
  619. + Again, if no file name is given,
  620. + .B \s-1$HISTFILE\s+1
  621. + will be used.
  622. + .sp
  623. + The command
  624. + .B history -i
  625. + will cause the shell to reinitialize its history buffers.  In other words,
  626. + all the shell's saved history will be thrown away, and the shell will
  627. + start from scratch.
  628. + .sp
  629. + The \fBhistory\fP command will have absolutely no effect at all if input
  630. + is not coming from a terminal.  I.e., inside shell files, the
  631. + .B history
  632. + command is effectively a null operation.
  633. + .sp
  634. + The
  635. + .B history
  636. + command will always have an exit status of 1 inside a shell file.
  637. + If input is coming from a terminal, then the exit status wil be 0
  638. + if the command succeeds, 1 otherwise.
  639. + .TP
  640.   \f3login\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
  641.   Equivalent to
  642.   .BI "exec login" " arg\^"
  643. ***************
  644. *** 1136,1142
  645.   .I n 
  646.   is omitted, the return status is that of the last command executed.
  647.   .TP
  648. ! \f3set\fP \*(OK \f3\-\-aefhkntuvxEIJ\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK \*(CK
  649.   .RS
  650.   .TP
  651.   .B \-a
  652.  
  653. --- 1496,1502 -----
  654.   .I n 
  655.   is omitted, the return status is that of the last command executed.
  656.   .TP
  657. ! \f3set\fP \*(OK \f3\-\-aefhkntuvxEHIJ\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK \*(CK
  658.   .RS
  659.   .TP
  660.   .B \-a
  661. ***************
  662. *** 1180,1185
  663.   .IR .profile\^ s
  664.   to avoid accidental logout.
  665.   .TP
  666.   .B \-I
  667.   (BRL addition)
  668.   Prints a resource usage summary
  669.  
  670. --- 1540,1562 -----
  671.   .IR .profile\^ s
  672.   to avoid accidental logout.
  673.   .TP
  674. + .B \-H
  675. + Disable history processing.  If the shell is invoked with this option,
  676. + it will not bother trying to restore its saved history from the
  677. + contents of
  678. + .BR \s-1$HISTFILE\s+1 .
  679. + While this flag is in effect, the shell will not save any commands in
  680. + its history buffers.
  681. + The sequence
  682. + .B %e
  683. + in the value of
  684. + .B \s-1PS1\s+1
  685. + will also have no effect on the generated prompt string.
  686. + If
  687. + .B set +H
  688. + is used to turn history processing back on, the shell will start saving
  689. + subsequent commands from that point on.
  690. + .TP
  691.   .B \-I
  692.   (BRL addition)
  693.   Prints a resource usage summary
  694. ***************
  695. *** 1332,1337
  696.   and from
  697.   .BR \s-1$HOME\s+1/.profile ,
  698.   if such files exist.
  699.   Thereafter, commands are read as described below, which
  700.   is also the case when the shell is invoked as
  701.   .BR /bin/sh .
  702.  
  703. --- 1709,1726 -----
  704.   and from
  705.   .BR \s-1$HOME\s+1/.profile ,
  706.   if such files exist.
  707. + Next, whether or not the first character of argument zero was a
  708. + .BR \- ,
  709. + and no matter how the shell was invoked,
  710. + the shell will read commands from the file
  711. + .BR \s-1$HOME\s+1/.shrc ,
  712. + if it exists.
  713. + Then, if the shell is interactive, is not a forked subshell,
  714. + and the
  715. + .B \-H
  716. + flag is not in effect,
  717. + it will attempt to restore its saved history from
  718. + .BR \s-1$HISTFILE\s+1 .
  719.   Thereafter, commands are read as described below, which
  720.   is also the case when the shell is invoked as
  721.   .BR /bin/sh .
  722. ***************
  723. *** 1340,1345
  724.   the
  725.   .B \-J
  726.   (job control) flag is automatically set.
  727.   The flags below are interpreted by the shell on invocation only; note
  728.   that unless the 
  729.   .B \-c
  730.  
  731. --- 1729,1740 -----
  732.   the
  733.   .B \-J
  734.   (job control) flag is automatically set.
  735. + .ig
  736. + At Georgia Tech, job control is always turned on, even if the
  737. + .B \-J
  738. + flag was not given, and even if argument zero did not contain a
  739. + .BR j .
  740. + ..
  741.   The flags below are interpreted by the shell on invocation only; note
  742.   that unless the 
  743.   .B \-c
  744. ***************
  745. *** 1388,1393
  746.   If the
  747.   .B \-r
  748.   flag is present the shell is a restricted shell.
  749.   .PD
  750.   .PP
  751.   The remaining flags and arguments are described under the
  752.  
  753. --- 1783,1799 -----
  754.   If the
  755.   .B \-r
  756.   flag is present the shell is a restricted shell.
  757. + .TP
  758. + .B \-q
  759. + If the
  760. + .B \-q
  761. + flag is present, the shell will do a ``quick'' startup.
  762. + This means that the shell will
  763. + .I not
  764. + read the contents of the
  765. + .B \s-1$HOME\s+1/.shrc
  766. + file.
  767. + The shell will also not try to read this file if it is a restricted shell.
  768.   .PD
  769.   .PP
  770.   The remaining flags and arguments are described under the
  771. ***************
  772. *** 1425,1430
  773.   If the process group
  774.   .I n\^
  775.   is not specified then the ``current job'' is resumed.
  776.   .PD
  777.   .PP
  778.   With job control enabled,
  779.  
  780. --- 1831,1842 -----
  781.   If the process group
  782.   .I n\^
  783.   is not specified then the ``current job'' is resumed.
  784. + .TP
  785. + .B suspend
  786. + Suspend the shell process itself in the background.
  787. + The shell will complain
  788. + if it is a login shell, and will not suspend itself.
  789. + Otherwise, it does not matter whether or not job control is enabled.
  790.   .PD
  791.   .PP
  792.   With job control enabled,
  793. ***************
  794. *** 1441,1446
  795.   If the specified job number is one of the known jobs,
  796.   then this expression is replaced by
  797.   the corresponding process group number.
  798.   .PD
  799.   .SH EXIT STATUS
  800.   Errors detected by the shell, such as syntax errors,
  801.  
  802. --- 1853,1886 -----
  803.   If the specified job number is one of the known jobs,
  804.   then this expression is replaced by
  805.   the corresponding process group number.
  806. + .SS Saving and Restoring History
  807. + When an interactive shell starts up, if the
  808. + .B \-H
  809. + flag is not in effect, it will attempt to read the contents of
  810. + .B \s-1$HISTFILE\s+1
  811. + into its history buffers.  This allows the user to recall commands
  812. + executed during a previous login session.
  813. + When the shell exits or executes an
  814. + .B exec
  815. + (again, if
  816. + .B \-H
  817. + is not in effect), it will attempt to write its current history
  818. + buffers into
  819. + .BR \s-1$HISTFILE\s+1 ,
  820. + for use in a future login session.
  821. + .PP
  822. + The
  823. + .B history
  824. + command allows the user to save the current history buffers into
  825. + a file of his or her own choosing, or to restore them from a given file.
  826. + If
  827. + .B \-H
  828. + has been set, the
  829. + .B history
  830. + command will give a warning that history processing is not
  831. + available, and will
  832. + .I not
  833. + save or restore the shell's history buffers.
  834.   .PD
  835.   .SH EXIT STATUS
  836.   Errors detected by the shell, such as syntax errors,
  837. ***************
  838. *** 1457,1462
  839.   .br
  840.   \s-1$HOME\s+1/\f3.\fPprofile
  841.   .br
  842.   /tmp/sh\(**
  843.   .br
  844.   /dev/null
  845.  
  846. --- 1897,1904 -----
  847.   .br
  848.   \s-1$HOME\s+1/\f3.\fPprofile
  849.   .br
  850. + \s-1$HOME\s+1/\f3.\fPshrc
  851. + .br
  852.   /tmp/sh\(**
  853.   .br
  854.   /dev/null
  855. ***************
  856. *** 1464,1469
  857.   acctcom(1),
  858.   cd(1),
  859.   echo(1),
  860.   env(1),
  861.   login(1),
  862.   newgrp(1),
  863.  
  864. --- 1906,1912 -----
  865.   acctcom(1),
  866.   cd(1),
  867.   echo(1),
  868. + ed(1),
  869.   env(1),
  870.   login(1),
  871.   newgrp(1),
  872. ***************
  873. *** 1477,1482
  874.   dup(2),
  875.   exec(2),
  876.   fork(2),
  877.   pipe(2),
  878.   signal(2),
  879.   ulimit(2),
  880.  
  881. --- 1920,1927 -----
  882.   dup(2),
  883.   exec(2),
  884.   fork(2),
  885. + getppid(2),
  886. + getuid(2),
  887.   pipe(2),
  888.   signal(2),
  889.   ulimit(2),
  890. ***************
  891. *** 1510,1512
  892.   .B login
  893.   command is replaced by
  894.   .BR newgrp .
  895.  
  896. --- 1955,2071 -----
  897.   .B login
  898.   command is replaced by
  899.   .BR newgrp .
  900. + .SH PYRAMID SPECIFIC
  901. + .PP
  902. + On computers manufactured by the Pyramid Corporation, which support
  903. + both the University of California at Berkeley 4.2BSD version of \s-1UNIX\s+1,
  904. + and the AT&T System V version of \s-1UNIX\s+1,
  905. + the shell has several additional capabilities.
  906. + .SS Special Commands
  907. + .PP
  908. + There are three additional commands built in to the shell. They are:
  909. + .RS
  910. + .TP
  911. + \fBatt\fP \*(OK command \*(CK
  912. + Switch the current ``universe'' to be ATT System V.
  913. + If a command is specified, that command will be run in the ``att''
  914. + universe, without affecting the shell's current universe.
  915. + The
  916. + .B \-t
  917. + option of
  918. + .B /bin/att
  919. + is not (yet) supported.
  920. + .TP
  921. + \fBucb\fP \*(OK command \*(CK
  922. + Switch the current ``universe'' to be University of California at
  923. + Berkeley 4.2BSD.
  924. + If a command is specified, that command will be run in the ``ucb''
  925. + universe, without affecting the shell's current universe.
  926. + The
  927. + .B \-t
  928. + option of
  929. + .B /bin/ucb
  930. + is not (yet) supported.
  931. + .TP
  932. + \fBuniverse\fP \*(OK \fB\-l\fP \*(CK
  933. + Print the current universe, either ``att'' or ``ucb''. The
  934. + .B \-l
  935. + option will print a longer, more explanative name for the current universe.
  936. + .RE
  937. + .PP
  938. + If the shell cannot determine the current universe when it starts up,
  939. + it will default to
  940. + .BR ucb .
  941. + .SS Shell Variables
  942. + .PP
  943. + There is an additional pre-defined shell parameter,
  944. + .BR \s-1UNIVERSE\s+1 .
  945. + The value of
  946. + .B \s-1UNIVERSE\s+1
  947. + .I always
  948. + tracks that of the current universe.  Using it is equivalent to a
  949. + \*`universe\` command substitution,
  950. + except that a new process will not be created.
  951. + This variable cannot be set by the user (it is \fBreadonly\fP),
  952. + and any inherited value from the environment will be ignored.
  953. + .SS Special Sequences for \s-1PS1\s+1
  954. + .PP
  955. + Finally, the sequence
  956. + .B %u
  957. + in the value of
  958. + .B \s-1PS1\s-1
  959. + will cause the shell to subsitute in the name of the current universe,
  960. + either ``att'' or ``ucb''.
  961. + .SH HISTORY EXAMPLES
  962. + Command history provides a powerful method for easily redoing previous
  963. + commands, or for quicly fixing typing mistakes.
  964. + Here are some annotated examples.  User input is in
  965. + .BR boldface .
  966. + .sp
  967. + .nf
  968. + # first, list some files
  969. + .RB "$ " lf
  970. + hello.c        echo.c
  971. + # now, make a typing mistake
  972. + .RB "$ " "cat hello"
  973. + hello: No such file or directory
  974. + # fix it.  The trailing ! ends the history substitution,
  975. + # in order to correctly concatenate it with the following .c
  976. + .RB "$ " "!!.c"
  977. + cat hello.c
  978. + main () { printf ("hello world\en"); }
  979. + # now look at echo.c instead
  980. + .RB "$ " "!^hello^echo"
  981. + cat echo.c
  982. + main () { printf ("echo: no arguments\en"); }
  983. + # do it again, just for fun
  984. + .RB "$ " "!"
  985. + cat echo.c
  986. + main () { printf ("echo: no arguments\en"); }
  987. + # now we'll rearrange some arguments
  988. + .RB "$ " "echo 1 2 3 4 5"
  989. + 1 2 3 4 5
  990. + # print last argument, first and second arguments, then change 4 to four
  991. + .RB "$ " "echo !\(ga$ !\(ga1-2 !\(ga4^4^four"
  992. + echo 5 1 2 four
  993. + 5 1 2 four
  994. + # do something with all the previous arguments at once
  995. + .RB "$ " "echo the previous arguments were !\(ga\-"
  996. + echo the previous arguments were 5 1 2 four
  997. + the previous arguments were 5 1 2 four
  998. + # now do some substitutions.  first get something to work with.
  999. + .RB "$ " "echo aa bb cc"
  1000. + aa bb cc
  1001. + # change the first 'a' to a 'b', and change all c's to d's
  1002. + .RB "$ " "!^a^b^^c^d^g"
  1003. + echo ba bb dd
  1004. + ba bb dd
  1005. + .fi
  1006. + .PP
  1007. + These few brief examples should provide a general feel for the
  1008. + history mechanism.  The quickest way to learn it is to experiment
  1009. + with it for a while, using the
  1010. + .B echo
  1011. + command, which can do very little damage.
  1012. + While it looks cryptic when being typed, it is very general and
  1013. + orthogonal, and quickly becomes natural.
  1014.  
  1015.