I have a simple bash script written on a WSL Ubuntu system; it runs perfectly there. I then git push
it up to github, and go to a different systems WSL Ubuntu and git clone
the project, cd into that folder and run the script, but it is broken with the below errors.
I tried dos2unix
on it, but this does not work, same errors and same broken state. Do you have some suggestions about what might be causing this (something is changed by storing it in github I guess), and how to fix (as before, none of the below errors are seen on the originating WSL Ubuntu system, where the script runs perfectly)?
: command not found
: command not found
: command not found
: invalid shell option name
: command not found
: command not found
-bash: .custom: line 147: syntax error near unexpected token `$'{\r''
'bash: .custom: line 147: `fnheader() {
CodePudding user response:
I had the same problem with Windows line endings, so my solution was:
# Remove cloned repo
git config --global core.autocrlf input
# Clone again the repo
Let me know if it works for you too.
Regards.