i havnt put space in while loop.Then i put the brackets as you told.
count=0
max=10
while [$count -lt $max]
do
echo $count
echo count=$((count+1))" "
done
echo "value of count:$count"
"whiletest.sh" 8 lines, 123 characters
Xpath->/home> sh whiletest.sh
whiletest.sh[3]: [0: not found.
value of count:0
The space should in between the test command i.e [ $count -lt $max ] and not like [$count -lt $max]. And the below expression does not work as its not the right syntax
echo count=$(count+1)" " # not correct
Try as suggested by Scrutinizer: count=$((count+1))" "
or try
count=0
max=10
while [ $count -lt $max ]
do
echo $count
let count=$count+1
done
echo "value of count:$count"