I am trying to run the following script on a OpenSuse machine:
OUR_REPO=$(git branch | grep "*" | awk '{print $2}')
THE_REPO_THAT_OURS_IS_BASED_ON="origin/$OUR_REPO"
GIT_COMMIT=$(git merge-base $OUR_REPO $THE_REPO_THAT_OURS_IS_BASED_ON)
echo "$OUR_REPO"
echo "$THE_REPO_THAT_OURS_IS_BASED_ON"
echo "$GIT_COMMIT"
and I get the following error:
fatal: Not a valid object name release/VERSION?
release/VERSION
origin/release/VERSION
The interesting part is that, if I am running each of those commands directly into the terminal everything works properly.
Also, if I am trying to run this script via my local machine with Fedora, I don't have any kind of issue.
The command that I use to run the script:
bash my_script.sh
On the OpenSuse machine, if has any importance, I am using zsh
.
Does any of you know what I am doing wrong?
line 8
. The\r
might mean that the script has DOS line endings which should be converted to UNIX line endings. Did you create the script with a Windows text editor?dos2unix
on the file to fix it.