SpegooterCode
SpegooterCode

Reputation: 83

syntax error near unexpected token `else' on Windows bash, but not on Ubuntu

I made and tested this bash script on an ubuntu machine at my school and then I came home to use it on the windows 10 Bash and I am getting these errors:

./newflask.sh: line 8: syntax error near unexpected token `else'
'/newflask.sh: line 8: `    else

Here is the code:

 #!/bin/bash

if [ $# -eq 0 ]; then
      echo "No arguments supplied"
else
    if [ -d $1 ]; then
    echo "Directory exists"
    else 
        mkdir $1
        cd $1
        touch $1.py
        mkdir templates
        mkdir static
        mkdir utils
        mkdir data
        cd utils
        touch __init__.py
        cd ..
    fi
fi

Thanks

Upvotes: 0

Views: 26

Answers (0)

Related Questions