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.

Required fields*

4
  • 6
    [ -z $1 ] would return true for an empty $1 as you forgot to quote $1, so it would become [ -z ] which tests that the -z string is non-empty Commented Aug 14, 2018 at 14:50
  • @StéphaneChazelas what is the diff between "" and not using it? Using it means that there is always two chars, so not empty? Commented Apr 13, 2022 at 18:30
  • Check the top answer to see the exit code used for error. Moreover, you should explain the tilde as I do not see it often in bash. Commented Apr 13, 2022 at 18:44
  • @Timo, see for instance When is double-quoting necessary? Commented Apr 15, 2022 at 18:01