This is the mail archive of the cygwin 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: cd to the path including space.


Christopher Faylor <cgf-use-the-mailinglist-please <at> cygwin.com> writes:

> 
> On Thu, Jan 08, 2009 at 04:46:26PM +0000, Eric Blake wrote:
> >> findtexmf psfonts_t1.map
> >
> >cd "$(cygpath -u "$(findtexmf psfonts_t1.map)")"
> 
> cd  "$(cygpath -u '$(findtexmf psfonts_t1.map)')"
> 
> will probably work a little better.  As Eric knows, you can't nest quotes
> that way.

Huh?  My example works just fine; it's yours that is broken (since '' 
surpresses the innermost $() command substitution):

$ echo "$(echo '$(echo 'a  b')')"
$(echo a b)

By the way, $() is saner than `` when it comes to nesting and "" (as required 
by POSIX):

$ echo "$(echo "$(echo 'a  b')")"
a  b

Here's the same thing in properly quoted ``, at least when using a POSIX-
compliant shell (in general, "`""`" is non-portable, since other bourne shell 
implementations parse it differently than what POSIX requires):

$ echo "`echo \"\`echo 'a  b'\`\"`"
a  b

(in examples like these, I like to use two spaces to guarantee that I've used 
enough quoting)

-- 
Eric Blake



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


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