This is the mail archive of the cygwin 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]

glob/noglob and backslashes on cmdline


In the following ./t is a program which simply echoes the command line
arguments if there are any, or calls itself via CreateProcess() and
the cmdline given.

When 'noglob' is set, things work as expected:
in the course of "sh -c", two backslashes are collapsed into ONE:

    $ CYGWIN=noglob ./t
    cmdline {sh -c "t 1\1 2\\2 3\\\3 4\\\\4"}
    0: l:\ralf\t.exe
    1: 11
    2: 2\2
    3: 3\3
    4: 4\\4

However, when 'glob' is set, two backslashes are collapsed into NONE
where I still would have expected ONE (argument labelled "2:")

    $ CYGWIN=glob ./t
    cmdline {sh -c "t 1\1 2\\2 3\\\3 4\\\\4"}
    0: l:\ralf\t.exe
    1: 11
    2: 22
    3: 3\3
    4: 4\4

Is there any deeper reason for this?


Second question regarding 'glob': the docs say
  "This is applicable only to programs running from a DOS command line prompt. "
I just wanted to make sure that this indeed means that glob/noglob
does not affect glob-style-expansion in sh itself (* in bash/sh
commandline and scripts expands even with noglob).

R'

--
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/


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