X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Eric Blake Subject: Re: chere problem with directories with single quote marks Date: Wed, 4 Jan 2006 15:18:53 +0000 (UTC) Lines: 38 Message-ID: References: <20060103210307 DOT 63140 DOT qmail AT web53410 DOT mail DOT yahoo DOT com> <43BBD542 DOT 90604 AT byu DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) 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 Eric Blake byu.net> writes: > > 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. I put a bit more thought into it, and verified that the following works from the command line in all four shells (in other words, since here-docs inside command substitutions are buggy, put the here-doc in a function and just call the function in the command substitution): $ cd /tmp; mkdir -p 'a'\''b`c)d e$f' $ foo(){ cat<<\EOF > a'b`c)d e$f > EOF > };cd "$(foo)" $ pwd /tmp/a'b`c)d e$f $ One other worry - a here-doc will fail if the delimiter happens to match the filename. When Windows expands %L, is it to an absolute pathname? Otherwise, I am afraid that if you use EOF, chere would fail to work in a directory named EOF. But even that can be worked around - since " is not valid in Windows filenames, you could use this as an unambiguous here-doc inside your function: cat<<\" %L " -- Eric Blake -- 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/