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*

3
  • This is almost excellent - but, as yet, it does not answer the question as asked. It currently can tell you the difference between an unset or empty shell variable and one which contains only spaces. If you will accept my suggestion you will add the param expansion form not yet convered by any other answer that explicitly tests a shell variable for being set - I mean ${var?not set} - passing that test and surviving would ensure that a variable matched by your *) case would effect a definitive answer, for example. Commented Jul 29, 2014 at 2:06
  • Correction - this, in fact, would answer the question originally asked, but it has since been edited in such a way that it fundamentally changes the meaning of the question and therefore invalidates your answer. Commented Jul 29, 2014 at 4:09
  • You need [[ $param = *[!\ ]* ]] in mksh. Commented Jul 30, 2014 at 6:01