I've a bash script that I run on Debian 11 and it worked just fine, I must move it to Ubuntu Server (probably 22.04) and now it stopped working. My script below:
BRANCHES=("master" "develop")
for BRANCH in "${BRANCHES[*]}"
do
echo Building $BRANCH
git checkout "$BRANCH"
#Code doing tasks
done
Tried also "${BRANCHES[@]}"
It gives me output:
Building ("master" "develop")
error: pathspec '("master" "develop")' did not match any file(s) known to git
I don't understand why it works fine on Debian but doesn't work on Ubuntu. My guess was that it's not executed in bash (but I've #!/bin/bash +x on top of the script).
AFAIK I cannot easy check it, because I execute this script via Jenkins shell execution and do not have SSH access to the server.