Testing for strings, and numbers
Florian Diesch
diesch at spamfence.net
Fri Nov 13 15:01:39 UTC 2009
Ray Parrish <crp at cmc.net> writes:
> I am writing a bash script and I would like to test $1 to see if it
> begins with the string "http://" but I am not coming up with a method of
> doing so.
>
> Also I would like to know how to test $1 to see if it begins with a
> numeric digit.
case "$1" in
http://*) echo http;;
[0-9]*) echo Numeric;;
*) echo Unknown;;
esac
Florian
--
<http://www.florian-diesch.de/linux/asciipinguine.html>
More information about the ubuntu-users
mailing list