autoconf-patches
[Top][All Lists]
Advanced

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

awk: $0 != $ 0 (was: config files substitution with awk)


From: Ralf Wildenhues
Subject: awk: $0 != $ 0 (was: config files substitution with awk)
Date: Fri, 24 Nov 2006 19:23:00 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hello again,

* Paul Eggert wrote on Tue, Nov 21, 2006 at 04:31:59PM CET:
> Ralf Wildenhues <address@hidden> writes:
> 
> > It helps to keep m4 from expanding $0, without needing to think about
> > level of m4 quotation currently in place.  AFAIK it's portable.
> 
> Yes, I just checked the Unix Version 7 sources, and it seems to have
> worked there. 

Well, seems '$ 0' isn't quite the same as '$0', at least with Solaris
/bin/awk:

$ cat dummy.in
@ac_Dummy_001@
@f1@
$ awk '{ $0 = $0 "x" $0 ; print $0 }' < dummy.in
awk: can't set $0
 record number 1
$ awk '{ $ 0 = $0 "x" $0 ; print $ 0 }' < dummy.in
@address@hidden@ac_Dummy_001@
@address@hidden@f1@
$ awk '{ $ 0 = $ 0 "x" $ 0 ; print $ 0 }' < dummy.in
@address@hidden@ac_Dummy_001@
@address@hidden@address@hidden@address@hidden@ac_Dummy_001@

The following one is the most interesting: with one Solaris 5.8 host,
I get an infinite loop and no output, on another 5.8 host I get:

$ awk '{ $ 0 = $ 0 "x" $ 0 ; print }' < dummy.in
@ac_Dummy_001@
@f1@

(The host in question is not available ATM.)
This is all easy to work around, another proposed patch to appear.

Cheers,
Ralf




reply via email to

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