[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1H9pHf-0002Iu-4D@flower>
Date: Wed, 24 Jan 2007 21:03:55 +0000
From: Oleg Verych <olecom@...wer.upol.cz>
To: Rob Landley <rob@...dley.net>, Andrew Morton <akpm@...l.org>
Cc: Sam Ravnborg <sam@...nborg.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [rft] (g)awk substitution (Re: [PATCH] sed s/gawk/awk/scripts/gen_init_ramfs.sh)
> On Tuesday 23 January 2007 7:49 pm, Andrew Morton wrote:
>> If the kernel is being compiled on a non-Linux system (eg: legacy Unix)
>> then it is, I guess, possible for `awk' and `gawk' to offer different
>> features. If the kernel's use of gawk uses GNU extensions then this patch
>> might break things on such a system.
>>
>> I guess we'll find out...
OK, this is what (g) awk is needed for:
,-*- diff: shell script -*-
| local maj=$(LC_ALL=C ls -l "${location}" | \
| - gawk
|'{sub(/,/, "", $5); print $5}')
|+ awk '{sub(/,/, "", $5); print
|$5}')
| local min=$(LC_ALL=C ls -l "${location}" | \
| - gawk
|'{print $6}')
|+ awk '{print $6}')
|
| if [ -b "${location}" ]; then
| dev_type="b"
| @@ -134,7
|+134,7 @@
| ;;
| "slink")
| local
|target=$(LC_ALL=C ls -l "${location}" | \
|- gawk '{print $11}')
|+ awk '{print $11}')
`-*-
Let me propose you to test this as solution, that need no awk, only shell:
-*- sh -*-
#/bin/sh
# usage: $0 node symlink
nod=$1
sym=$2
pos_param() {
set -- $@
shift $1
echo $1
}
location=${nod}
maj=`pos_param 5 $(LC_ALL=C ls -l "${location}")`
maj=${maj%,}
min=`pos_param 6 $(LC_ALL=C ls -l "${location}")`
echo "maj min:" $maj $min
location=${sym}
target=`pos_param 11 $(LC_ALL=C ls -l "${location}")`
echo "symlink target:" ${target}
-*- Result of testcase -*-
olecom@...wer:/tmp$ ./awkless.sh /dev/null null
maj min: 1 3
symlink target: /dev/null
olecom@...wer:/tmp$
olecom@...wer:/tmp$
-*-
p.s. who is going to make alternative to GNU make ? ;D
---
-o--=O`C info emacs : not found /. .\ ( is there any reason to live? )
#oo'L O info make : not found o (R.I.P. Debian Operating System)
<___=E M man gcc : not found .-- ( TNX, RMS. )
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists