Help Understanding While Loop
Will Maier
willmaier at ml1.net
Fri Oct 14 15:13:38 PDT 2005
On Fri, Oct 14, 2005 at 02:48:19PM -0700, Drew Tomlinson wrote:
> OK, I've been working on an sh script and I'm almost there. In
> the script, I created a 'while read' loop that is doing what I
> want. Now I want to keep track of how many times the loop
> executes. Thus I included this line between the 'while read' and
> 'done' statements:
> count = $(( count + 1 ))
^^^
You're missing something here ;)
$ count=1
$ echo $count
1
$ count = $(( $count +1 )) # note: 'count ='
count: not found
$ ^[[A^C
$ count=$(( $count + 1 )) # note: 'count='
$ echo $count
2
--
o--------------------------{ Will Maier }--------------------------o
| jabber:..wcmaier at jabber.ccc.de | email:..........wcmaier at ml1.net |
| \.........wcmaier at cae.wisc.edu | \..........wcmaier at cae.wisc.edu |
*------------------[ BSD Unix: Live Free or Die ]------------------*
More information about the freebsd-questions
mailing list