On Fri, May 31, 2019 at 3:16 AM Stephane Chazelas wrote:
> To me, it makes sense to treat a failing glob the same way as a
> syntax error. There's no general safe way to handle it. If the
> script author has not taken steps to handle the case (like by
> using (N)/nullglob, or "always" block), the safest thing to do
> is probably to exit.
I think you (and Zsh devs) and I just have a fundamental difference of opinion
on this. I noticed you gave several examples with Shell, which makes sense
because this is a Shell thread.
But you didnt really follow the Python example to conclusion. With Python (and
most major programming languages) syntax is available to do something like this:
import glob
aa = glob.glob('*')
if len(aa):
print('found stuff')
else:
print('no matches')
While again with Zsh it just utterly fails and stops execution. To me thats
wrong and it would be hard to convince me otherwise. Its so easy and graceful
and with a normal language you get an array. If the array is empty then nothing
was found.
As ugly an non-robust as the POSIX example is, its still closer in that regard
than Zsh.