[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 00:02:44 +0200

Chet Ramey wrote:
> Angel Tsankov wrote:
>> Hi,
>> Using bash 3.2.48(1)-release, echo ""~root  prints ~root instead of
>> /root. Is this the expected behaviour?
> Yes.  The tilde is not the first character in the word.  Portions of
> words to be tilde-expanded can't be quoted at all, either.

I see.  I came to this example from a real-world problem and, in case 
someone can help, here it is.  I'd like to append a path to CPATH 
(separating it from the current contents of CPATH with a colon only if CPATH 
is set and is not empty).  The path-to-append points under usr1's home 
directory.  Also this should work in contexts such as CPATH=... <some 
command>.  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.)  Of course, this did not work for the reason pointed 
above.  However, removing the quotes still does not make the 
tilde-expression to expand.  How can I achieve my goal?

Angel Tsankov 

reply via email to

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