Giorgos Keramidas keram...@ceid.upatras.gr writes:
On Thu, 24 Jun 2010 05:19:53 +0200, Thomas Keusch
f...@bsd-solutions-duesseldorf.de wrote:
t...@eternity:~$ b=5
t...@eternity:~$ case $b in
[0-9] )
echo numeric
;;
* )
echo alpha
;;
esac
numeric
On Wed, 23 Jun 2010 23:32:57 -0400 (EDT)
Karl Vogel vogelke+u...@pobox.com articulated:
On Thu, 24 Jun 2010 09:24:39 +0800,
Aiza aiz...@comclark.com 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
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
On Thu, 24 Jun 2010 05:19:53 +0200
Thomas Keusch f...@bsd-solutions-duesseldorf.de 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
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
On Thu, Jun 24, 2010 at 11:58:05AM +0100, RW wrote:
On Thu, 24 Jun 2010 05:19:53 +0200
Thomas Keusch f...@bsd-solutions-duesseldorf.de wrote:
t...@eternity:~$ b=5
t...@eternity:~$ case $b in
[0-9] )
echo numeric
;;
* )
echo alpha
;;
On Thu, 24 Jun 2010 13:50:14 +0200
Thomas Keusch f...@bsd-solutions-duesseldorf.de 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.
On Jun 24 05:08, Jerry wrote:
On Wed, 23 Jun 2010 23:32:57 -0400 (EDT)
Karl Vogel vogelke+u...@pobox.com articulated:
On Thu, 24 Jun 2010 09:24:39 +0800,
Aiza aiz...@comclark.com said:
A Receiving a variable from the command line that is suppose to
A contain numeric values.
On Thu, 24 Jun 2010 09:14:39 -0700
Chip Camden sterl...@camdensoftware.com 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
vogelke+u...@pobox.com (Karl Vogel) writes:
On Thu, 24 Jun 2010 09:24:39 +0800,
Aiza aiz...@comclark.com 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
Carl Johnson ca...@peak.org writes:
vogelke+u...@pobox.com (Karl Vogel) writes:
On Thu, 24 Jun 2010 09:24:39 +0800,
Aiza aiz...@comclark.com 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
Carl Johnson ca...@peak.org writes:
Carl Johnson ca...@peak.org writes:
vogelke+u...@pobox.com (Karl Vogel) writes:
On Thu, 24 Jun 2010 09:24:39 +0800,
Aiza aiz...@comclark.com said:
A Receiving a variable from the command line that is suppose to contain
A numeric values. How do I code
Jerry wrote:
On Thu, 24 Jun 2010 09:14:39 -0700
Chip Camden sterl...@camdensoftware.com 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
On Fri, 25 Jun 2010 05:17:17 +0800
Aiza aiz...@comclark.com articulated:
Jerry wrote:
On Thu, 24 Jun 2010 09:14:39 -0700
Chip Camden sterl...@camdensoftware.com articulated:
[snip]
That [[:digit:]] pattern only works if your shell supports POSIX
character classes in the case
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
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
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 =
On Thu, 24 Jun 2010 09:24:39 +0800
Aiza aiz...@comclark.com 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
On Thu, 24 Jun 2010 03:37:55 +0200
Thomas f...@gothschlampen.com 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?
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
On Thu, Jun 24, 2010 at 03:44:34AM +0100, RW wrote:
Hello,
On Thu, 24 Jun 2010 03:37:55 +0200
Thomas f...@gothschlampen.com 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
On Thu, 24 Jun 2010 09:24:39 +0800,
Aiza aiz...@comclark.com 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
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?
On Thu, 24 Jun 2010 05:19:53 +0200, Thomas Keusch
f...@bsd-solutions-duesseldorf.de 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
24 matches
Mail list logo