|
| From: | John Kearney |
| Subject: | Re: [Help-bash] Smart way to override nocaseglob for a single glob? |
| Date: | Thu, 07 Mar 2013 05:41:08 +0100 |
| User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 |
|
Am 04.03.2013 06:02, schrieb Dan
Douglas:
Not sure if you want this on the command line or in scripts.On Monday, March 04, 2013 01:38:57 AM Marcel Partap wrote: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 if its in scripts maybe you should do it the other way around. i.e. just not use nocaseglob, it is also be more portable. *.[jJ][pP][gG] if its for the command line, can't think of any generic bash solution i like I'd probably just use use find instead. findĀ -maxdepth 1 -name '*.jpg' findĀ -maxdepth 1 -iname '*.jpg'Ā Ā # ignore case findĀ -maxdepth 1 -name '[[:upper:]][[:upper:]]*.jpg' |
| [Prev in Thread] | Current Thread | [Next in Thread] |