X-Spam-Check-By: sourceware.org Message-ID: <43BBD542.90604@byu.net> Date: Wed, 04 Jan 2006 07:01:38 -0700 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: Dave CC: cygwin AT cygwin DOT com Subject: Re: chere problem with directories with single quote marks References: <20060103210307 DOT 63140 DOT qmail AT web53410 DOT mail DOT yahoo DOT com> In-Reply-To: <20060103210307.63140.qmail@web53410.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 -----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 AT byu DOT 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/