Everytime I run this script, it prints 0 and then aborts with the error
./hw4_1: line 6: syntax error near unexpected token `let'
./hw4_1: line 6: ` let COUNTER=0'
Source:
#!/bin/bash
COUNTER=0
echo $COUNTER
for i in {$@:2}do
let COUNTER=0
while [COUNTER -ne $1]; do
echo "$i"
let COUNTER+=1
done;
done
exit
I've tried getting rid of let and adding a dollar sign before COUNTER, but no combination of those things work... This bash syntax is killing me. Changing 'let COUNTER=0' to COUNTER=0 just returns the error
./hw4_1: line 6: syntax error near unexpected token `let'
./hw4_1: line 6: ` let COUNTER=0'