Set bash's shell option nullglob by default?

Roman Rakus rrakus at redhat.com
Fri Jul 13 12:29:42 UTC 2012


On 07/13/2012 02:19 PM, Tomas Mraz wrote:
> This could cause serious surprising breakages of scripts with strange
> consequences. I'm strictly against this change. If something at all
> should be changed in this regard to break bad habits then it should be
> the failglob option although I am not convinced that it is too good idea
> either.
I was thinking about failglob also, but it is not that useful like it looks.

for name in *; do ...; done

In the current state, if there isn't any file, the name variable will 
contain *.
With nullglob name will be empty and script continues after the for loop.
With failglob it will print error message. I think it is not useful.

But you are right, it will cause many breakages (even surprising).

RR


More information about the devel mailing list