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

Re: simple bash loop problem ...



On Sat, Jun 28, 2003 at 03:03:27PM +0100, David selby wrote:
> I am writing bash a bash & sed script, it has been going suprisingly 
> well. I need a loop to count 9 times & the variable n to the count ..
[...] 
> My best guess is
> 
> declare -i n=1
> while [ $n < 9 ]; do
> .....
> n=$((n+=1))
> done
> 
> All i get is ...
> 
> web@debian:/usr/local/myfiles/dave/websites/kcards$ ./gensite
> ./gensite: 9: No such file or directory
> 
> I have defined it as an integer, used the less than operator for 
> integers, ... errr ... I know its something stupid but I can't crack it ....

Why didn't you just use for?  You could do:

  for ((n=0; n<9; n++))
  do
  ...
  done

-- 
Seneca
seneca-cunningham@rogers.com

Attachment: pgpDZg_Vv_X1E.pgp
Description: PGP signature


Reply to: