[wplug] Bash conditional help
Tom Rhodes
trhodes at FreeBSD.org
Fri May 2 20:19:02 EDT 2008
On Fri, 2 May 2008 15:40:31 -0400
"Moshe Hyzon" <mokatz at gmail.com> wrote:
> In the interest of "There's more than ONE way to do it!"....
>
>
>
> case "$myvar" in
> *apple*)
> echo "We've got an apple!"
> ;;
> *)
> echo "No apple here."
> ;;
> esac
>
And more. :)
Actually, I don't use bash, but the following works in ksh and sh:
myvar="orange orange apple grape"
if echo $myvar | grep apple
then echo "got an apple"
fi
--
Tom Rhodes
More information about the wplug
mailing list