counting in unix

my script:
count=0while test $count -lt 10do#do something for 0,1,2...9 count=$(($count+1))doneIt doesnt work. Can anyone tell me what im doing wrong?? thanks

Please use indentation in your code and use code tags.
To do this, select the code with the mouse and click on # above the edit box.

Regards

count=0
while test $count -lt 10
do
#do something for 0,1,2...9
  count=$(($count+1))
done

Dont use $count. use only count like
count=$((count + 1)).

Hi,
What is it that doesn't work? What did You expect it to do?
If i do

count=0
while test $count -lt 10
do
echo $count
count=$(($count+1))
done

i get

0
1
2
3

and so on. It works. The comment "#do something for 0,1,2...9" doesn't actually do anything so what You have is loop that start and finishes...

/Lakris

EDIT: Sorry forgot to mention that I use bash but I tried in ksh as well and it works the same.

i get a blank screen

Ok, so I ask again, what did You expect it to do?
It is a loop that counts from 0 to 9 but it doesn't actually do anything, You haven't done any visible actions based on, for example, the count. So it shouldn't show anything.
Have You tried my modified code? Maybe that can give You an idea?

/Lakris

I want it to display the numbers while it counts

Let me make myself more clear.
i want it to pop up one number at a time
then erase that number and go to the next

you mean like this??

while test $count -lt 10 ;do
clear
echo $count
sleep 1
count=$((count+1))
done

count=$((count+1)) ==> will anyone explain how it works as we are not using $count inside expression...

like a slideshow of numbers 1-10