I have exported a environment variable in my .zshrc and I want to update it from a script in /bin/script.sh
#!/bin/sh
if [ $TOGGLE -eq 1 ]; then
echo a;
else
echo b;
fi
TOGGLE=$((TOGGLE * -1));
but after the run the script the value of TOGGLE is unchanged in the session where I run the script on.
how can I force it to change
zshis notbashjfyi.source .../script.sh(but I hope you don't really have it stored in/bin, as your question implies), you should see the variable TOGGLE. Aside from this, it is not an environment variable, and you did not export something in any way.