[1.7] bash UNC path bug?

Mark J. Reed markjreed@gmail.com
Thu Jul 30 23:45:00 GMT 2009


On Thu, Jul 30, 2009 at 2:36 PM, Eric Blake wrote:
>> > bash... maybe cygpath, seems to be doing something weird:
> Weird - yes.  But buggy - no.

Backtick-quoting rules are strange.  For instance, single quotes
within backticks still prevent variable expansion:

$ x=1
$ echo `echo '$x'`
$x                           # not "1"

So it's not as simple as backticks working like double quotes (within
which single quotes have no effect whatsoever):

$ echo " '$x' "
'1'

What's going on is that there's a rule that allows nesting backticks
by using successively increasing numbers of backslashes in front of
them:

`outer \`inner \\\`innermost\\\` inner\` outer`

and because of this, backticks essentially add yet another layer of
backslash parsing and removal to the mix.

This is the biggest reason to prefer new-style $(...) command
substitution to backticks.

None of this is Cygwin-specific, we just deal with literal backslashes
more in Cygwinland thanks to DOS-style file paths.




-- 
Mark J. Reed <markjreed@gmail.com>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list