Re: GLOBIGNORE documentation
2016-03-07 08:58:05 +0100, Isabella Parakiss: [...] > OTOH this is arguably more useful than its ksh equivalent: > GLOBIGNORE=-*; some-cmd *; some-cmd ./* [...] True, that's probably the one case where the GLOBIGNORE behaviour is actually useful. Note that with ksh93, you've got to write it: FIGNORE='@(.|..|-*)' That is, you need to exclude "." and ".." manually. -- Stephane
Re: GLOBIGNORE documentation
On Sun, Mar 06, 2016 at 10:16:58PM +, Stephane Chazelas wrote: > Today, I realised that GLOBIGNORE doesn't work at all like ksh's > FIGNORE. > > With > > GLOBIGNORE=x* > > we're not filtering out files whose *name* starts with "x" from > globs but those whose *path* starts with "x". > > In > > echo * > > files whose name starts with "x" will be excluded, but not in > > echo ./* > OTOH this is arguably more useful than its ksh equivalent: GLOBIGNORE=-*; some-cmd *; some-cmd ./* --- xoxo iza
GLOBIGNORE documentation
Today, I realised that GLOBIGNORE doesn't work at all like ksh's FIGNORE. With GLOBIGNORE=x* we're not filtering out files whose *name* starts with "x" from globs but those whose *path* starts with "x". In echo * files whose name starts with "x" will be excluded, but not in echo ./* I think the documentation should be clarified, because at the moment it implies GLOBIGNORE applies to file names (like for ksh's FIGNORE), not file paths. Where it becomes borderline a bug is about "." and "..". The doc says they're always excluded when GLOBIGNORE is non-empty. That's true for */* or .* for instance, but not for ./.* or .*/x for instance. $ bash -c 'GLOBIGNORE=x*; echo .*' .* $ bash -c 'GLOBIGNORE=x*; echo ./.*' ./. ./.. $ bash -c 'GLOBIGNORE=x*; echo .*/a' ./a ../a To truely exclude . and .., one needs: shopt -s extglob GLOBIGNORE='?(*/)@(.|..)' -- Stephane
Re: GLOBIGNORE documentation
2016-03-06 22:16:58 +, Stephane Chazelas: [...] > $ bash -c 'GLOBIGNORE=x*; echo .*' > .* > $ bash -c 'GLOBIGNORE=x*; echo ./.*' > ./. ./.. > $ bash -c 'GLOBIGNORE=x*; echo .*/a' > ./a ../a > > To truely exclude . and .., one needs: > > shopt -s extglob > GLOBIGNORE='?(*/)@(.|..)' [...] That's not enough, that would fail to exclude . and .. in .*/file (and also breaks */. globs) GLOBIGNORE='?(*/)@(.|..)?(/*)' would break (common) ./* globs. So, it looks like it's not possible to get the same behaviour as in zsh/mksh/pdksh/fish/Forsyth shell (or ksh93 with FIGNORE='@(.|..)') with GLOBIGNORE after all. -- Stephane