gawk not taking redirected input under command.com

Barry Buchbinder bbuchbinder@yahoo.com
Fri Oct 4 06:50:00 GMT 2002


I get the same problems under under win95cmd.exe.  It
fails with redirection but not reading input from a
file:

  C:\> c:\cygwin\bin\gawk -f t < autoexec.bat
  gawk: t:3: fatal: file `-' is a directory

Running under strace and back under command.com I get
the following:

  C:\> type t | c:\cygwin\bin\strace -o strace.out
c:\cygwin\bin\gawk -f t
  gawk: t:3: fatal: file `-' is a directory

I've attached strace's output.

Might the fact that the line number quoted is *after*
the end of the file tell us something?  (t has 2 lines
but the error is in line 3.  When the script is on the
command line, the error is in line 2.)

Thanks again,

- Barry Buchbinder

-----Original Message-----
From: Igor Pechtchanski [mailto:pechtcha@cs.nyu.edu]
Sent: Wednesday, October 02, 2002 12:51 pm
To: cygwin@cygwin.com
Subject: Re: gawk not taking redirected input under
command.com

Don,
The gawk examples work under cmd.exe in Win2k.  It is
possible, however, that command.com doesn't do the
right thing with pipes.  Does strace run under Win98? 
If so, the output of "c:\cygwin\bin\strace
c:\cygwin\bin\gawk '...' < autoexec.bat" might be
instructive...
	Igor

On Wed, 2 Oct 2002, Don Sharp wrote:

> Is it possible that cmd.exe (and command.com)
redirections and pipes are
> not acceptable whereas bash.exe uses Cygwin
implemented redirections?
>
> Cheers
>
> Don Sharp
>
> Barry Buchbinder wrote:
> >
> > It's definitly cygwin's gawk doing it.
> >
> >   C:\> c:\cygwin\bin\gawk -f t < autoexec.bat
> >   GAWK: t:3: fatal: file `-' is a directory
> >
> > The following gives the expect output:
> >
> >   C:\> c:\cygwin\bin\gawk -f t autoexec.bat
> >
> > There is no other gawk in the path.
> >
> > In bash:
> >
> >   /c> type -a gawk
> >   gawk is /bin/gawk
> >   /c> /bin/which gawk
> >   /bin/gawk
> >
> > In command.com, using both cygwin which and an
MS-DOS
> > which:
> >
> >   C:\> c:\cygwin\bin\which.exe gawk
> >   /usr/bin/gawk
> >
> >   C:\> c:\bin\which.exe gawk
> >   C:/CYGWIN/BIN/gawk.exe
> >
> > In command.com, doing "dir /s /b" on all of the C:
> > drive:
> >
> >   C:\> dir /s /b gawk.exe
> >   C:\cygwin\bin\gawk.exe
> >
> > Similar searches for gawk.bat and gawk.com find
> > nothing.
> >
> > - Barry
> >
> > -----Original Message-----
> > From: Christopher Faylor
> > [mailto:cgf-cygwin@cygwin.com]
> > Sent: Wednesday, October 02, 2002 10:14 am
> > To: cygwin@cygwin.com
> > Subject: Re: gawk not taking redirected input
under
> > command.com
> >
> > On Wed, Oct 02, 2002 at 05:47:52AM -0700, Barry
> > Buchbinder wrote:
> > >I have a problem with gawk.
> > >
> > >Under bash, it works as expected.
> > >
> > >Under command.com (win98se) it does the following
> > when
> > >taking input from a pipe or by redirection.
> > >
> > >  C:\> cat autoexec.bat | gawk '{ print "!" $0
"!" }'
> > >  GAWK: cmd. line:2: fatal: file `-' is a
directory
> > >
> > >  C:\> gawk '{ print "!" $0 "!" }' < autoexec.bat
> > >  GAWK: cmd. line:2: fatal: file `-' is a
directory
> >
> > Sounds like you have another, non-cygwin version
of
> > gawk on your system.
> >
> > cgf

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a
JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C)
Popular Science, Oct'02, p.51



__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: strace
URL: <http://cygwin.com/pipermail/cygwin/attachments/20021004/d39764d9/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list