Re: OT:korn shell and arithmetic

  • From: Jared.Still@xxxxxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 24 Jun 2004 13:10:02 -0700

> 
> 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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: