I have shell script with certain commands being executed on alpine docker image.
currently, it uses /bin/sh
shell to execute all commands.
the issue is , in the script, there is while loop which has counter. below code
i=0
cnt=15
while [ "$a" == "b" ] && [ "$i" == 15 ]
do
echo " Waiting for ..."
sleep 2s
((i=i+1))
((cnt=cnt-1))
done
issue is on the line ((cnt=cnt-1))
, getting following error
sh: was: unknown operand /bin/sh: exit: line 178: Illegal number: -1
I was thinking of moving from /bin/sh to /bin/bash , can this be solution. if yes , how I can set the default shell as bash before executing the script. OR using the current shell only , how to resolve this counter issue.
please suggest
EDIT 1
the output of : ls -l /bin/sh
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 12 Nov 12 09:18 /bin/sh -> /bin/busybox