28 Jul
2009
28 Jul
'09
16:05
On Tuesday July 28 2009, David C. Rankin wrote:
Bash gurus,
What is a shorter way to do multiple case insensitive tests on a string or variable that would accomplish this:
[[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break
...
I can do it in case:
case $line in [Qq][Uu][Ii][Tt] ) break;; esac
% line=QuIt % [[ $line == [Qq][Uu][Ii][Tt] ]] && echo 'Quit, already!' Quit, already! % line=GoOn % [[ $line == [Qq][Uu][Ii][Tt] ]] && echo 'Quit, already!' || echo 'More is better...' More is better...
... -- David C. Rankin
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org