One way to test for (non-)empty string is to use test and -z (-n) $ x=foo $ test -z “$x” $ echo $? 1 This is mostly seen with an if and [ -z … ] syntax $ y=bar $ if [ -n “$y” ]; then echo non-empty; fi non-empty Instead of a variable, it… Continue reading Testing for (non-)empty string in shell