www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/06/11:09:49

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Message-ID: <18585.48772.497440.583231@gepard2.akutech-local.de>
Date: Wed, 6 Aug 2008 17:08:52 +0200
From: Ralf Fassel <ralf AT akutech DOT de>
To: cygwin AT cygwin DOT com
Subject: glob/noglob and backslashes on cmdline
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019