I didn't get around to trying this until now, so
I continue here, in a new thread:
The question is still the same: How can I perform case-insensitive
string matching in bash without calling an external program such
as grep ?
...
It doesn't, actually:Quote:>>>>But how can I make the matching case-insensitive ?
>>>shopt -s nocaseglob
>>Thanks. I think this must be what I had in mind from
>>before. Doesn't appear to work for me now though.
>>I am doing this in cygwin* at the moment, but will
>>give it a try in linux when I get around to it.
>>Cheers CV
>>* GNU bash, version 2.05b.0(1)-release (i686-pc-cygwin)
>> CYGWIN_NT-5.1 <host> 1.5.12(0.116/4/2) 2004-11-10 08:34 \
>> i686 unknown unknown Cygwin
> It should work for 'case' statement.
~$ ccc() { shopt -s nocaseglob; case $1 in *abc*) echo "abc found";; *) echo "not found";; esac; }
~$ ccc sdaabcvgasfdg
abc found
~$ ccc sdaAbcvgasfdg
not found
~$
According to the manpage nocaseglob works for filename expansion.
It doesn't say anything about string matching.
Regards CV