bug-bash
[Top][All Lists]
Advanced

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

Re: No tilde expansion right after a quotation


From: Jon Seymour
Subject: Re: No tilde expansion right after a quotation
Date: Mon, 16 Feb 2009 09:18:41 +1100

There may be other ways to do this, but:

     CPATH="${CPATH}${CPATH:+:}$(echo ~usr1/blah/blah)"

should work.

jon.


On Mon, Feb 16, 2009 at 9:02 AM, Angel Tsankov <address@hidden> wrote:
> 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?
>
> Regards,
> Angel Tsankov
>
>
>
>
>
>




reply via email to

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