This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.
Last Updated: 2023-03-28
Say you have the env variable
$SKIP_CI_VERIFICATION. How do you switch on that in your bash script?
There are two basics tests that are relevant:
-ntests if "not empty"
if [[ -n $SKIP_CI_VERIFICATION ]]; then echo "it is set"
-ztests the opposite (i.e. if empty)
if [[ -z $SKIP_CI_VERIFICATION ]]; then echo "it is NOT set"