On 2019/06/08 03:10, Stephane CHAZELAS wrote: > I beleive Joerg meant that we need a way to *ensure* that the > shell excludes "." and ".." from glob expansions. > > Otherwise: > > chmod a-x .* > > Could still be unsafe if we don't know the version of the > standard the shell is conforming to. > Writing code like that seems to be inviting undefined behavior.
I'd always chmod a-x .[^.]* > That would mean chmod would not be run, but that means the > script would fail which is not better. > > Which is why we've argued here it was not really a solution to > the problem. > Why look to shell options when you can protect yourself with fewer characters by using the right glob expression? Using some behavior that involves new options will always be a worse choice because you never know if you are running on some older shell. That's true with anything that forces some new behavior different from what it was in the past, (which has, _unfortunately_, happened, despite belief to the contrary). It basically 'kills' a command or features's usage as you can't rely on it being there and you can't rely on it not being there, which is thoughtless at best, and destructive if a random workaround is not done right or is broken (for which they would blame the script writer who wouldn't have had to do anything had it not been changed).