From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28669 invoked by alias); 10 Feb 2002 17:55:14 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Received: (qmail 28597 invoked from network); 10 Feb 2002 17:55:13 -0000 Received: from unknown (HELO relay.rinet.ru) (195.54.192.35) by sources.redhat.com with SMTP; 10 Feb 2002 17:55:13 -0000 Received: (from uucp@localhost) by relay.rinet.ru (8.11.6/8.11.6) with UUCP id g1AHtCe14051; Sun, 10 Feb 2002 20:55:12 +0300 (MSK) X-Envelope-To: cygwin@cygwin.com Received: from bely.stormoff (BELY) [192.168.0.10] by stormoff with esmtp (Exim 3.12 #1 (Debian)) id 16Zy6U-0006Yc-00; Sun, 10 Feb 2002 20:49:30 +0300 X-Comment-To: Randall R Schulz To: Randall R Schulz Cc: cygwin@cygwin.com Subject: Re: Multiple backslashes References: <5.1.0.14.2.20020210090253.00aa0608@pop3.cris.com> From: Dmitry Bely Date: Sun, 10 Feb 2002 09:55:00 -0000 In-Reply-To: <5.1.0.14.2.20020210090253.00aa0608@pop3.cris.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service (Windows)) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-02/txt/msg00505.txt.bz2 Randall R Schulz writes: > Apart from the fact that this question involves Windows native path > name syntax (which, by the way, works equally well with forward > slashes), this is not Cygwin-specific. > > > There are two levels or rounds of interpretation of your command > string. The first is applied by the shell that interpets the command > you mentioned. No. C:\Work>cmd /c "ls c:\" [...] works, while C:\Work>bash -c "ls c:\\" does not. Why? > Then the bash invoked by that command interprets the > argument to the "-c" option. Each of these rounds of interpretation > replaces "\\" with "\". The problem is that the first shell (cmd.exe) does not replace "\\" with "\"! And I have found it in the case where bash is the only shell (see below). OK, another strange behaviour: C:\Work>bash -c "c:/cygwin/bin/ls.exe" [...] works. C:\Work>bash -c "c:\cygwin\bin\ls.exe" bash: c:cygwinbinls.exe: command not found as expected. C:\Work>bash -c "c:\\cygwin\\bin\\ls.exe" bash: c:\cygwin\bin\ls.exe: command not found why??? C:\Work>bash -c "c:\\\\cygwin\\\\bin\\\\ls.exe" bash: c:\\cygwin\\bin\\ls.exe: command not found expected by me, but not by you :-) bash does something that is beyond my comprehension... > If you use "hard" quotes (apostrophes) then you'll only need two backslashes. > > If you use forward slashes (and CMD.exe is not going to be involved), > then you'll only need quoting to handle spaces and shell globbing > metacharacters (i.e., '*', '?' or '[') and syntactically significant > characters (e.g., '(' or ';'). A cannot always use forward slashes. I am trying to make XEmacs/Win32 work with bash shell. It constructs a command like bash -c "" which bash does not like. Obviously, I cannot simply replace all backslashes with forward ones, because XEmacs also escapes some metacharacters ... Hope to hear from you soon, Dmitry -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/