Hello please help me :)
by Crusty from LinuxQuestions.org on (#6GYRA)
#!/bin/bash
echo enter a number
read n
count=0
while[$n=!0]
do
count=$((count+1))
n=$((n/10))
done
echo number of digits = $count
This is my code for counting the number of digit in a number but it doesn't coz the terminal says
enter a number
23
./countdigits.sh: line 6: while[23=!0]: command not found
./countdigits.sh: line 7: syntax error near unexpected token `do'
./countdigits.sh: line 7: `do'
I updated the software but the error is still there :(
echo enter a number
read n
count=0
while[$n=!0]
do
count=$((count+1))
n=$((n/10))
done
echo number of digits = $count
This is my code for counting the number of digit in a number but it doesn't coz the terminal says
enter a number
23
./countdigits.sh: line 6: while[23=!0]: command not found
./countdigits.sh: line 7: syntax error near unexpected token `do'
./countdigits.sh: line 7: `do'
I updated the software but the error is still there :(