I have a my script.sh
file in my project root folder. I have give following urls in an array and checking in as below. I would like to run from my windows 10 > git bash $ ./script.sh dev
Throws following error : syntax error: operand expected (error token is "[dev]" Could someone please help to resolve the issue.
declare -A urls
urls[dev]=https://seltest-eu.example.com
urls[tst]=https://wildtest.example.com
if [[ "$urls"[dev]"" -eq "https://seltest-eu.example.com" ]];
then
echo "Running test site one"
request="$(curl ... https://"${urls["$1"]}"...)"
else
if [[ "$urls"[tst]"" -eq "https://wildtest.example.com" ]];
then
echo "Running test site two"
request="$(curl ... https://"${urls["$2"]}"...)"
else
echo "Nothing to run"
fi
fi