Subject: | |
From: | |
Reply To: | |
Date: | Fri, 3 Aug 2007 17:34:39 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Aug 3, 2007, at 11:37 AM, John Baxter wrote:
> Compare these two:
>
> $echo This is a test.
> This is a test.
> $echo "This is a test."
> This is a test.
>
>
> In the first, echo gets four "words"---in the second it gets one.
>
> In the loop in your original message, echo has no idea about
> anything named $i--it only knows what the system has given it--a
> bunch of "words" when the quotes were absent vs a single "word"
> with the quotes present (it doesn't see the quotes). Thus...
>
> $i="This is a test."
> $echo $i
> This is a test.
> $echo "$i"
> This is a test.
>
> (In all cases there INCLUDING the assignment, the leading $ on the
> lines that have it is the shell prompt. So in the first one, the
> command is
> i = ....
> )
>
> Continuing...
> $j="'Twas brillig, and the slithy toves"
> $echo "$i" "$j"
> This is a test. 'Twas brillig, and the
> slithy toves
> $echo "$i$j"
> This is a test.'Twas brillig, and the
> slithy toves
>
> and even
> $echo "$i $j"
> This is a test. 'Twas brillig, and
> the slithy toves
>
> --John
I understand that, but how do you get cat to put quotes around each
line?
|
|
|