[clug] easier way to use IFS in bash?
Michael James
clug at james.st
Tue Aug 10 02:06:31 GMT 2004
On Tue, 10 Aug 2004 11:21 am, Steven Hanley wrote:
> All
>
> Looking at using word splitting in bash, say I have a string and I
want to
> return the 1st word before a whitespace character or the third word or
> something.
Isn't that what "read" does?
Take this code from cloneboot that parses /etc/fstab
# Parse lines from fstab
# Note: lines are in this form:
# <device> <mount_point> <file_system_type> <options>
while read device mount type options
do
echo Device = $device
echo file_system_type = $type
done
--
Michael James michael.james at csiro.au
System Administrator voice: 02 6246 5040
CSIRO Bioinformatics Facility fax: 02 6246 5166
More information about the linux
mailing list