[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bourn Shell Script While Loop Problems

Martin McCormick wrote:
"Roberto C. Sanchez" writes:
Why not just use wc and sed?

	A good idea and also a good idea from Rick Pasotto <rick@niof.net>
to use head -n -6.  There is, however, a problem with that last
suggestion in that the script is actually being run on a FreeBSD
system and FreeBSD's version of head does not support the -n flag.
Both Debian and FreeBSD, however, had the same problem with the loop.

	The function gets called with a bunch of values passed as
arguments instead of getting one value per run.

	When I use sh -x scriptname, the output doesn't look like a
normal loop.

	Thanks for any more ideas.

I don't know how to fix the awk problem, but instead of:

zlength=`wc -l $zonename|awk '{print $1}'`

you could try:

zlength='wc -l $zonename|(read len fname; echo $len;)'

Martin McCormick WB5AGZ Stillwater, OK OSU Information Technology Division Network Operations Group

Reply to: