Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 2010 12:41:48 -0800
From:      Garrett Cooper <yanefbsd@gmail.com>
To:        FreeBSD-Hackers <hackers@freebsd.org>
Subject:   User error or awk bug?
Message-ID:  <7d6fde3d1001151241tfeaa4a2j1c8448e40b2b164e@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d1001151241tfeaa4a2j1c8448e40b2b164e>