Bash conditionals: how to “and” expressions? (if [ ! -z $VAR && -e $VAR ])

I guess I’m not clear on how to do “and” tests. I wanted to make sure an argument existed which was working well with [ -e $VAR ], but it turns out that was also evaluating as true on an empty string; which I do not want.

How do I ‘and’ them together? Or is there another unary test that accomplishes what I want?

5 Answers
5

Leave a Comment