[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No tilde expansion right after a quotation

From: Angel Tsankov
Subject: Re: No tilde expansion right after a quotation
Date: Mon, 16 Feb 2009 11:26:47 +0200

Eric Blake wrote:
> According to Angel Tsankov on 2/15/2009 3:02 PM:
>> I tried CPATH="${CPATH}${CPATH:+:}"~usr1/blah/blah.  (I quote
>> expansions just to be on the safe side, though I think home
>> directories may not contain spaces.)
> There are some contexts, such as variable assignments, where double
> quotes are not necessary.
> foo='a b'
> bar=$foo
> is just as safe as
> bar="$foo"
> In fact, it is MORE portable to avoid double quotes in assignments,
> if you are worried about writing scripts portable to more than just
> bash.  Of these two constructs:
> foo="`echo "a b"`"
> bar=`echo "a b"`
> only the setting of bar is guaranteed to parse correctly in all
> shells.
Eric, thanks for youy replay.  If double quotes are not that portable, then 
how am I suppose to assign the output from some command to a variable when 
the output contains a space?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]