[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Percent Signs in External Commands on Windows

From: David Millis
Subject: Re: [bug-gawk] Percent Signs in External Commands on Windows
Date: Thu, 12 Apr 2012 23:48:34 -0700 (PDT)

*Examines args reveived by nested CMD from Process Explorer*
Grr. Small oversight.

c:\> cmd /C ECHO hello world|gawk.exe -F \\s "{print gensub(/ll/, \"w\", \"\", 
$1) \"?\";}"

Spawning cmd /c from _within_ a CMD environment got a little accidental 
meddling. This gets tokenized into separate commands around that pipe char, so 
the nested CMD only saw the echo.
However the greater CMD ignores the pipe if careted or within quotes. So 
technically I was comparing apples to oranges in the addendum email.

That's not CMD /C's fault though. I just did the test properly using a language 
like python to run the subshell in isolation with WHATEVER as an untokenized 
os.execl("c:\\windows\\system32\\cmd.exe", "/C", "that original mess written as 
a python literal")
os.execl("c:\\windows\\system32\\cmd.exe", "/C", "that mess plus quotes")

The comparison played out the same. Any string you could write at a prompt can 
be executed by a lower level language using cmd.exe /C under the hood, with 
only the risk of losing two quotes. And adding two was harmless.

David Millis

reply via email to

[Prev in Thread] Current Thread [Next in Thread]