This is the mail archive of the
mailing list for the Cygwin project.
Re: chere problem with directories with single quote marks
- From: Eric Blake <ebb9 at byu dot net>
- To: Dave <d_inabox at yahoo dot com>
- Cc: cygwin at cygwin dot com
- Date: Wed, 04 Jan 2006 07:01:38 -0700
- Subject: Re: chere problem with directories with single quote marks
- References: <email@example.com>
-----BEGIN PGP SIGNED MESSAGE-----
According to Dave on 1/3/2006 2:03 PM:
>>the here-doc correctly preserved the input string. So applying that to
>>the above problem, the registry entry MIGHT work (untested by me) if it is
>>SHELL_CMD="-l -c \\\"xargs -0 cd << 'EOF'\n%L\nEOF\nexec $SHELL_EXE\\\""
> Hmmm. It appears that I haven't handled this case consistently. I'll have a look
> at getting both ' and $ to work properly.
Scratch my above example; cd is a shell builtin, so it won't work from
xargs. I did
$ mkdir "a'b \$c"
for my experiments (make sure ', $, and multiple spaces make it through
okay). In bash and zsh, the following works on the command line:
(and you could use $() instead of ``). But ` and ) are also valid
characters in Windows filenames, and bash, zsh, and pdksh all have bugs in
parsing here-docs inside command substitutions.
For example, bash fails on:
Somehow, it thinks that ` starts a nested command substitution, even
though it appears inside of a quoted here-doc. (And in the case of `, you
must use $() instead of ``, since POSIX states that `` doesn't nest
without proper quoting).
Also, bash has a bug when the command-substitution is not also quoted:
$ echo $(cat<<\eof
Again, bash (both 3.0 and 3.1) thinks the ` starts a nested command
substitution, and is waiting for a matching ` before executing anything.
Believe it or not, the ONLY shell which I found which correctly parses all
the troublesome characters, as required by POSIX, is ash, which is the
least POSIX-compliant of them all!
Sorry, but I don't know ANY portable construct that works in all 4 cygwin
shells (ash, bash, zsh, and pdksh).
Plus there is still the matter of translating a valid command line into a
registry entry that Windows can parse; I don't know if you can embed
newlines, and without embedded newlines, a here-doc will not work.
All I can do is wish you good luck.
Life is short - so eat dessert first!
Eric Blake firstname.lastname@example.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html