Re: Please advise on bash programming tactics/strategy

2007-12-13 Thread cga2000
On Thu, Dec 13, 2007 at 12:38:06PM EST, Mike Stroyan wrote: > On Wed, Dec 12, 2007 at 06:49:25PM -0500, cga2000 wrote: [..] > > I provides exactly the output I need .. although bash must provide a > > more elegant (and less expensive) way to split a variable that contains > > two fields separated

Re: Please advise on bash programming tactics/strategy

2007-12-13 Thread Mike Stroyan
On Wed, Dec 12, 2007 at 06:49:25PM -0500, cga2000 wrote: > On Wed, Dec 12, 2007 at 12:31:47AM EST, Bob Proulx wrote: > > cga2000 wrote: > > > I was wondering if there is any way I can convince netstat to return > > > its output to bash variables for additional processing. > > > > Do you mean like

Re: Please advise on bash programming tactics/strategy

2007-12-12 Thread cga2000
On Wed, Dec 12, 2007 at 12:31:47AM EST, Bob Proulx wrote: > cga2000 wrote: > > I was wondering if there is any way I can convince netstat to return > > its output to bash variables for additional processing. > > Do you mean like this? > > rxcnt=$(netstat -ni | awk '/^eth0/{print$4}') Precise

Re: Please advise on bash programming tactics/strategy

2007-12-11 Thread Bob Proulx
cga2000 wrote: > I was wondering if there is any way I can convince netstat to return > its output to bash variables for additional processing. Do you mean like this? rxcnt=$(netstat -ni | awk '/^eth0/{print$4}') > Pretty simple logic: > > Do forever: > > Call netstat to obtain RX & TX b

Please advise on bash programming tactics/strategy

2007-12-11 Thread cga2000
I was wondering if there is any way I can convince netstat to return its output to bash variables for additional processing. Pretty simple logic: Do forever: Call netstat to obtain RX & TX byte counts for eth0 Print delta {current .. minus previous .. byte counts} Save current byte counts