bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2


From: Andrew J. Schorr
Subject: Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2
Date: Fri, 9 Jul 2004 15:08:27 -0400
User-agent: Mutt/1.4.1i

On Fri, Jul 09, 2004 at 08:55:47AM -0600, Richard Nolde wrote:
>     awk -v DESTDIR=$DATADIR ' \
>         { "dirname  " $1 | getline DIRNAME
>           "basename " $1 " .001" | getline BASENAME
> #### >>>>> The two previous lines appear to fail <<<<< #####

This can be seen in a much simpler example:

address@hidden: echo "foo/bar" | gawk '{"dirname  " $1 | getline DIRNAME; print 
$1,DIRNAME}'
sh: line 1: foo/bar: No such file or directory
foo/bar 

There is a trivial fix:

address@hidden: echo "foo/bar" | gawk '{cmd = "dirname  " $1; cmd | getline 
DIRNAME; print $1,DIRNAME}'
foo/bar foo

However, I do not understand why the first version does not work.
It is also broken in gawk 3.1.2.

-Andy

P.S. You could probably accomplish the same thing more efficiently by
implementing dirname and basename inside gawk (using gawk string functions)
instead of calling an external program.




reply via email to

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