Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    See: Test for non-zero length string in Bash on StackOverflow. Commented Jun 10, 2019 at 21:36
  • 2
    In Bash, [[ -v VAR]] is to check if VAR is defined, [[ -z $VAR ]] is to check if "$VAR" is expanded to null string (""). Thus, you can use [[ -v VAR && -z $VAR ]]. read more here (with official reference)
    – Sang
    Commented Nov 17, 2019 at 7:42
  • related: [[ vs [
    – djvg
    Commented Jun 7 at 11:56