Re: [PATCH 1/3]: Replace kernel/timeconst.pl with kernel/timeconst.sh

From: Rob Landley
Date: Sun Jan 04 2009 - 01:44:48 EST


On Saturday 03 January 2009 23:07:55 Valdis.Kletnieks@xxxxxx wrote:
> On Sat, 03 Jan 2009 19:36:04 CST, Rob Landley said:
> > On Saturday 03 January 2009 06:28:22 Ingo Oeser wrote:
> > > > +for i in "MSEC 1000" "USEC 1000000"
> > > > +do
> > > > + NAME=$(echo $i | awk '{print $1}')
> > >
> > > cut -d' ' -f1 does the same
> > >
> > > > + PERIOD=$(echo $i | awk '{print $2}')
> > >
> > > cut -d' ' -f2 does the same
>
> Close, but no cee-gar. cut does something counter-intuitive with multiple
> blanks:

Yes, but in this case I'm the one passing in the data so I know there aren't
multiple blanks. (Or tabs instead of spaces.)

In a private email, Bernd Petrovitsch suggested "set -- $i" and then using
NAME=$1; PERIOD=$2. (I keep getting private email responses to these sort of
threads, and then getting dismissed as the only one who cares about the issue.
Less so this time around, but still...) This apparently works all the way
back to the bourne shell. Not worth rolling another patch for, but if I do
wind up rolling another patch for other reasons I might switch over to that.
Both "cut" and "awk" are susv3, though.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/