| 3565 |
@cindex @code{\} (backslash), in commands |
@cindex @code{\} (backslash), in commands |
| 3566 |
@cindex quoting newline, in commands |
@cindex quoting newline, in commands |
| 3567 |
@cindex newline, quoting, in commands |
@cindex newline, quoting, in commands |
| 3568 |
If you would like to split a single shell command into multiple lines of |
A shell command can be split into multiple lines of text by placing a |
| 3569 |
text, you must use a backslash at the end of all but the last subline. |
backslash before each newline. Such a sequence of lines is provided |
| 3570 |
Such a sequence of lines is combined into a single line, by deleting the |
to the shell as a single command script. The backslash and newline |
| 3571 |
backslash-newline sequences, before passing it to the shell. Thus, the |
are preserved in the shell command. If the first character on the |
| 3572 |
following is equivalent to the preceding example: |
line after a backslash-newline is a tab, the tab will @emph{not} be |
| 3573 |
|
included in the shell command. So, this makefile: |
| 3574 |
|
|
| 3575 |
@example |
@example |
| 3576 |
@group |
@group |
| 3577 |
foo : bar/lose |
all : |
| 3578 |
cd bar; \ |
@@echo no\ |
| 3579 |
gobble lose > ../foo |
space |
| 3580 |
|
@@echo no\ |
| 3581 |
|
space |
| 3582 |
|
@end group |
| 3583 |
|
@end example |
| 3584 |
|
|
| 3585 |
|
consists of two separate shell commands where the output is: |
| 3586 |
|
|
| 3587 |
|
@example |
| 3588 |
|
@group |
| 3589 |
|
nospace |
| 3590 |
|
nospace |
| 3591 |
|
@end group |
| 3592 |
|
@end example |
| 3593 |
|
|
| 3594 |
|
As a more complex example, this makefile: |
| 3595 |
|
|
| 3596 |
|
@example |
| 3597 |
|
@group |
| 3598 |
|
all : ; @@echo 'hello \ |
| 3599 |
|
world' ; echo "hello \ |
| 3600 |
|
world" |
| 3601 |
|
@end group |
| 3602 |
|
@end example |
| 3603 |
|
|
| 3604 |
|
will run one shell with a command script of: |
| 3605 |
|
|
| 3606 |
|
@example |
| 3607 |
|
@group |
| 3608 |
|
echo 'hello \ |
| 3609 |
|
world' ; echo "hello \ |
| 3610 |
|
world" |
| 3611 |
|
@end group |
| 3612 |
|
@end example |
| 3613 |
|
|
| 3614 |
|
which, according to shell quoting rules, will yield the following output: |
| 3615 |
|
|
| 3616 |
|
@example |
| 3617 |
|
@group |
| 3618 |
|
hello \ |
| 3619 |
|
world |
| 3620 |
|
hello world |
| 3621 |
@end group |
@end group |
| 3622 |
@end example |
@end example |
| 3623 |
|
|