Shell script in terminal not working

I’m trying to set up HA to push updates to my Github repository. I’ve got the repo initialized, and can execute commands on the terminal command line successfully to push updates to Github. I’ve now attempted to create an executable shell script with the same commands, but the script simply does not work. I"m sure there’s a simple answer to this, but I’m stumped.

Here’s a snapshot of where I executed individual commands on the terminal command line successfully, and the error I get when trying to run those same commands in a shell script:

here’s the script I’m attempting to execute:
gitupdates script

It seems to not like either the cd command and doesn’t seem to know the path to do the git add if I’m understanding correctly. Seems it’s either a path or access issue - have tried full path - /config/gitupdates.sh and /root/config/gitupdates.sh, but get the same results - not working

I’ve tried following a few of the tutorials out there - all seem to pretty much say the same thing and I believe I’ve followed them closely, but can’t get this to work.

This is also a snapshot of my git config in case there’s a question about that:

Any help would be appreciated.

That’s because you are already in the config subdirectory. Is this what you want: “cd /config” ?

Normally shell script files start with the following line. Not sure if it makes any difference in your case though.

#!/bin/sh
...

Just to close this out and in case it helps anyone else, it was a silly error. When I created the shell script, I was using a computer and editor I normally don’t use. It ended up being an issue with Windows vs Unix line feeds. After switching the Windows CRLF to Unix LF, my script is now working…

1 Like