Skip to main content
edited tags
Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Source Link

Bash For loop not working

I am trying to execute this simple bash script but I am getting a syntax error. I followed this simple documentation here https://www.cyberciti.biz/faq/bash-for-loop/ but no luck. I am not sure what am I doing wrong?

#!/bin/bash
for i in 1 2 3 4 5
do
    echo "Count $i"
done;

error:

setup.sh: 3: setup.sh: Syntax error: word unexpected (expecting "do")

I am executing that script from my Windows Subsystem Linux (WSL) here.