User error or awk bug?

Garrett Cooper yanefbsd at gmail.com
Fri Jan 15 21:05:59 UTC 2010


Hi Hackers,
    While testing out something to emulate $(abspath ) in GNU make
3.81+, I tried wrote the following in awk:

    gsub (/\/{2,}/, "")

    I expect it to squish all duplicate `/' in $0. Interestingly
enough, it doesn't match my expected behavior:

[gcooper at optimus ~]$ SLASHES="////////" ; test "$(echo "$SLASHES" |
awk '{ gsub (/\/{2,}/, ""); print }')" = "$SLASHES"; echo $?
0

    I've tried this same code on RHEL 4.6, Gentoo Linux, and of course
my CURRENT box, and the results are the same. So, my question is: did
I do something wrong, or accidentally stumble on an *awk bug?
Thanks!
-Garrett


More information about the freebsd-hackers mailing list