[opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 28 Jul 2009 10:26:30 -0500
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
Basically what I am looking for is some case insensitive way to test for quit or exit without having to define a test for each possible permutation without bringing in a big hammer like sed or the like. I am a bit confused on the test expansion but know things like $line == [Qq]uit won't work.
I can do it in case:
case $line in
[Qq][Uu][Ii][Tt] ) break;;
esac
But that seems like a clunky use of case. Is there a better way?
--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
- Follow-Ups:
- Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- From: David Haller
- Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- From: nordi
- Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- From: Per Jessen
- Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- From: Randall R Schulz
- Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- From: Anders Johansson
- Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- Prev by Date: Re: [opensuse] Losing NFS mounts on 11.1
- Next by Date: Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- Previous by thread: [opensuse] ALC883 sound problem
- Next by thread: Re: [opensuse] BASH: Shorter way to do [[ $line == QUIT ]] || [[ $line == Quit ]] || [[ $line == quit ]] && break ?
- Index(es):
Relevant Pages
|
Loading