latest cygwin: 'run' problem

Eric Blake eblake@redhat.com
Tue Sep 9 13:01:00 GMT 2014


On 09/09/2014 03:15 AM, Achim Gratz wrote:

> 
> 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:
> 
> cd "$( ... )"
> 

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:
> 
> cd "$(/bin/dirname "$(...)")"

Again, if you have the possibility of a relative directory name that
might begin with dash,

cd -- "$(/bin/dirname -- "$(...)")"

> 
> and dirname gets its argument from cygpath, and the argument to cygpath
> must itself be quoted again:
> 
> 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).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140909/c4d587c9/attachment.sig>


More information about the Cygwin mailing list