summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-06-26 03:31:29 +0000
committerPaul Smith <psmith@gnu.org>2005-06-26 03:31:29 +0000
commitd6a7894d3a6bdb45def58b2fdfb0629233f4f38b (patch)
tree30cd386b442d5d2d6c6b2864be767a78630c767d /doc
parentf388233b033ccae26e567fb573fd3d7a87c71744 (diff)
downloadgunmake-d6a7894d3a6bdb45def58b2fdfb0629233f4f38b.tar.gz
Fix Savannah bug # 1332: handle backslash-newline pairs in command scripts
according to POSIX rules.
Diffstat (limited to 'doc')
-rw-r--r--doc/make.texi58
1 files changed, 50 insertions, 8 deletions
diff --git a/doc/make.texi b/doc/make.texi
index f51fe32..4f07338 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -3565,17 +3565,59 @@ foo : bar/lose
@cindex @code{\} (backslash), in commands
@cindex quoting newline, in commands
@cindex newline, quoting, in commands
-If you would like to split a single shell command into multiple lines of
-text, you must use a backslash at the end of all but the last subline.
-Such a sequence of lines is combined into a single line, by deleting the
-backslash-newline sequences, before passing it to the shell. Thus, the
-following is equivalent to the preceding example:
+A shell command can be split into multiple lines of text by placing a
+backslash before each newline. Such a sequence of lines is provided
+to the shell as a single command script. The backslash and newline
+are preserved in the shell command. If the first character on the
+line after a backslash-newline is a tab, the tab will @emph{not} be
+included in the shell command. So, this makefile:
@example
@group
-foo : bar/lose
- cd bar; \
- gobble lose > ../foo
+all :
+ @@echo no\
+space
+ @@echo no\
+ space
+@end group
+@end example
+
+consists of two separate shell commands where the output is:
+
+@example
+@group
+nospace
+nospace
+@end group
+@end example
+
+As a more complex example, this makefile:
+
+@example
+@group
+all : ; @@echo 'hello \
+ world' ; echo "hello \
+ world"
+@end group
+@end example
+
+will run one shell with a command script of:
+
+@example
+@group
+echo 'hello \
+world' ; echo "hello \
+ world"
+@end group
+@end example
+
+which, according to shell quoting rules, will yield the following output:
+
+@example
+@group
+hello \
+world
+hello world
@end group
@end example