lkml.org 
[lkml]   [2009]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/3]: Replace kernel/timeconst.pl with kernel/timeconst.sh
Date
On Saturday 03 January 2009 23:07:55 Valdis.Kletnieks@vt.edu 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


\
 
 \ /
  Last update: 2009-01-04 07:45    [from the cache]
©2003-2011 Jasper Spaans