Re: .sh check for numeric content
Giorgos Keramidas writes: > On Thu, 24 Jun 2010 05:19:53 +0200, Thomas Keusch > wrote: >> t...@eternity:~$ b=5 >> t...@eternity:~$ case "$b" in >>> [0-9] ) >>> echo numeric >>> ;; >>> * ) >>> echo alpha >>> ;; >>> esac >> numeric >> t...@eternity:~$ >> >> Works for me. > > Depending on what "numeric" means, this may be ok. For other numeric > values (e.g. floating point numbers) There are simple, fast and correct > ways to check but you have to escape from the shell, e.g.: > > $ var=3.1415926535897931 > $ python -c "$var + 0.0" >/dev/null 2>&1 ; echo $? > 0 $ printf %g $var 2>&- >&- ; echo $? 0 > > $ var=3a.1415926535897931 > $ python -c "$var + 0.0" >/dev/null 2>&1 ; echo $? > 1 $ printf %g $var 2>&- >&- ; echo $? 1 It also understands %e and %a -notation, e.g. 3.14e+2 and 0x1.3ap+8. $ python -c 0x1.3ap+8 2>&- >&- ; echo $? 1 $ printf %g 0x1.3ap+8 2>&- >&- ; echo $? 0 > > The overhead of spawning a full-blown language interpreter like Perl or > Python may be acceptable if you have to check "a few" values. Then it > may be overkill if you want to check a million values. It's really up > to you, as a programmer, to pick the right method. Besides, printf(1) is also builtin in some shells which can reduce overhead of spawning process. IIRC, there is some support for builtin printf in our /bin/sh but it's disabled. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, Jun 24, 2010 at 05:51:20PM -0400, Jerry wrote: > > In any case, as I previously posted, it was left up to the OP to decide > if the proposed solution was suitable for their needs. After reading > all of the babble concerning what should be a relatively easy operation, > perhaps the OP might want to consider switching to Bash. If we're going to start telling him what language to use, we might as well tell him to use an actual *programming* language (e.g. Perl). Otherwise, perhaps we should try to stick to what he wants to use. -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] pgpqqt5lqE2BZ.pgp Description: PGP signature
Re: .sh check for numeric content
On Fri, 25 Jun 2010 05:17:17 +0800 Aiza articulated: > Jerry wrote: > > On Thu, 24 Jun 2010 09:14:39 -0700 > > Chip Camden articulated: > > > > [snip] > > > >> That [[:digit:]] pattern only works if your shell supports POSIX > >> character classes in the case statement. > > > > I use Bash myself. I am not sure what other shells support this > > context. In any case, I simply supplied a possible solution. I > > leave it up to the OP to determine if it is suitable for his/her > > environment. > > > The subject clearly tells you what shell the o/p is using. Actually, ".sh" does not appear to be a definitive declaration of the scripting language. However, if you deemed that to be a definitive declaration for the scripting language the OP was using, then fine. In any case, as I previously posted, it was left up to the OP to decide if the proposed solution was suitable for their needs. After reading all of the babble concerning what should be a relatively easy operation, perhaps the OP might want to consider switching to Bash. -- Jerry ✌ freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ Q: What's the difference between an Irish wedding and an Irish wake? A: One more drunk. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
Jerry wrote: On Thu, 24 Jun 2010 09:14:39 -0700 Chip Camden articulated: [snip] That [[:digit:]] pattern only works if your shell supports POSIX character classes in the case statement. I use Bash myself. I am not sure what other shells support this context. In any case, I simply supplied a possible solution. I leave it up to the OP to determine if it is suitable for his/her environment. The subject clearly tells you what shell the o/p is using. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
Carl Johnson writes: > Carl Johnson writes: > >> vogelke+u...@pobox.com (Karl Vogel) writes: >> > On Thu, 24 Jun 2010 09:24:39 +0800, > Aiza said: >>> >>> A> Receiving a variable from the command line that is suppose to contain >>> A> numeric values. How do I code a test to verify the content is numeric? >>> >>>The script below will work with the Bourne or Korn shell. >>>Results for "0 1 12 1234 .12 1.234 12.3 1a a1": >>> >>> 0 is numeric >>> 1 is numeric >>> 12 is numeric >>> 1234 is numeric >>> .12 is numeric >>> 1.234 is numeric >>> 12.3 is numeric >>> 1a is NOT numeric >>> a1 is NOT numeric >> >> You might want to try testing "123..45". >> I tried changing: >>>if expr "$arg" : "[0-9]*[\.0-9]*$" > /dev/null >> to: >> if expr "$arg" : "[0-9]*\.*[0-9]*$" > /dev/null >> but it still claims that it is numeric, so *I* must be missing >> something. > > I just realized that I had a stupid mistake there and should have > used: > if expr "$arg" : "[0-9]*\.[0-9]*$" > /dev/null And of course that was another stupid mistake that I didn't test properly. I really wanted 0 or 1 decimal points, so I wanted '\.\?', except that FreeBSD expr doesn't recognize '\?'. I finally ended up with the following which seems to work as *I* expected it to work: if expr "$arg" : "[1-9]*\.\{0,1\}[0-9]*$" > /dev/null -- Carl Johnsonca...@peak.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
Carl Johnson writes: > vogelke+u...@pobox.com (Karl Vogel) writes: > On Thu, 24 Jun 2010 09:24:39 +0800, Aiza said: >> >> A> Receiving a variable from the command line that is suppose to contain >> A> numeric values. How do I code a test to verify the content is numeric? >> >>The script below will work with the Bourne or Korn shell. >>Results for "0 1 12 1234 .12 1.234 12.3 1a a1": >> >> 0 is numeric >> 1 is numeric >> 12 is numeric >> 1234 is numeric >> .12 is numeric >> 1.234 is numeric >> 12.3 is numeric >> 1a is NOT numeric >> a1 is NOT numeric > > You might want to try testing "123..45". > I tried changing: >>if expr "$arg" : "[0-9]*[\.0-9]*$" > /dev/null > to: > if expr "$arg" : "[0-9]*\.*[0-9]*$" > /dev/null > but it still claims that it is numeric, so *I* must be missing > something. I just realized that I had a stupid mistake there and should have used: if expr "$arg" : "[0-9]*\.[0-9]*$" > /dev/null -- Carl Johnsonca...@peak.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
vogelke+u...@pobox.com (Karl Vogel) writes: >>> On Thu, 24 Jun 2010 09:24:39 +0800, >>> Aiza said: > > A> Receiving a variable from the command line that is suppose to contain > A> numeric values. How do I code a test to verify the content is numeric? > >The script below will work with the Bourne or Korn shell. >Results for "0 1 12 1234 .12 1.234 12.3 1a a1": > > 0 is numeric > 1 is numeric > 12 is numeric > 1234 is numeric > .12 is numeric > 1.234 is numeric > 12.3 is numeric > 1a is NOT numeric > a1 is NOT numeric You might want to try testing "123..45". I tried changing: >if expr "$arg" : "[0-9]*[\.0-9]*$" > /dev/null to: if expr "$arg" : "[0-9]*\.*[0-9]*$" > /dev/null but it still claims that it is numeric, so *I* must be missing something. -- Carl Johnsonca...@peak.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, 24 Jun 2010 09:14:39 -0700 Chip Camden articulated: [snip] > That [[:digit:]] pattern only works if your shell supports POSIX > character classes in the case statement. I use Bash myself. I am not sure what other shells support this context. In any case, I simply supplied a possible solution. I leave it up to the OP to determine if it is suitable for his/her environment. -- Jerry ✌ freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Jun 24 05:08, Jerry wrote: > On Wed, 23 Jun 2010 23:32:57 -0400 (EDT) > Karl Vogel articulated: > > > > >> On Thu, 24 Jun 2010 09:24:39 +0800, > > >> Aiza said: > > > > A> Receiving a variable from the command line that is suppose to > > A> contain numeric values. How do I code a test to verify the > > A> content is numeric? > > > >The script below will work with the Bourne or Korn shell. > >Results for "0 1 12 1234 .12 1.234 12.3 1a a1": > > > > 0 is numeric > > 1 is numeric > > 12 is numeric > > 1234 is numeric > > .12 is numeric > > 1.234 is numeric > > 12.3 is numeric > > 1a is NOT numeric > > a1 is NOT numeric > > I had used this snippet in a script to test for numeric input. It was > part of a function in a Bash script. > > case "${1}" in > [[:digit:]] ) > IS_DIGIT=1 > ;; > > * ) > > IS_DIGIT=0 > > printf "\n\a\t *WARNING* > > \tYou must enter a digit\n\n" > > ;; > > esac That [[:digit:]] pattern only works if your shell supports POSIX character classes in the case statement. > > -- > Jerry ??? > freebsd.u...@seibercom.net > > Disclaimer: off-list followups get on-list replies or get ignored. > Please do not ignore the Reply-To header. > __ > > Why do we want intelligent terminals > when there are so many stupid users? > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org" -- Sterling (Chip) Camden http://camdensoftware.com | http://chipstips.com | http://chipsquips.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, 24 Jun 2010 13:50:14 +0200 Thomas Keusch wrote: > "10" is not valid input according to the problem/pseudocode (in the > forum) that the above code was posted as a solution for. And if you were answering in that forum that would be a good point. > Spoonfeeding solutions to trivial (and trivially researched questions) > is counterproductive on so many levels. You gave him an answer to a different question. When I suggested he skip it, you countered with a test-case that you apparently knew was misleading. There's a diffence between not spoon-feeding and deliberately sending someone off in the wrong direction. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, Jun 24, 2010 at 11:58:05AM +0100, RW wrote: > On Thu, 24 Jun 2010 05:19:53 +0200 > Thomas Keusch wrote: > > > t...@eternity:~$ b=5 > > t...@eternity:~$ case "$b" in > > > [0-9] ) > > > echo numeric > > > ;; > > > * ) > > > echo alpha > > > ;; > > > esac > > numeric > > t...@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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, Jun 24, 2010 at 12:31:13PM +0200, Thomas wrote: Hello, > Even if "[" at first glance seems like a special syntax of the shell, > it really is just an alternative name or way of calling test(1): > > $ ls -l $(which test [) > -rwxr-xr-x 1 root root 42584 2009-10-06 13:07 /usr/bin/[ > -rwxr-xr-x 1 root root 30284 2009-10-06 13:07 /usr/bin/test I just noticed how this snippet doesn't prove my point very well :) Hope this did not confuse you too much, just ignore the ls part. >From now on I'll refrain from posting until I've had my coffee and am fully awake.. Regards, Thomas ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, 24 Jun 2010 05:19:53 +0200 Thomas Keusch wrote: > t...@eternity:~$ b=5 > t...@eternity:~$ case "$b" in > > [0-9] ) > > echo numeric > > ;; > > * ) > > echo alpha > > ;; > > esac > numeric > t...@eternity:~$ > > Works for me. Now try it with 10. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, Jun 24, 2010 at 12:52:48PM +0800, Aiza wrote: Hello, > But when I tried this format > [ expr "${dup_times}" : "[0-9]*$" ] || echo "value is not numeric" > > I get the error message no mater what the value is. > > What am I doing wrong? Even if "[" at first glance seems like a special syntax of the shell, it really is just an alternative name or way of calling test(1): $ ls -l $(which test [) -rwxr-xr-x 1 root root 42584 2009-10-06 13:07 /usr/bin/[ -rwxr-xr-x 1 root root 30284 2009-10-06 13:07 /usr/bin/test (this actually is from a Linux system) You can read about the checks test(1) can perform and its syntax in its manual page. It will give you a nice and concise overview of what can be archived in this "[ $EXPRESSION ]" syntax, and what checks are left to be performed in other ways. Hope this helps. Regards, Thomas ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Wed, 23 Jun 2010 23:32:57 -0400 (EDT) Karl Vogel articulated: > >> On Thu, 24 Jun 2010 09:24:39 +0800, > >> Aiza said: > > A> Receiving a variable from the command line that is suppose to > A> contain numeric values. How do I code a test to verify the > A> content is numeric? > >The script below will work with the Bourne or Korn shell. >Results for "0 1 12 1234 .12 1.234 12.3 1a a1": > > 0 is numeric > 1 is numeric > 12 is numeric > 1234 is numeric > .12 is numeric > 1.234 is numeric > 12.3 is numeric > 1a is NOT numeric > a1 is NOT numeric I had used this snippet in a script to test for numeric input. It was part of a function in a Bash script. case "${1}" in [[:digit:]] ) IS_DIGIT=1 ;; * ) IS_DIGIT=0 printf "\n\a\t *WARNING* \tYou must enter a digit\n\n" ;; esac -- Jerry ✌ freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ Why do we want intelligent terminals when there are so many stupid users? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, 24 Jun 2010 05:19:53 +0200, Thomas Keusch wrote: > t...@eternity:~$ b=5 > t...@eternity:~$ case "$b" in >> [0-9] ) >> echo numeric >> ;; >> * ) >> echo alpha >> ;; >> esac > numeric > t...@eternity:~$ > > Works for me. Depending on what "numeric" means, this may be ok. For other numeric values (e.g. floating point numbers) There are simple, fast and correct ways to check but you have to escape from the shell, e.g.: $ var=3.1415926535897931 $ python -c "$var + 0.0" >/dev/null 2>&1 ; echo $? 0 $ var=3a.1415926535897931 $ python -c "$var + 0.0" >/dev/null 2>&1 ; echo $? 1 The overhead of spawning a full-blown language interpreter like Perl or Python may be acceptable if you have to check "a few" values. Then it may be overkill if you want to check a million values. It's really up to you, as a programmer, to pick the right method. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
Aiza wrote: Thomas wrote: On Thu, Jun 24, 2010 at 09:24:39AM +0800, Aiza wrote: Hello, Receiving a variable from the command line that is suppose to contain numeric values. How do I code a test to verify the content is numeric? http://www.google.com/search?q=shell+test+if+variable+numeric First link => http://www.unix.com/shell-programming-scripting/46276-check-variable-if-its-non-numeric.html Gosh, Google is full of answers these days.. yea but none of them are for freebsd style .sh shell I'm, using [ "${dup_times}" != [0-9] ] && exerr "value not numeric" and get the errot messahe no mater what value is in dup_times. What is wrong with this code? Tried this suggestion from a reply and it worked. Only valid numeric value is whole numbers. if expr "${dup_times}" : "[0-9]*$" then echo "value is numeric" else echo "value is not numeric" fi But when I tried this format [ expr "${dup_times}" : "[0-9]*$" ] || echo "value is not numeric" I get the error message no mater what the value is. What am I doing wrong? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
>> On Thu, 24 Jun 2010 09:24:39 +0800, >> Aiza said: A> Receiving a variable from the command line that is suppose to contain A> numeric values. How do I code a test to verify the content is numeric? The script below will work with the Bourne or Korn shell. Results for "0 1 12 1234 .12 1.234 12.3 1a a1": 0 is numeric 1 is numeric 12 is numeric 1234 is numeric .12 is numeric 1.234 is numeric 12.3 is numeric 1a is NOT numeric a1 is NOT numeric -- Karl Vogel I don't speak for the USAF or my company I place economy among the first and most important virtues, and public debt as the greatest of dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt.--Thomas Jefferson --- #!/bin/sh # Test an argument to see if it's numeric. Handles decimals, but # a minus sign in the regex will throw an error: "expr: illegal option". PATH=/bin:/usr/bin:/usr/local/bin export PATH case "$#" in 0) echo need an argument. ; exit 1 ;; *) ;; esac for arg do if expr "$arg" : "[0-9]*[\.0-9]*$" > /dev/null then echo "$arg is numeric" else echo "$arg is NOT numeric" fi done exit 0 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, Jun 24, 2010 at 03:44:34AM +0100, RW wrote: Hello, > On Thu, 24 Jun 2010 03:37:55 +0200 > Thomas wrote: > > > On Thu, Jun 24, 2010 at 09:24:39AM +0800, Aiza wrote: > > > > Hello, > > > > > Receiving a variable from the command line that is suppose > > > to contain numeric values. > > > > > > How do I code a test to verify the content is numeric? > > > > http://www.google.com/search?q=shell+test+if+variable+numeric > > > > First link => > > http://www.unix.com/shell-programming-scripting/46276-check-variable-if-its-non-numeric.html > > > > Gosh, Google is full of answers these days.. > > I'd suggest looking a bit further down the list since the quoted first > link is patently wrong. t...@eternity:~$ b=5 t...@eternity:~$ case "$b" in > [0-9] ) > echo numeric > ;; > * ) > echo alpha > ;; > esac numeric t...@eternity:~$ Works for me. Another solution would be like this: if echo "$b" | egrep -q '^[0-9]+$'; then and eventual variants of it. Regards Thomas ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
Thomas wrote: On Thu, Jun 24, 2010 at 09:24:39AM +0800, Aiza wrote: Hello, Receiving a variable from the command line that is suppose to contain numeric values. How do I code a test to verify the content is numeric? http://www.google.com/search?q=shell+test+if+variable+numeric First link => http://www.unix.com/shell-programming-scripting/46276-check-variable-if-its-non-numeric.html Gosh, Google is full of answers these days.. yea but none of them are for freebsd style .sh shell I'm, using [ "${dup_times}" != [0-9] ] && exerr "value not numeric" and get the errot messahe no mater what value is in dup_times. What is wrong with this code? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, 24 Jun 2010 03:37:55 +0200 Thomas wrote: > On Thu, Jun 24, 2010 at 09:24:39AM +0800, Aiza wrote: > > Hello, > > > Receiving a variable from the command line that is suppose > > to contain numeric values. > > > > How do I code a test to verify the content is numeric? > > http://www.google.com/search?q=shell+test+if+variable+numeric > > First link => > http://www.unix.com/shell-programming-scripting/46276-check-variable-if-its-non-numeric.html > > Gosh, Google is full of answers these days.. I'd suggest looking a bit further down the list since the quoted first link is patently wrong. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, 24 Jun 2010 09:24:39 +0800 Aiza wrote: > Receiving a variable from the command line that is suppose > to contain numeric values. > > How do I code a test to verify the content is numeric? echo "$your_variable" | grep -E "^[0-9]+(\.[0-9]*)*[0-9]+$" If $your_variable is numeric (123, or 123.123, etc), the return code should be 0. You can custom to script to support negative numbers. -- Anh Ky Huynh ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: .sh check for numeric content
On Thu, Jun 24, 2010 at 09:24:39AM +0800, Aiza wrote: Hello, > Receiving a variable from the command line that is suppose > to contain numeric values. > > How do I code a test to verify the content is numeric? http://www.google.com/search?q=shell+test+if+variable+numeric First link => http://www.unix.com/shell-programming-scripting/46276-check-variable-if-its-non-numeric.html Gosh, Google is full of answers these days.. Regards, Thomas ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
.sh check for numeric content
Receiving a variable from the command line that is suppose to contain numeric values. How do I code a test to verify the content is numeric? Thanks for for help. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"