#!/bin/bash
x=1
while [ "$x" -lt 20 ]
do
echo "$x"
x=("$x" * 5);
done
Getting error as syntax error near unexpected token `done' and getting output as 11111111111....
#!/bin/bash
x=1
while [ "$x" -lt 20 ]
do
echo "$x"
x=("$x" * 5);
done
Getting error as syntax error near unexpected token `done' and getting output as 11111111111....
Use the right syntax for the calculation:
x=$((x*5))
echo "$x"
while [ $x -lt 20 ] do x=$(( x*5 )); echo "$x" (( x++ )) done The output I'm getting is 1 5 30 155.
– raju kiran Mar 26 '20 at 15:03
x=(...)
is an array assignment – ilkkachu Mar 24 '20 at 12:14