Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT:korn shell and arithmetic
Sorry, my friend, but that doesn't work...
$ if [ 1.2 > 1.0 ]; then
> echo "yes" > else echo "no" > fi
$ if [ 1.2 > 1.3 ]; then
> echo "yes" > else echo "no" > fi
The following is rather annoying, but it seems to work...
$ if [[ "`bc << __EOF__^J1.2 > 1.0^J__EOF__`" = "1" ]]
> then > echo yes > else echo no > fi
$ if [[ "`bc << __EOF__^J1.2 > 1.3^J__EOF__`" = "1" ]]
> then > echo yes > else echo no > fi
The "^J" sequences are obtained using CTRL-V then CTRL-J (a.k.a. newline characters).
Korn shell can be quite roundabout quite often...
-Tim
on 6/22/04 11:28 AM, Mladen Gogala at mladen_at_wangtrading.com wrote:
>
> On 06/22/2004 01:06:03 PM, ryan.gaffuri_at_comcast.net wrote:
>> I don't know any unix listservs... so I hope this is ok. >> >> I am trying to do the following: >> >> if [ 1.2 -gt 1.0 ]; then >> echo yes >> else echo no >> fi >> >> It alwys comes out no? Anyway to get around this?
-- 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 Wed Jun 23 2004 - 00:09:29 CDT
![]() |
![]() |