X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=Csmjd/ J50ZxmelNysrOhgPENXMZktjrwushxFHdt8YAZoEMuDQ+3GqUQgUayIQPiFSFLFt qNvWckjCw7vfwYYgrHGH76EEXFnoDlIzRK44B2mbjDwbqnYBAFpHh46gxo7YQ0qN wWHWpnLIYAlf69KOdM3vCVOUde6Yj5mKbIJPQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; s=default; bh=M4/VzuytOeEi UwCTPLJu3OZGRrw=; b=IE57b6kQbWCqAQ2B+2nkdyUB6Hye2Xj2k0yv9e/reWXm 7O0pu+Zox3Zx9vqpX9o7FZtROPbG/dQ9DNbeLMV2kdqhzrnO5LcAeBTXTxM1iz/W IzkSR5BJr4KQs25lQVxkYHVOdwzZE8UuvBbgXtvgwgqU7WqkHmRqwZSYiMPRkIk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <540EFA12.6080308@redhat.com> Date: Tue, 09 Sep 2014 07:01:06 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: latest cygwin: 'run' problem References: <54060378 DOT 2070108 AT gmail DOT com> <5406680D DOT 4030105 AT verizon DOT net> <540761FA DOT 1040902 AT verizon DOT net> <87ppfcqyc7 DOT fsf AT Rainer DOT invalid> <540A600A DOT 6090201 AT verizon DOT net> <540A6817 DOT 9080207 AT verizon DOT net> <20140906201229 DOT GA9220 AT phoenix> <20140908174606 DOT GA4187 AT phoenix> <1448944831 DOT 20140909024857 AT yandex DOT ru> <20140909011413 DOT GC4187 AT phoenix> <20140909030238 DOT GD4187 AT phoenix> <87oaup6tpk DOT fsf AT Rainer DOT invalid> In-Reply-To: <87oaup6tpk.fsf@Rainer.invalid> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw" X-IsSubscribed: yes --sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/09/2014 03:15 AM, Achim Gratz wrote: >=20 > If you want to get this right, you should work it out from the inside. > You want the cd command to get a directory name from a subcommand that > may contain spaces, so you need to quote the result: >=20 > cd "$( ... )" >=20 If you want to also guarantee that you can change to a relative directory whose name begins with a -, you need: cd -- "$( ... )" > Since the argument you're getting may actually be a filename, you need > to use the dirname command and quote its argument again: >=20 > cd "$(/bin/dirname "$(...)")" Again, if you have the possibility of a relative directory name that might begin with dash, cd -- "$(/bin/dirname -- "$(...)")" >=20 > and dirname gets its argument from cygpath, and the argument to cygpath > must itself be quoted again: >=20 > cd "$("$(/bin/dirname "$(/bin/cygpath -u "$1")")")" Ah - you are using cygpath, which can guarantee an absolute name (and therefore avoid an argument beginning with dash). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUDvoSAAoJEKeha0olJ0NqjlIH/A6oNG4ExTJ1Nrp/Ps5lm9zN VeyORNdCe8SGvKtmq/RHv2Rz9VzwPkddF2bwqgTz+Bc36RYW4naGxZVoAnLhczO6 1SM6nCAi5oIZyNBzxijQSOOHCIeXnYhEHvlc0ITKLuGXwh0KgGjuIgn3dWiuRt++ 84pLTo/hKWM5rHdnGBBDg+Aq5HMChMuoQU/MaVjT9SwROeH7ZahFAio+5QHCNDYp JZAmawOrTv7fvSydArkp0OKahmyTncp7z0PIftKMviJ0ewxCZdz9bD/McCkKEwjd DbalUYIcydTucYbip/D8XXY0v5E4/F3wR7RVU71XiIE/PVsIQbvEoO0so7Znmzg= =/RGT -----END PGP SIGNATURE----- --sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw--