#!/bin/bash if [[ -n "$MYVAR" ]]; then exit; fi # otherwise the rest of the script continues...
I'm trying to exit out of a shell script if a certain ENV variable is 0. The script above does not seem to work (I've also tried using
return instead of
Can someone explain how this would be done, or what's wrong with the line above?
When I type that in my terminal (replacing exit with
echo "YES" it works just fine.