I often set the nullglob option in scripts, because it makes the handling of globs which don't match anything a bit more predictable:
http://bash.cumulonim.biz/NullGlob.html
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!
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:
ls $(glob *.txt)
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!So you get this:
oil$ find . -name *.jpg
find: missing argument to `-name'
oil$ find . -name '*.jpg'
(works)
Details: I had it on when you set 'shopt -s strict:all', but I neglected to turn it on for 'oil:basic' and 'oil:all'. Those are oil-specific option groups so you don't have to remember all the option names.But I just fixed that and it will be out with the next Oil release.
https://github.com/oilshell/oil/commit/ddac119254f9a7045dca7...
If anyone wants to add more strictness options to Oil to avoid these types of mistakes, let us know! (e.g. on https://github.com/oilshell/oil, or there's more contact info on the home page).