I want to convert following bash code in pure shell script (sh) language so that it should run by other script language mode i.e dash script.
arguments=("$@")
for (( i=0; i<$#; i++ )); do
case "${arguments[$i]}" in
-foo)
let "i = i + 1"
echo "${arguments[$i]}"
;;
*)
break
esac
done
above code finely run in bash mode but through an error on dash mode.
2: ./orig.sh: Syntax error: "(" unexpected
Now If I change line 2 to get rid the error as following line
arguments="$@"
But now I got another error about loop
3: ./orig.sh: Syntax error: Bad for loop variable