fish shell. How to check if a variable is set/empty?
set -q var (note the missing “$” – this uses the variable name) can be used to check if a variable has been set. set -q var[1] can be used to check whether the first element of a variable has been assigned (i.e. whether it is non-empty as a list). test -n “$var” [fn0] (or … Read more