Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT:korn shell and arithmetic

Re: OT:korn shell and arithmetic

From: <Jared.Still_at_radisys.com>
Date: Thu, 24 Jun 2004 13:10:02 -0700
Message-ID: <OFEE0271E4.7C7B67BF-ON88256EBD.006DC01A-88256EBD.006EC3AA@radisys.com>


>
> However, I like annoying.. colleagues can't read my code anyway.. so
that
> fits right in! 8D However, I couldn't get bc on solaris to support
that..
> so:
>
> $ if [ "`expr 1.2 \> 1.0`" = "1" ]
>
> In fact, I think expr will return a result status accordingly, so:
>
> $ if expr 1.2 \> 1.0 >/dev/null; then
> $ echo yes
> $ else
> $ echo no
> $ fi
>

Or even:

#!/bin/ksh

# call with x.sh 1.3 1.2

if [ `perl -e 'print $ARGV[0] > $ARGV[1] ? 1 : 0' $1 $2` -gt 0 ]; then

        echo Yes
else

        echo No
fi



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Thu Jun 24 2004 - 15:07:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US