I often set the nullglob option in scripts, because it makes the handling of globs which don't match anything a bit more predictable:<p><a href="http://bash.cumulonim.biz/NullGlob.html" rel="nofollow">http://bash.cumulonim.biz/NullGlob.html</a><p>There's a note at the end about how with nullglob set, ls on a glob with no matches does something surprising. This is a great illustration of how an empty list and the absence of a list are different. Sadly it's rather hard to make that distinction in shells!<p>I do wish that either shells had a more explicit syntax for globbing, or other commands didn't use the same syntax for patterns. Then confusion like this couldn't occur. An example of the former would be if you had to write:<p><pre><code> ls $(glob *.txt)
</code></pre>
Here, the shell would not treat * specially, but rather you would have to explicitly expand it. This would be a pain, but at least you wouldn't do it by mistake!