From owner-freebsd-questions@FreeBSD.ORG Thu Jun 24 11:50:37 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EA74106566C for ; Thu, 24 Jun 2010 11:50:37 +0000 (UTC) (envelope-from fwd@gothschlampen.com) Received: from vs.gothschlampen.com (vs.gothschlampen.com [85.93.11.85]) by mx1.freebsd.org (Postfix) with ESMTP id 13ED18FC15 for ; Thu, 24 Jun 2010 11:50:36 +0000 (UTC) Received: by vs.gothschlampen.com (Postfix, from userid 667) id 732A21D32FB; Thu, 24 Jun 2010 13:50:14 +0200 (CEST) Date: Thu, 24 Jun 2010 13:50:14 +0200 From: Thomas Keusch To: RW Message-ID: <20100624115014.GB30312@gothschlampen.com> References: <4C22B3D7.6070102@comclark.com> <20100624013755.GA5009@gothschlampen.com> <20100624034434.7a6c2895@gumby.homeunix.com> <20100624031953.GA21766@gothschlampen.com> <20100624115805.7b8b0c44@gumby.homeunix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100624115805.7b8b0c44@gumby.homeunix.com> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-questions@freebsd.org Subject: Re: .sh check for numeric content X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2010 11:50:37 -0000 On Thu, Jun 24, 2010 at 11:58:05AM +0100, RW wrote: > On Thu, 24 Jun 2010 05:19:53 +0200 > Thomas Keusch 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