running bash scripts on RStudio cloud

I wrote a bash script that I want to use to set up git on my projects.
I made the script executable, but when I try to run it on the terminal in RStudio cloud I get the error:

bash: ./setup_git.sh: bin/bash: bad interpreter: No such file or directory

If I look in /bin I can find bash, so I am not sure why it doesn't work.
Any suggestions?

My script is

#!bin/bash

git config --global user.email "myemail"
git config --global user.name "myusername"
git config --global credential.helper 'cache --timeout 3600'

git config --global --list

I think you need to change the first line to:

#!/bin/bash.

Note the beginning slash.

3 Likes

Thanks for pointing that out!