Re: does a variable contain...
- From: Ed Morton <morton@xxxxxxxxxxxxxx>
- Date: Mon, 07 May 2007 09:49:35 -0500
Bruce Bowler wrote:
Imagine
var1=SomeValueThatComesFromElsewhere
Is there a way, in bash, to determine if the value in var1 contains the string "From"?
I suppose I could echo it into a temporary file and grep for "From" but that seems a little less than optimal. Is there a better way?
Thanks!
Bruce
case $var in
*From* ) echo "Eureka!" ;;
esac
Ed.
.
- Follow-Ups:
- Re: does a variable contain...
- From: Bruce Bowler
- Re: does a variable contain...
- References:
- does a variable contain...
- From: Bruce Bowler
- does a variable contain...
- Prev by Date: does a variable contain...
- Next by Date: Re: does a variable contain...
- Previous by thread: does a variable contain...
- Next by thread: Re: does a variable contain...
- Index(es):
Relevant Pages
|