]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
(Limitations of Usual Tools): Warn about
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Jan 2005 08:31:44 +0000 (08:31 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Jan 2005 08:31:44 +0000 (08:31 +0000)
sed 'command1;command2'.  Problem reported by Ralf Wildenhues.

doc/autoconf.texi

index f616046740f54ed4cbe70a9e5f8291984cfc28fc..0d58d0b685c14fe5def51086ffe174c5f6ae3297 100644 (file)
@@ -11799,23 +11799,37 @@ Nested parenthesization in patterns (e.g., @samp{\(\(a*\)b*)\)}) is
 quite portable to modern hosts, but is not supported by some older
 @command{sed} implementations like SVR3.
 
-Of course the option @option{-e} is portable, but it is not needed.  No
-valid Sed program can start with a dash, so it does not help
-disambiguating.  Its sole usefulness is to help enforcing indentation as
-in:
+The @option{-e} option is portable.
+Some people prefer to use it:
 
 @example
-sed -e @var{instruction-1} \
-    -e @var{instruction-2}
+sed -e '@var{command-1}' \
+    -e '@var{command-2}'
 @end example
 
 @noindent
-as opposed to
+as opposed to the equivalent:
 
 @example
-sed @var{instruction-1};@var{instruction-2}
+sed '
+  @var{command-1}
+  @var{command-2}
+'
 @end example
 
+@noindent
+The following usage is sometimes equivalent:
+
+@example
+sed '@var{command-1};@var{command-2}'
+@end example
+
+but Posix says that this use of a semicolon has undefined effect if
+@var{command-1}'s verb is @samp{@{}, @samp{a}, @samp{b}, @samp{c},
+@samp{i}, @samp{r}, @samp{t}, @samp{w}, @samp{:}, or @samp{#}, so you
+should use semicolon only with simple scripts that do not use these
+verbs.
+
 Contrary to yet another urban legend, you may portably use @samp{&} in
 the replacement part of the @code{s} command to mean ``what was
 matched''.  All descendants of Unix version 7 @command{sed}