Tue Mar 13 20:08:11 2018 UTC ()
Standalone | means \[ba] while we want \[or] so add \& protection to
the few places where it was missing.


(uwe)
diff -r1.178 -r1.179 src/bin/sh/sh.1

cvs diff -r1.178 -r1.179 src/bin/sh/sh.1 (expand / switch to unified diff)

--- src/bin/sh/sh.1 2018/03/13 19:43:52 1.178
+++ src/bin/sh/sh.1 2018/03/13 20:08:11 1.179
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: sh.1,v 1.178 2018/03/13 19:43:52 uwe Exp $ 1.\" $NetBSD: sh.1,v 1.179 2018/03/13 20:08:11 uwe Exp $
2.\" Copyright (c) 1991, 1993 2.\" Copyright (c) 1991, 1993
3.\" The Regents of the University of California. All rights reserved. 3.\" The Regents of the University of California. All rights reserved.
4.\" 4.\"
5.\" This code is derived from software contributed to Berkeley by 5.\" This code is derived from software contributed to Berkeley by
6.\" Kenneth Almquist. 6.\" Kenneth Almquist.
7.\" 7.\"
8.\" Redistribution and use in source and binary forms, with or without 8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions 9.\" modification, are permitted provided that the following conditions
10.\" are met: 10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright 11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer. 12.\" notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the 14.\" notice, this list of conditions and the following disclaimer in the
@@ -540,27 +540,27 @@ or @@ -540,27 +540,27 @@ or
540.Fl V , 540.Fl V ,
541must be enabled for this to work. 541must be enabled for this to work.
542.El 542.El
543.Ss Lexical Structure 543.Ss Lexical Structure
544The shell reads input in terms of lines from a file and breaks it up into 544The shell reads input in terms of lines from a file and breaks it up into
545words at whitespace (blanks and tabs), and at certain sequences of 545words at whitespace (blanks and tabs), and at certain sequences of
546characters that are special to the shell called 546characters that are special to the shell called
547.Dq operators . 547.Dq operators .
548There are two types of operators: control operators and redirection 548There are two types of operators: control operators and redirection
549operators (their meaning is discussed later). 549operators (their meaning is discussed later).
550The following is a list of operators: 550The following is a list of operators:
551.Bl -ohang -offset indent 551.Bl -ohang -offset indent
552.It "Control operators:" 552.It "Control operators:"
553.Dl & && \&( \&) \&; ;; ;& | || <newline> 553.Dl & && \&( \&) \&; ;; ;& \&| || <newline>
554.It "Redirection operators:" 554.It "Redirection operators:"
555.Dl < > >| << >> <& >& <<- <> 555.Dl < > >| << >> <& >& <<- <>
556.El 556.El
557.Ss Quoting 557.Ss Quoting
558Quoting is used to remove the special meaning of certain characters or 558Quoting is used to remove the special meaning of certain characters or
559words to the shell, such as operators, whitespace, or keywords. 559words to the shell, such as operators, whitespace, or keywords.
560There are four types of quoting: 560There are four types of quoting:
561matched single quotes, 561matched single quotes,
562matched double quotes, 562matched double quotes,
563backslash, 563backslash,
564and 564and
565dollar preceding matched single quotes (enhanced C style strings.) 565dollar preceding matched single quotes (enhanced C style strings.)
566.Ss Backslash 566.Ss Backslash
@@ -1071,27 +1071,27 @@ being a reserved word, must be separated @@ -1071,27 +1071,27 @@ being a reserved word, must be separated
1071white space (or other operators, perhaps redirects) and is only 1071white space (or other operators, perhaps redirects) and is only
1072recognized as the reserved word when it appears in a command word 1072recognized as the reserved word when it appears in a command word
1073position (such as at the beginning of a pipeline.) 1073position (such as at the beginning of a pipeline.)
1074.Pp 1074.Pp
1075The standard output of all but 1075The standard output of all but
1076the last command in the sequence is connected to the standard input 1076the last command in the sequence is connected to the standard input
1077of the next command. 1077of the next command.
1078The standard output of the last 1078The standard output of the last
1079command is inherited from the shell, as usual, 1079command is inherited from the shell, as usual,
1080as is the standard input of the first command. 1080as is the standard input of the first command.
1081.Pp 1081.Pp
1082The format for a pipeline is: 1082The format for a pipeline is:
1083.Pp 1083.Pp
1084.Dl [!] command1 [ | command2 ...] 1084.Dl [!] command1 [ \&| command2 ...]
1085.Pp 1085.Pp
1086The standard output of command1 is connected to the standard input of 1086The standard output of command1 is connected to the standard input of
1087command2. 1087command2.
1088The standard input, standard output, or both of each command is 1088The standard input, standard output, or both of each command is
1089considered to be assigned by the pipeline before any redirection specified 1089considered to be assigned by the pipeline before any redirection specified
1090by redirection operators that are part of the command are performed. 1090by redirection operators that are part of the command are performed.
1091.Pp 1091.Pp
1092If the pipeline is not in the background (discussed later), the shell 1092If the pipeline is not in the background (discussed later), the shell
1093waits for all commands to complete. 1093waits for all commands to complete.
1094.Pp 1094.Pp
1095The commands in a pipeline can either be simple commands, 1095The commands in a pipeline can either be simple commands,
1096or one of the compound commands described below. 1096or one of the compound commands described below.
1097The simplest case of a pipeline is a single simple command. 1097The simplest case of a pipeline is a single simple command.
@@ -1110,27 +1110,27 @@ the pipeline status is the exit @@ -1110,27 +1110,27 @@ the pipeline status is the exit
1110status of the last command in the pipeline, 1110status of the last command in the pipeline,
1111and the exit status of any other commands in the pipeline is ignored. 1111and the exit status of any other commands in the pipeline is ignored.
1112.Pp 1112.Pp
1113If the reserved word ! precedes the pipeline, the exit status 1113If the reserved word ! precedes the pipeline, the exit status
1114becomes the logical NOT of the pipeline status as determined above. 1114becomes the logical NOT of the pipeline status as determined above.
1115That is, if the pipeline status is zero, the exit status is 1; 1115That is, if the pipeline status is zero, the exit status is 1;
1116if the pipeline status is other than zero, the exit status is zero. 1116if the pipeline status is other than zero, the exit status is zero.
1117If there is no ! reserved word, the pipeline status becomes the exit status. 1117If there is no ! reserved word, the pipeline status becomes the exit status.
1118.Pp 1118.Pp
1119Because pipeline assignment of standard input or standard output or both 1119Because pipeline assignment of standard input or standard output or both
1120takes place before redirection, it can be modified by redirection. 1120takes place before redirection, it can be modified by redirection.
1121For example: 1121For example:
1122.Pp 1122.Pp
1123.Dl $ command1 2>&1 | command2 1123.Dl $ command1 2>&1 \&| command2
1124.Pp 1124.Pp
1125sends both the standard output and standard error of command1 1125sends both the standard output and standard error of command1
1126to the standard input of command2. 1126to the standard input of command2.
1127.Pp 1127.Pp
1128Note that unlike some other shells, each process in the pipeline is a 1128Note that unlike some other shells, each process in the pipeline is a
1129child of the invoking shell (unless it is a shell built-in, in which case 1129child of the invoking shell (unless it is a shell built-in, in which case
1130it executes in the current shell -- but any effect it has on the 1130it executes in the current shell -- but any effect it has on the
1131environment is wiped). 1131environment is wiped).
1132.Pp 1132.Pp
1133A pipeline is a simple case of an AND-OR-list (described below.) 1133A pipeline is a simple case of an AND-OR-list (described below.)
1134A ; or 1134A ; or
1135.Aq newline 1135.Aq newline
1136terminator causes the preceding pipeline, or more generally, 1136terminator causes the preceding pipeline, or more generally,