Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to prevent DOS from acquiring unwanted command-line args?

2 views
Skip to first unread message

Mark_Galeck

unread,
Oct 20, 2009, 1:36:35 AM10/20/09
to
Hello,

if foobar is a program that can take any number of filenames as
arguments :

DOS>foobar file0
DOS>foobar file0 file1

then how do I prevent it thinking that the pipe is the file argument:

DOS>foobar file0 | foo

Here, how do I telf foobar, tthat | and foo are not its arguments

Bill Marcum

unread,
Oct 20, 2009, 4:56:45 AM10/20/09
to

It's built into command.com or cmd.exe, it doesn't pass | or the
following command as arguments to the preceding command.

Mark_Galeck

unread,
Oct 20, 2009, 3:53:39 PM10/20/09
to
> It's built into command.com or cmd.exe, it doesn't pass | or the
> following command as arguments to the preceding command.

That is how it seems to work most of the time. But I have cygwin
tools, including sed, and look at this

C:\tmp>sed -n 's/"""//' foo.i | sort
sed: can't read |: No such file or directory
sed: can't read sort: No such file or directory

Bill Marcum

unread,
Oct 20, 2009, 5:32:55 PM10/20/09
to
On 2009-10-20, Mark_Galeck <mark_galeck...@yahoo.com> wrote:
The problem might be that you have an odd number of quote marks in that
command line. You might use sed -f.

Ross Ridge

unread,
Oct 20, 2009, 5:38:13 PM10/20/09
to
Mark_Galeck <mark_galeck...@yahoo.com> wrote:
>That is how it seems to work most of the time. But I have cygwin
>tools, including sed, and look at this
>
>C:\tmp>sed -n 's/"""//' foo.i | sort
>sed: can't read |: No such file or directory
>sed: can't read sort: No such file or directory

Unlike a Unix-type shell, the Windows command processor (command.com or
cmd.exe) doesn't give any special meaning to the single quote character
('). It is however interpretting the double quotes ("), and the third
double quote character in your command line is preventing the vertical
bar (|) from being interpretted as a pipe.

You should either use the Cygwin shell, which will intrepret the single
quotes the way you expect it do, or only use double quotes:

sed -n "s/\"\"\"//" foo.i | sort

Ross Ridge

--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rri...@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //

0 new messages