I have a function defined as follows in my zshrc
function k8sapi() {
PREFIX='https://STABLE_URL'
if [ "$1" == "prod" ];
then
PREFIX='https://PROD_URL'
fi
echo "1 --> $1"
echo "2 --> $2"
curl -s "${PREFIX}/${2}"
}
When I run this:
$ k8sapi stable foo
k8sapi:2: = not found
What am I doing wrong? How do I look at arguments to a function in zsh?
These functions were copied over from my old laptop using bash shell, so I am trying to migrate them to zsh.
=
is an expansion. Try runningecho =mkdir
. This answer explains whyzsh
fails to use==
. (you can quoting"=="
and it will work) – Edgar Magallon Sep 30 '22 at 23:46