Emotional_Goose
Emotional_Goose

Reputation: 167

shell for loop un expected token MAC terminal

getting a unexpected token error, no idea why tried pretty much everything.

bash version `3.2.57(1)-release`

Count=31;
for (( i=1 ; i<=$Count ; i++ ))
do
 echo $i
done

'/script.sh: line 3: syntax error near unexpected token `
'/script.sh: line 3: `for (( i=1 ; i<=$Count ; i++ ))

Upvotes: 0

Views: 252

Answers (1)

Cyrus
Cyrus

Reputation: 88829

Remove carriage returns from your script:

sed -i '' 's/\r$//' file.sh

Update:

sed -i '' $'s/\r//' file.sh

Upvotes: 1

Related Questions