I’m running “Bash on Ubuntu on Windows” on Windows 10 since Cygwin wasn’t working. I’ve made an aws account and a user with administrative privileges. I have anaconda installed and it is part of my PATH, using Python 3. I also have Python 2 installed separately. I successfully ran “pip install awscli.” The “aws configure” command works, and I’m able to log in with the user and secret key credentials.
But then I tried running the “setup_p2.sh” script…
root@DESKTOP-ADR2SDQ:/mnt/c/Users/Richard# bash setup_p2.sh
setup_p2.sh: line 4: $’\r’: command not found
setup_p2.sh: line 9: syntax error near unexpected token
elif' 'etup_p2.sh: line 9:elif [ $region = “eu-west-1” ]; then
Someone else mentioned this problem here, but it doesn’t look like a solution was found. Just a recommendation to start over, which I did, and I have no idea if that did anything. I couldn’t even run the “rm ~/.ssh/aws-key.pem” since that file didn’t exist.
In case it’s helpful, “which python” and “which pip” return these results…
$ which python
$ which pip
Anyone know what I should do?
I’m very new to bash and have been googling this issue for days to no avail. I’d also appreciate having good beginner resources for learning the how/why of bash. Like, where is “/mnt/c/Users/…” on my computer?
Had the same problem, its because of the End Of Line (EOL) characters that differs between Windows and Linux.
The following link explains how to auto-convert it using notepad++:
After doing so I was able to run setup_p2.sh and connect to aws server.
However I did not manage to run setup_t2.sh - running it did not raised any errors, but it did not do anything as well - please let me know if you could make it work.
When comparing setup_p2.sh and setup_t2.sh I’ve noticed that the setup_t2.sh file has ‘cat’ command in the first line, which does not appear in setup_p2.sh. After removing that command I was able to connect to a t2 instance.
In my case I am now stuck exactly at this point.
wget “http://files.fast.ai/files/setup_p2.sh” <==== This worked well.
bash setup_p2.sh <===
This gives following error
setup_p2.sh: line 7: syntax error near unexpected token
newline' setup_p2.sh: line 7:'
Thanks so much
setup_p2.sh: line 7: syntax error near unexpected token `newline’
The message means that maybe you download the .html file of “http://files.fast.ai/files/setup_p2.sh”, so it certainly can’t work.
You can try to download from this link by typing
And don’t forget to download another file setup_instance.sh, because it will be called by setup_p2.sh
Hope it will help you !