[r...@smartbridges:~ 1]# awk -F: '{ print $1,$2,$3,$4,$5,$6,$7 }'
/etc/passwd
handle_special FS
handle_special: intvar[F0]:
handle_special: intvar[FS]:
handle_special: intvar[NF]: 0
handle_special RS
handle_special: intvar[F0]:
handle_special: intvar[FS]:
handle_special: intvar[NF]: 0
handle_special FS
handle_special: intvar[F0]:
handle_special: intvar[FS]: :
handle_special: intvar[NF]: 0
handle_special F0
handle_special: intvar[F0]: root:x:0:0:root:/root:/bin/sh
handle_special: intvar[FS]: :
handle_special: intvar[NF]: 0
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
root:x:0:0:root:/root:/bin/shintvar[OFS3]:
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
root:x:0:0:root:/root:/bin/shintvar[OFS3]:
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
root:x:0:0:root:/root:/bin/shintvar[OFS3]:
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
root:x:0:0:root:/root:/bin/shintvar[OFS3]:
Fields[0]: root
Fields[1]: x
Fields[2]: 0
Fields[3]: 0
Fields[4]: root
Fields[5]: /root
Fields[6]: /bin/sh
L.v: x, R.v: 1.47882e-272
L.v: x, R.v: 1.47882e-272
xintvar[OFS3]:
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
root:x:0:0:root:/root:/bin/shintvar[OFS3]:
L.v: , R.v: 1.47882e-272
L.v: , R.v: 1.47882e-272
intvar[OFS3]:
intvar[OFS4]:
[r...@smartbridges:~ 1]# echo $1
[r...@smartbridges:~ 1]# echo '$1'
$1
[r...@smartbridges:~ 1]# echo "$1"
[r...@smartbridges:~ 1]#
I put some printf in awk.c and the Fields[0-6] store the correct values when
{print $1,$2,$3,$4,$5,$6} is used.
However when '{print $1 }' is used, that code snippet(split_f0()) is not
reached:
[r...@smartbridges:~ 1]# awk -F: '{ print $1 }' /etc/passwd
handle_special FS
handle_special: intvar[F0]:
handle_special: intvar[FS]:
handle_special: intvar[NF]: 0
handle_special RS
handle_special: intvar[F0]:
handle_special: intvar[FS]:
handle_special: intvar[NF]: 0
handle_special FS
handle_special: intvar[F0]:
handle_special: intvar[FS]: :
handle_special: intvar[NF]: 0
handle_special F0
handle_special: intvar[F0]: root:x:0:0:root:/root:/bin/sh
handle_special: intvar[FS]: :
handle_special: intvar[NF]: 0
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
L.v: root:x:0:0:root:/root:/bin/sh, R.v: 1.47882e-272
root:x:0:0:root:/root:/bin/shintvar[OFS3]:
intvar[OFS4]:
[r...@smartbridges:~ 1]#
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Stefan Seyfried
Sent: Tuesday, October 13, 2009 5:04 PM
To: [email protected]
Subject: Re: busybox-1.15.2 awk broken
On Tue, 13 Oct 2009 12:35:39 +0800
"Teh Kok How" <[email protected]> wrote:
> Hi;
> I have built util-linux's gawk for comparison and the result
> is the same. I suspect it has to do with ASH. Which shell did you use
> in your testing?
Could actually be true...
> [r...@smartbridges:~ 1]# gawk -F: '{ print $1 }' /etc/passwd
> root:x:0:0:root:/root:/bin/sh
> [r...@smartbridges:~ 1]# echo $SHELL
> /bin/sh
> [r...@smartbridges:~ 1]# echo $TERM
> xterm
> [r...@smartbridges:~ 1]# awk -F: '{ print $1 }' /etc/passwd
> root:x:0:0:root:/root:/bin/sh
> [r...@smartbridges:~ 1]# busybox awk -F: '{ print $1 }' /etc/passwd
> root:x:0:0:root:/root:/bin/sh
> [r...@smartbridges:~ 1]#
... if $1 is expanded even thout it should not, because you quoted it
correctly.
What does
echo '"$1"'
give on this system?
--
Stefan Seyfried
"Any ideas, John?"
"Well, surrounding them's out."
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox