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: chere problem with directories with single quote marks


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
>>written as:
>>
>>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:

cd "`cat<<\eof
a'b  $c
eof
`"

(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:
cd "$(cat<<\eof
`
eof
)"

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
> `
> 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             ebb9@byu.net
-----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

iD8DBQFDu9VB84KuGfSFAYARAui9AKDXZQzCZdkWOEpX0qEGTJhj7pXNkACfZnH9
zeDyPIIzfuu8TMcwtW5hQ0k=
=TRli
-----END PGP SIGNATURE-----


--
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]