I'm getting the below error while i executing the bash script.
#!/bin/bash
mynum=1
while [ $mynum -le 10 ]
do
echo $mynum
mynum= $(( $mynum + 1 ))
sleep 0.5
done
error:
$./wl
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
1
./wl: line 8: 2: command not found
mynum=
and$(( $mynum + 1 ))
which is causing the shell to try to execute2
(the result of$(( $mynum + 1 ))
) as a separate command – steeldriver Mar 11 '17 at 21:02