Shell scripts: variable assignment within read loops

Polytropon freebsd at edvax.de
Mon Aug 18 12:33:08 UTC 2008


As I thought while reading your message, awk seems to be
a good solution. Just a note:

On Mon, 18 Aug 2008 06:29:03 +0300, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> Would you
> be ok with an awk(1) script instead of /bin/sh?  It tends to be nicer
> for this sort of thing, i.e.:
> 
> [...]
> $ netstat -nibd -f inet | awk -f david.awk

You could start your awk skript with

	#!/usr/bin/awk

and give it +x attribute, as well as adding the desired source
command "netstat -nibd -f inet" to the script, using awk's system()
function, so you can start it more easily or use it in combination
with other commands.

	% ./netstuff.awk


-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list