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 f
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 migh
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 mys
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
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
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
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
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 sol
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
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
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
> > > ;;
> > > esa
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
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.
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 s
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
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, th
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
>> 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
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.
> >
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, 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.go
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
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://
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/
24 matches
Mail list logo