globbing in BashForum: Programming and Scripting Topic: globbing in Bash started by: mikshaw Posted by mikshaw on Sep. 15 2006,18:00
I think this is the most annoying thing I've run into with Bash, mainly because I try to use globbing fairly frequently and usually it doesn't work the same way as it does in other applications.Latest example is this renaming script. I made this because I often run this manually:
That's not fun or convenient, and the renaming scripts I've found so far are either not specific to my needs or they are much too complex for my taste (seems to be that way for an increasing number of applications). It also does not check for an existing file of the same name. So anyway, what I've had to do to find uppercase or mixed case filenames is *[ABCDEFGHIJKLMNOPQRSTUVWXYZ]* because for some reason Bash sees *[A-Z]* as *, or maybe as *[A-Za-z]*.
Posted by WDef on Sep. 15 2006,19:20
Hope this helps Mik, might point in the right direction. Apparently, globbing of eg [A-Z] is a locale-dependent thing. Different locale setting, different interpretation of [A-Z].
Perhaps [[:upper:]] will do it. From:< http://mail.nl.linux.org/linux-utf8/2001-05/msg00033.html > Phil Posted by mikshaw on Sep. 15 2006,23:02
I had tried [:upper:] with results that I couldn't explain...a few files were displayed, but i couldn't see the pattern to it.Using [[:upper:]] works. I wonder if I misread the Bash docs? Thank you! |