[Gllug] Changing case on filenames

Nix nix at esperi.demon.co.uk
Fri Mar 15 08:27:21 UTC 2002


On Sun, 10 Mar 2002, James Tullett spake:
> On Saturday 09 Mar 2002 18:11 pm, you wrote:
>> On Tue, 5 Mar 2002, Alain Williams said:
>> > 	do	newfile=$( echo "$file" | tr '[A-Z]' '[a-z]' )
>> > 		[[ $newfile = $file ]] && continue
>>
>> Note that these cases are very different. In [[ ]], the spaces around
>> the [[ and ]] elements are necessary; but in $( ) they are not, viz
>>
>> newfile=$(echo "$file" | tr '[A-Z]' '[a-z]')
>>
>> is perfectly valid.
> As are the Posix? character classes [:upper:], [:lower:] and friends.

In fact, it's seriously necessary to use this, because of locale
collation ordering; in some locales, [A-Z] matches [b-z] as well, but
[:upper:] and [:lower:] matches the right thing...

Thank you, POSIX. FMH, please.

-- 
`Frankly I wonder whether you are not writing your posts from underneath a
 bridge.' --- Jason Clifford, to a particularly dense troll

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list