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*

2
  • 2
    If you intend to use bash, you should use [[, not [. Only use [ if you are scripting for POSIX sh. The Bash FAQ 31 explains the difference from [ and test. [[ is much safer and more powerful. It's also part of bash syntax, whereas [ is a command and not syntax, so bash -n can't tell the difference between [ invalid arg and echo invalid arg. Commented Jul 2, 2012 at 15:35
  • 1
    I've incorrectly labeled my question. I'm using sh. Thank you. Commented Jul 2, 2012 at 15:40