[Gllug] Bourne shell programming

Tethys sta296 at astradyne.co.uk
Sun Nov 19 14:27:06 UTC 2006


Mike Brodbelt writes:

>I ended up last night using temp files, but I've found a route today
>which I'm happier with for this particular script, which was to do it like:-
>
>output=`grep root /etc/passwd | awk -F: '{print $1,$2,$3}'`
>for line in $output
>do
>	stuff
>done

FWIW, that may work in this particular instance, but will fail in
the general case if any of your fields contain whitespace.

>I don't do a lot of shell, and it always seems painful :-)

Heh... I'm much the same with perl :-)

Tet
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list