.sh check for numeric content

RW rwmaillists at googlemail.com
Thu Jun 24 10:58:09 UTC 2010


On Thu, 24 Jun 2010 05:19:53 +0200
Thomas Keusch <fwd at bsd-solutions-duesseldorf.de> wrote:


> tk at eternity:~$ b=5
> tk at eternity:~$ case "$b" in 
> > [0-9] ) 
> >         echo numeric 
> >         ;;
> > * ) 
> >         echo alpha 
> >         ;;
> > esac
> numeric
> tk at eternity:~$
> 
> Works for me.

Now try it with 10.


More information about the freebsd-questions mailing list