[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: whitespace
From: |
Paul Smith |
Subject: |
Re: whitespace |
Date: |
Sun, 12 Dec 2010 12:32:57 -0500 |
On Sun, 2010-12-12 at 17:01 +0330, ali hagigat wrote:
> In the third line several spaces added but only one space was printed.
> Does make remove all spaces before giving the recipe to the shell?
The manual says, in the very section you quoted:
However, in contrast to how they are treated in other places
in a makefile, backslash-newline pairs are _not_ removed from
the command.
Both the backslash and the newline characters are preserved and
passed to the shell. How the backslash-newline is interpreted
depends on your shell. If the first character of the next line
after the backslash-newline is a tab, then that tab (and only
that tab) is
removed. Whitespace is never added to the command.
That is what happens.
> Why there is still one space left?
We've had this conversation MANY times before.
When you are trying to understand whitespace issues you MUST QUOTE THE
ARGUMENTS.
The shell will parse your command line and break it up on whitespace
boundaries, so all "internal" whitespace is removed. If you run:
echo foo bar
then what gets printed? "foo bar". Because the shell breaks that
command up and runs the echo command with the arguments "foo" and "bar",
so that's what echo prints. If you want to preserve whitespace you must
use quotes.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist