[Help-bash] Smart way to override nocaseglob for a single glob?
From:
Marcel Partap
Subject:
[Help-bash] Smart way to override nocaseglob for a single glob?
Date:
Mon, 04 Mar 2013 01:38:57 +0100
User-agent:
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130112 Icedove/17.0.2
Dear folks,
because of the improvement it gives when working in mixed case
environments (f.e. when working with digital photos from FAT volumes -
often the extension might be uppercase - *.jpg will not match these
without nocaseglob) I have the flag universally enabled. But every now
and then, I checkout some software repository and would like to have a
gaze at the docs, historically uppercase text files in the project's
root directory like README, INSTALL, NEWS, TODO..
However, with nocaseglob enabled, the expedient "ls
[[:upper:]][[:upper:]]*" returns *nothing*. Looking at the source I
figured out the reason seems to be bash setting the REG_ICASE flag,
which makes sense. The response of the regex function to completly drop
the [:upper:] character class is unexpected behaviour for me, but hardly
a bug.
Can anyone come up with something more elegant then f.e.
( shopt -u nocaseglob; ls -d /usr/src/repositories/*/[[:upper:]][[:upper:]]* );
shopt nocaseglob
?
Not that the issue can't be worked around, but^^
#Regards!Marcel