I am very confused as to why I get syntax errors when attempting to run scripts such as the one contained in the answer below:

How do I download PDFs from PubMed, given their IDs?

Am I not supposed to run scripts like this in Python? Where can I run it if not?

  • maybe a better link: unix.stackexchange.com/q/100927/117549 -- also, you're aware that the first line of the file is: #!/usr/bin/env bash ?
    – Jeff Schaller
    Jun 21, 2016 at 16:51
  • Doesn't that mean I just have to run this script in Linux? Or is the env file unique for everyone's system? Sorry, I'm very inexperienced with all of this. Jun 21, 2016 at 16:53
  • 1
    It's a bash script, not a python script.
    – jordanm
    Jun 21, 2016 at 17:06
  • You should show us how you're running the script; then we can show you what's wrong or where exactly the misunderstanding is.
    – Jeff Schaller
    Jun 21, 2016 at 17:55
  • @jordanm that was my issue thanks. I just didn't understand why python wouldn't run the script, which was a general misunderstanding that was hard to put into words. Jun 21, 2016 at 18:05

1 Answer 1


Because they are not Python scripts. That's a bash script, as you can see in the first line (#!/usr/bin/env bash).

To run that script just save it to a file, give it executable permissions and open it or just run bash /path/to/script in the Terminal.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .