Loop variable error in for loop
for(( i = 0; i<=5; i++))
is Bash specific and doesn't work with plain Bourne shell (/bin/sh
).
If you remove the shebang the script is run by your current shell (which likely is Bash) so it works.
Replace #!/bin/sh
with #!/bin/bash
to make the shebang work.
for(( i = 0; i<=5; i++))
for this type of loop only runs on Bash shell. so, if you want to run this, then try this command :
$bash filename.sh
I think It will work fine. and see this one also.