Multiple backslashes
Randall R Schulz
rrschulz@cris.com
Sun Feb 10 09:13:00 GMT 2002
Dmitry,
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.
Then the bash invoked by that command interprets the argument to the "-c"
option. Each of these rounds of interpretation replaces "\\" with "\".
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 ';').
Randall Schulz
Mountain View, CA USA
At 08:45 2002-02-10, Dmitry Bely wrote:
>This is probably a FAQ, but can you explain me why
>
>bash -c "ls c:\\\\"
>
>requires 4 backslashes? I can understand why 2 BS is needed, but 4 BS IMHO
>are too much :-)
>
>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/
More information about the Cygwin
mailing list