if [[ "$PROXY_URL"==https* ]]; then
echo "Woohoo"
else
echo "Woohoo"
fi
Running $PROXY_URL = "https://yolo" ; ./proxyEnv.sh
gives me output of:
bash: =: command not found
Woohoo
What does the "bash: =: command not found" refer to?
if [[ "$PROXY_URL"==https* ]]; then
echo "Woohoo"
else
echo "Woohoo"
fi
Running $PROXY_URL = "https://yolo" ; ./proxyEnv.sh
gives me output of:
bash: =: command not found
Woohoo
What does the "bash: =: command not found" refer to?
Your string comparison should have spaces around the comparator:
if [[ "$PROXY_URL" == https* ]]; then
echo "Woohoo https"
else
echo "Woohoo no https"
fi
Also, that's not how you pass environment variables to bash scripts. You have two options:
PROXY_URL="https://yolo" ./proxyEnv.sh
or
export PROXY_URL="https://yolo"; ./proxyEnv.sh
The first option assigns (without the $
) the value to the symbol and then uses that environment for the script (without the ;
separating them). It only exists for the script.
The second option exports that symbol to the current environment, which the script inherits.