Issue
I'm writing a script in bash and I get this error for deployment into my ec2:
And this is my code:
# !/bin/bash
#Get servers list
set -f
string=$QA_DEPLOY_SERVER
array=(${string//,/ })
#Iterate servers for deploy and pull last commit
for i in “${!array[@]}”; do
echo “Deploy project on server ${array[i]}”
ssh ubuntu@${array[i]} "cd /opt/bau && git pull origin master"
done
What is wrong with the script and how do I fix it? Many Thanks.
Solution
Thank you @BenjaminW
I had to change "smart quotes" which were causing the issue in my script. Changing from “”
to ""
fixed the issue.
Below is my updated script
for i in "${!array[@]}"; do
echo "Deploy project on server ${array[i]}"
ssh ubuntu@${array[i]} "cd /opt/bau && git pull origin master"
done
Answered By - Bilal Yousaf