[mdlug] Scripting - Newlines getting clobbered?
Wojtak, Greg
GregWojtak at quickenloans.com
Thu Dec 27 09:15:45 EST 2007
On 12/27/07 12:21 AM, "Robert Meier" <eaglecoach at wwnet.com> wrote:
> Greg,
>
>>>> Any ideas how to keep the newline inside of variables?
>>> Sure, just use quotes, like this:
>>>
>>> VAR="`cat data`"
>>> echo "$VAR"
>> Marvelous! Worked like a charm.
>
> Consider habitually quoting any shell substitution you read non-numerically.
> Once the habit is ingrained, the unnecessary quotes are painless,
> and the absence of pesky shell errors due to mishandling whitespace
> (e.g. spaces in filenames),
> is well worth the time or so in a hundred that you overquote.
>
> Hopefully helpful,
You all are starting to make me feel like a noob. I may not be in the
practice of using quotes all the time, but how many of you habitually use
the ${VAR} convention!??! That's what I thought! :P
Vindictively,
Greg :-)
More information about the mdlug
mailing list