delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/08/16:58:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: cd to the path including space.
Date: Thu, 8 Jan 2009 21:57:48 +0000 (UTC)
Lines: 38
Message-ID: <loom.20090108T215126-555@post.gmane.org>
References: <uiacm45co51e8tdbo2e6tnjqf34c7vre0m AT 4ax DOT com> <loom DOT 20090108T164518-31 AT post DOT gmane DOT org> <20090108184458 DOT GC3521 AT ednor DOT casa DOT cgf DOT cx>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019