Sam Odio
Sam Odio

Reputation: 3037

Basic bash script returns "invalid syntax"

Can't explain why this is happening. Here's the script:

#!/bin/bash
echo "Hello World"

Here's the terminal output:

$ python ./test.sh 
    File "./tellapart_mac_setup.sh", line 2
        echo "Hello World"
        ^
SyntaxError: invalid syntax

$ echo "hello world"
hello world

$ which bash
/bin/bash

$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.

Upvotes: 11

Views: 14352

Answers (1)

scrowler
scrowler

Reputation: 24406

Looks like you're parsing it with python, since it's not a python script - it of course will throw errors in python's compiler.

It's a bash script, so just use bash to process it:

./test.sh

Upvotes: 27

Related Questions