Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT:korn shell and arithmetic
>
> 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
-- 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