Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jun 2010 13:50:14 +0200
From:      Thomas Keusch <fwd@bsd-solutions-duesseldorf.de>
To:        RW <rwmaillists@googlemail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: .sh  check for numeric content
Message-ID:  <20100624115014.GB30312@gothschlampen.com>
In-Reply-To: <20100624115805.7b8b0c44@gumby.homeunix.com>
References:  <4C22B3D7.6070102@comclark.com> <20100624013755.GA5009@gothschlampen.com> <20100624034434.7a6c2895@gumby.homeunix.com> <20100624031953.GA21766@gothschlampen.com> <20100624115805.7b8b0c44@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 24, 2010 at 11:58:05AM +0100, RW wrote:
> On Thu, 24 Jun 2010 05:19:53 +0200
> Thomas Keusch <fwd@bsd-solutions-duesseldorf.de> wrote:
> 
> > tk@eternity:~$ b=5
> > tk@eternity:~$ case "$b" in 
> > > [0-9] ) 
> > >         echo numeric 
> > >         ;;
> > > * ) 
> > >         echo alpha 
> > >         ;;
> > > esac
> > numeric
> > tk@eternity:~$
> > 
> > Works for me.
> 
> Now try it with 10.

"10" is not valid input according to the problem/pseudocode (in the forum)
that the above code was posted as a solution for.

I tend to lend a hand, not the whole arm. If this doesn't solve the
problem 100% for the OP, it surely enables him to quickly spot a
solution (at least using the case statement) when he sees it, be it in
results from researching via google, or in actual system scripts
installed on his system.

"Give a man a fish, ..." and all that.

Don't get me wrong, I'm not at all against posting more complete solutions
for more complex problems, but I do indeed think that lending a hand while
still requiring a little thought and maybe tinkering on the side of the OP
is what ultimately enables him (& newcomers in general) to learn and grow.

Spoonfeeding solutions to trivial (and trivially researched questions)
is counterproductive on so many levels.

Regards,
Thomas



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100624115014.GB30312>