This is the mail archive of the 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: Multiple backslashes


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,

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]