Re: OT: Korn Shell and arithemetic

  • From: tim@xxxxxxxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 23 Jun 2004 12:03:33 -0600 (MDT)

It is korn shell.  The IF condition is testing output from the "bc" command, 
which is actually performing the arithmetic test, outputting "1" if true or "0" 
if false.  The difficult part is the "^J", which represents the NEWLINE 
character and can be constructed using CTRL-V/CTRL-J when editing using "vi".


-- Attached file included as plaintext by Ecartis --
-- File: OT: Korn Shell and arithemetic

Return-Path: <oracle-l-bounce@xxxxxxxxxxxxx>
Received: from mail.sagelogix.com by ocs.sagelogix.com
        with ESMTP id 5785081088009067; Wed, 23 Jun 2004 10:44:27 -0600
Received: by mail.sagelogix.com (Postfix, from userid 16)
        id C8370A8220; Wed, 23 Jun 2004 11:56:58 -0600 (MDT)
Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180])
        by mail.sagelogix.com (Postfix) with ESMTP id 4DF84A80F6
        for <tim@xxxxxxxxxxxxx>; Wed, 23 Jun 2004 11:55:53 -0600 (MDT)
Received: from localhost (localhost [127.0.0.1])
        by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP
        id 2C30672CB1D; Wed, 23 Jun 2004 12:36:58 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 20066-91; Wed, 23 Jun 2004 12:36:58 -0500 (EST)
Received: from turing (localhost [127.0.0.1])
        by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP
        id 5CBB272C9FD; Wed, 23 Jun 2004 12:36:57 -0500 (EST)
Received: with ECARTIS (v1.0.0; list oracle-l); Wed, 23 Jun 2004 12:35:39 -0500 
(EST)
X-Original-To: oracle-l@xxxxxxxxxxxxx
Delivered-To: oracle-l@xxxxxxxxxxxxx
Received: from localhost (localhost [127.0.0.1])
        by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP 
id 6DA8272C883
        for <oracle-l@xxxxxxxxxxxxx>; Wed, 23 Jun 2004 12:35:39 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 20066-70 for <oracle-l@xxxxxxxxxxxxx>;
 Wed, 23 Jun 2004 12:35:39 -0500 (EST)
Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64])
        by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP 
id 2598A72C447
        for <oracle-l@xxxxxxxxxxxxx>; Wed, 23 Jun 2004 12:35:39 -0500 (EST)
Received: from 204.127.205.145 ([204.127.205.145])
          by comcast.net (sccrmhc13) with SMTP
          id <20040623175714016005vs68e>; Wed, 23 Jun 2004 17:57:14 +0000
Received: from [12.39.221.111] by 204.127.205.145;
        Wed, 23 Jun 2004 17:57:12 +0000
From: ryan.gaffuri@xxxxxxxxxxx
To: oracle-l@xxxxxxxxxxxxx
Subject: OT: Korn Shell and arithemetic
Date: Wed, 23 Jun 2004 17:57:12 +0000
Message-Id: 
<062320041757.21438.40D9C478000BD3D8000053BE2200762302079D9A00000E09D2020E979D@xxxxxxxxxxx>
X-Mailer: AT&T Message Center Version 1 (May 18 2004)
X-Authenticated-Sender: cnlhbi5nYWZmdXJpQGNvbWNhc3QubmV0
X-Virus-Scanned: by amavisd-new at freelists.org
X-archive-position: 3460
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@xxxxxxxxxxxxx
Errors-To: oracle-l-bounce@xxxxxxxxxxxxx
X-original-sender: ryan.gaffuri@xxxxxxxxxxx
Precedence: normal
Reply-To: oracle-l@xxxxxxxxxxxxx
X-list: oracle-l
X-Virus-Scanned: by amavisd-new at freelists.org
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on mail.sagelogix.com
X-Spam-Status: No, hits=0.5 required=3.0 tests=NO_REAL_NAME autolearn=no 
        version=2.63
X-Spam-Level: 

Tim, 

what does this syntax mean? 


    $ if [[ "`bc << __EOF__^J1.2 > 1.0^J__EOF__`" = "1" ]]
    > then
    > echo yes
    > else echo no
    > fi
    yes

    $ if [[ "`bc << __EOF__^J1.2 > 1.3^J__EOF__`" = "1" ]]
    > 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
-----------------------------------------------------------------


----------------------------------------------------------------
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: