This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [test] base-files 3.2


> On Wed, Dec 08, 2004 at 06:24:14PM -0000, John Morrison wrote:
>>I'm *fairly* sure that all the variables that need to be escaped have
>> been.
>>
>>The only ones that haven't should be PATH, MANPATH and INFOPATH as per a
>>thread a few weeks ago.
>
> ?  Can you point to a URL for this discussion?  I can't think of any
> reason
> why PATH and friends should not be quoted.

Sure, err, *looks* I kept the email specifically for this... *ummm*... ah!

It's something to do with the which command...

The thread is
"RE: "which" command does not expand "~" in path (base-files update needed)"

Message-ID: <20040928215346.GC2242@trixie.casa.cgf.cx>

<snip>

> > You can use ~ here.  Just don't quote it.  It shouldn't be quoted.
> >
> > export PATH=~/bin:"${PATH}"
>
> I'm sorry, but this isn't true, even for bash.  It still
> leaves the "~" in
> the PATH, which confuses "which" (although "type", being a
> bash builtin, recognizes and expands it).

  Why isn't it expanded by bash's tilde substitution at the time the 'export'
command line is parsed then?  That's sooo wrong.  Oh wow.  Guess what: it
depends
whether the *other* part of the assignment is quoted or not:

dk@mace ~> echo ${PATH}
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/win/c/WINDOWS/system32:/win/c/WINDO
WS:/win/c/WINDOWS/System32/Wbem
dk@mace ~> export FOO=~/bin:"${PATH}"
dk@mace ~> echo "${FOO}"
~/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/win/c/WINDOWS/system32:/win/c
/WINDOWS:/win/c/WINDOWS/System32/Wbem

</snip>

<snip>

This works fine no matter where I put the directory with spaces in it.

Regardless, I don't see any reason to turn this thread into an
exposition on what does or doesn't work with variables that contain
spaces.  Dropping the quotes from the original example will just cause
everything to work correctly everywhere.

John Morrison, would you mind doing this, please?

cgf

</snip>

Hope this is right :)

J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]