I am running into an issue where I can run the following lines perfectly in Linux console but fail when they are contained (as shown) inside a .sh
file:
aws s3 cp s3://bucket/folder/ . --recursive
python Run.py
The first line of this takes all the files out of AWS S3 and places them in the current folder. The --recursive
flag grabs all files in the specified s3 bucket. The second line is a basic python script that comes from the S3 Bucket files and prints "hello world".
when I run it in the console, I am running the .sh
by:
chmod +x ./aws_script.sh
./aws_script.sh
The file fails with the error:
Unknown options: --recursive
python: can't open file 'Run.py': [Errno 2] No such file or directory
I have tried using #!/bin/bash
at the top of my .sh
script but it failed with the following error:
-bash: ./aws_script.sh: /bin/bash^M: bad interpreter: No such file or directory
I am fairly new to Linux and never used a .sh
before ( i assume it works just like a .bat file?), so I'm sure I am just missing something simple. Ideas?