How to perform addition of two numbers in shell scripting in Solaris-10

Hi,
I have a sh script which contains the following line
TOTAL=$((e4-s4)) -> Where e4 and s4 are input got from the user.
At the time of execution of this line the following error occurs
test.sh: syntax error at line 8: `TOTAL=$' unexpected
How to solve this issue?. Can any one help me please?.........................
Regards
Revathi

Again Same error persisted.
Below is my script
+#!/bin/bash+
echo "Enter the start IP"
IFS="."
read s1 s2 s3 s4
echo "Enter the End IP"
IFS="."
read e1 e2 e3 e4
TOTAL=$(($e4 - $s4))
echo "Total is $TOTAL"
The output is
*#!/bin/bash*
echo "Enter the start IP"
IFS="."
read s1 s2 s3 s4
echo "Enter the End IP"
IFS="."
read e1 e2 e3 e4
TOTAL=$(($e4 - $s4))
echo "Total is $TOTAL"
Any idea

Similar Messages

  • [svn:osmf:] 14580: Commit example showing how to perform additional load logic via a ProxyElement .

    Revision: 14580
    Revision: 14580
    Author:   [email protected]
    Date:     2010-03-04 09:28:35 -0800 (Thu, 04 Mar 2010)
    Log Message:
    Commit example showing how to perform additional load logic via a ProxyElement.  The AsynchLoadingProxyElement (and its corresponding LoadTrait) load the proxied element, but doesn't expose its READY state to the outside world until it performs its own load operation (in this case it just runs a Timer).  Include minor fix to other example.
    Modified Paths:
        osmf/trunk/apps/samples/framework/ExamplePlayer/org/osmf/examples/AllExamples.as
        osmf/trunk/apps/samples/framework/ExamplePlayer/org/osmf/examples/loaderproxy/VideoProxyE lement.as
    Added Paths:
        osmf/trunk/apps/samples/framework/ExamplePlayer/org/osmf/examples/loaderproxy/AsynchLoadi ngProxyElement.as
        osmf/trunk/apps/samples/framework/ExamplePlayer/org/osmf/examples/loaderproxy/AsynchLoadi ngProxyLoadTrait.as

    Nope, what for?
    If you know what you are doing and you discharge yourself there is no need for such.
    BTW, those bands are not that safe, if you use them wrongly you can electrocute yourself pretty easily

  • How to do addition of two columns cells in Matrix.

    Hi All,
    I tried following code on LostFocus event of Mtrix. I want to do addition of two columns cells of matrix and addtion display in third column. I tried the following code but in this I am getting the column value and when i enterd any value in columns cells it disappear when i move to next column cells.
    Can anybody suggest me how to do it ?
    Dim i As Integer
                Dim v1, v2 As String
                matrix.Columns.Item("V_4").DataBind.SetBound(True, "", "matrixds")
                If pVal.ColUID = "V_4" Then
                    For i = 0 To matrix.RowCount - 1
                        v1 = matrix.Columns.Item("V_5").Cells.Item(i + 1).Specific.Value
                        v2 = matrix.Columns.Item("V_4").Cells.Item(i + 1).Specific.Value
                        Dim v3 As Integer = CInt(v1) + CInt(v2)
                        matrix.Columns.Item("V_3").Cells.Item(i + 1).Specific.Value = v3.ToString()
                    Next
                End If
    Thanks and Regards,

    Hi,
    u bind all the columns to the datasource in the matrix.then the value does not disappear.
    Change ur code as follows:
    Use the databind in formload
    matrix.Columns.Item("V_4").DataBind.SetBound(True, "", "matrixds1")
    matrix.Columns.Item("V_5").DataBind.SetBound(True, "", "matrixds2")
    matrix.Columns.Item("V_3").DataBind.SetBound(True, "", "matrixds3")
    Dim v1, v2 As sapbouicom.edittext
    If pVal.ColUID = "V_4" Then
    v1 = matrix.Columns.Item("V_5").Cells.Item(pVal.row).Specific
    v2 = matrix.Columns.Item("V_4").Cells.Item(pVal.row).Specific
    v3=  matrix.Columns.Item("V_3").Cells.Item(pVal.row).Specific
    v3.Value = v1 .Value + v2.Value
    End If
    Kind Regards
    Mohana

  • How to find ratio of two numbers in obiee 11.1.1.5

    Hi,
    I need to calculate ratio of two numbers.For eg:if I have two numbers 10 and 15,I need the ratio as 2:3.That means,obiee should find greatest common divisor of the two numbers and then divide each number with GCD.How to do this in obiee 11.1.1.5?
    Thanks in advance,
    Fathima farsatha

    A way to do it would to use the euclidean algorithm inside a function (through EVALUATE of course). I have used the example Oracle has in their own (old) Oracle 9i documentation since it's very straightforward:
    CREATE FUNCTION gcd (x INTEGER, y INTEGER) RETURN INTEGER AS
    -- Find greatest common divisor of x and y. For example, if
    -- (8,12) is input, the greatest common divisor is 4.
    -- This will be used in normalizing (simplifying) fractions.
    -- (You need not try to understand how this code works, unless
    -- you are a math wizard. It does.)
    ans INTEGER;
    BEGIN
    IF (y <= x) AND (x MOD y = 0) THEN
    ans := y;
    ELSIF x < y THEN
    ans := gcd(y, x); -- Recursive call
    ELSE
    ans := gcd(y, x MOD y); -- Recursive call
    END IF;
    RETURN ans;
    END;
    Then I create my analysis with my 2 measures and a 3rd column to check the GCD:
    EVALUATE('MySchema.GCD(%1,%2)', "Measures"."Revenue", "Measures"."Sales")
    Revenue Sales GCD
    | 100 | 550 | 50 |
    4th column will contain the actual formula which calculates the ratio (output = varchar):
    cast("Measures"."Revenue" / EVALUATE('MySchema.GCD(%1, %2)', "Measures"."Revenue", "Measures"."Sales") as VARCHAR(100)) || ' : ' || cast("Measures"."Sales" / EVALUATE('MySchema.GCD(%1, %2)', "Measures"."Revenue", "Measures"."Sales") as VARCHAR(100))
    Revenue Sales GCD Ratio
    ---------------------------------------------+
    | 100 | 550 | 50 | 2 : 11 |
    ---------------------------------------------+
    Voilà.

  • How to run a java class from a shell script with passing arguments

    hi,
    I have a jar with all the required classes. I was using ant to run the classes i needed.
    But now i want to use a shell script to run the class, also the class accepts some arguments so when script is run it should accept arguments.
    So can any one tell me how to set class paths, jar location and call the required class from shell script or batch file with passing arguments to it.
    Thanks in advance.

    Let's say that the order of arguments is as below
    1. Jar file name
    2. Classpath
    Your shell script would look like this
    java -cp $CLASSPATH:$2 -jar $1 I am assuming that your jar file has the required main-class entry in its manifest. Note that $1...$9 represent the arguments to this shell script.
    The same goes for a batch file
    java -cp %CLASSPATH%;%2 -jar %1

  • How to execute a select statement in unix shell script

    Hi,
    How to execute the below statement in unix shell .
    select count( ID) into v_count from tbl_data1
    where ID =V_ID;
    thanks
    BCJ

    Thanks for the reply.
    few more doubts,
    the V_ID value is a user input getting inside the unix script, so how can i pass the value in to the a.sql.
    also needs the v_count value inside the unix script for further process.actual requirement is like,
    declare
    v_count number;
    begin
    select count( ID) into v_count from tbl_data1
    where ID =$V_ID;
    if v_count>1 then
    process 1;
    else
    process2;
    end if;
    end;
    thanks a lot

  • How to submit "active users" standard report using shell scripting

    Hi All,
    Greetings.
    I want to submit the "Active Users" standard report in Sysadmin responsibility using a shell script.
    I also want to pass a parameter named email to this..
    can anyone help me do this?
    Thanks in Advance,
    Bhaskar

    Hi Bhaskar,
    You can achieve this by shell scripting either by scripting via CONCSUB utility (invoked from OS) or you can use the FND_SUBMIT package (through PL/SQL package), and in the script itself you can create the outputs or any hardcode messages to a file, and then mail the output to your desired mail address.
    If you use mail or mailx command using the OS utility then you can even send mail to external users which should not necessarily be a registered EBS users.
    Google, Forum Search and metalink will provide you loads of articles on how to use CONCSUB and FND_SUBMIT packages.
    Thanks &
    Best Regards,

  • How to pass video file name to run shell script

    Trying to make an automator script that will 1. Start a video capture, 2. Stop video capture, 3. Rename video, 4. Run Shell Script. Here is the shell script:
    for f in "$@"
    do
    echo "$f"
    /usr/bin/podcast --server my.podcast.server --user myself --pass mypass --submit --file $f --workflow "my workflow" --metadata /path/to/file
    done
    Question:
    Do I need to create a variable in the automator script to pass it to the script? If I need the variable do I also need to use both Set Value of Variable and Get Value of Variable? If I don't need a variable does $f need quotes around them?

    I'm not familiar with the terminal command /usr/bin/podcast so I don't know what it does but what i said is correct. to pass a file to this action you don't need any variables. the previous action in the workflow should output the video file you want to process, that's all. how you arrange that is up to you. it's clear that you have to fill in appropriate things in that shell script like " my workflow" and path to metadata. But if you have questions about how this shell action works you should ask people who made it.

  • How to set the time limit to execute shell script

    I am using Runtime exec() method to execute a shell script
    if the script hangs for long time infinitely then how to get the control
    return to the program.
    Thanks in advance

    rmi_rajkumar wrote:
    let me explain with an example
    script name is test.sh
    Runtime.exec("test.sh") this will start a new process
    if (proc.waitFor() == 0) {
    try {
    InputStreamReader isr = new InputStreamReader(proc.getInputStream());
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null) {
    outputBuf.append(line).append(ConfigOptions.getLineModeStr());
    } catch (IOException ioe) {
    if test.sh did not exit and hangs with no response
    in this case proc.waitFor() will not execute try catch the control will remain if statement
    my question is insteadof waiting indefinitely need to set a time out say 1 hour and kill the process that executed the scriptYou really need to read the article in the link given by another poster. Your code will not work correctly because you are waiting for the process to end before reading the stream and the processes may never end because you are not reading the stream until after it ends (you need to use muli-threading as explained in the article). If the process really did hange you could probably use destroy(); but, for now, the real problem is your code.

  • Two questions regarding shell scripts in automator

    they are both concerning this script:
    I pass it an .avi file (I believe it could also take more than one), and outputs a converted file (that is playable on appletv2) that is dumped in my "Converted" folder.  This all works fine and dandy.
    However, I would like to have it prompt the user for a destination folder, and pass that in as well.  However, I do not know how I would refer to that variable separately.
    Handbrake's CLI application also produces output that shows what percentage the conversion is at, and although the script passes this output as it's own output (to the next automator action - I actually discovered this only by accidentally leaving a "Speak Text" action in), I want to be able to see this output in real time.  Is there anyway to do this?  Thanks for the help!

    To be clear, this is what you mean, correct?
    for outpath; do :; done
    for f in "$@"
    do
        if [ "$f" != "$outpath" ];
              thenof="$outpath"/`basename "$if" .avi`.mp4
        /Applications/HandBrakeCLI -i "$if" -o "$outpath" --preset="AppleTV 2"
        fi
    done
    I assume that "Ask For Finder Items" also passes it's input along to the next action?  Would "Get Value of Variable" do the same thing?  (I also use the same workflow to convert .mkv files and copy .srt files to the same destination folder, so I need to access the source files multiple times to filter out different files each time).
    I would just test it myself, but I am not at my computer right now.
    And this is kind of off topic, but since automator actions can be written in shell script, could this be easily made into one? How much work would it involve? 

  • Why has the sql statement been extucted two times in shell script?

    I tried to test rac load balance using the following shell script on suse 10 + oracle 10g rac.
    oracle@SZDB:~> more load_balance.sh
    #!/bin/bash
    for i in {1..20}
    do
    echo $i
    sqlplus -S system/oracle@ORA10G <<EOF
    select instance_name from v\$instance;
    EOF
    sleep 1
    done
    exit 0After execute shell script, I got the follow result.
    oracle@SZDB:~> ./load_balance.sh
    1
    INSTANCE_NAME
    ora10g2
    INSTANCE_NAME
    ora10g2
    2
    INSTANCE_NAME
    ora10g1
    INSTANCE_NAME
    ora10g1
    3
    INSTANCE_NAME
    ora10g1
    INSTANCE_NAME
    ora10g1Seem the sql statement has been executed two times in each loop. If you feel free please help to have a look. Thanks in advance.
    Robinson

    You can end a SQL command in one of three ways:
    * with a semicolon (;)
    * with a slash (/) on a line by itself
    * with a blank line
    A semicolon (;) tells SQL*Plus that you want to run the current command that was entered. SQL*Plus processes the command and also stores the command in the SQL buffer.
    A blank line in a SQL statement or script tells SQL*Plus that you have finished entering the command, but do not want to run it yet, but it's stored the command on SQL Buffer.
    A slash (/) on a line by itself tells SQL*Plus that you wish to run the command stored on SQL buffer.

  • How to call a HP-UX command or shell script from Forms 4.5

    Does anybody know how to call a unix command or shell script to get a files list of HP-UX server from Oracle Forms 4.5 on client side? I tried to use DBMS_PIPE package to get it done but I failed. Please let me have the solution if anybody knows how. Very urgent!

    I tried the host command before and it just let me shell to the DOS environment but not HP-UX environment as Forms was running on Windows platform. So, I could not run a unix command or a shell script. Is DBMS_PIPE the only way to get it done?

  • How to roundoff addition of two double variables

    class Example
         public static void main(String args[])
              double k=1.236+2.138;
              System.out.println(k);
    }output of program:
    3.3739999999999997
    so how will i get the exact value of the addition

    etgohomeok wrote:
    If you know it's going to be 3 decimal places every time, you could always do:
    double d1 = 1.236;
    double d2 = 2.138;
    int i1 = (int) d1 * 1000;
    int i2 = (int) d2 * 1000;
    int iResult = i1 + i2;
    double dResult = ((double) iResult) / 1000;You could collapse that into a couple of lines and eliminate alot of the variables, but that's the general point...Unfortunately, that gives the wrong answer. Try running it and see.

  • How can I get OffLine ContentDB with Power Shell Script

    Hello All,
    How  can I get details of the all content database associated with specific Web application.  I am trying following command.
    Get-SPContentDatabase –WebApplication “http://spf2013dev1:3001”
    This is return results of database which are in ready state. I needs all the database which are in Offline status. Please post a comment.
    Thanks.

    Alternatively:
    $wa = Get-SPWebApplication http://webAppUrl
    foreach($db in ($wa.ContentDatabases | where {$_.Status -eq "Offline")){$db.Name}
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How to automate a cmd-K in a shell script

    I want my shell script (.sh file) to clear the screen and buffer before it executes the rest of the script. There doesn't appear to be a command to do this, however I know that the command-k keystroke does this. Is there a way to send a command K to the shell from a script?
    thanks

    Here it is (I hit control-C before it cleared the screen):
    zeppelin:Documents pswenson$ blah.sh
    2008-07-02 21:34:25.181 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x12f970 of class NSPathStore2 autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94577767 0x9457f4af 0x9457efae 0x94583a5b 0xc78e6 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.185 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x130440 of class NSPathStore2 autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94577767 0x94576869 0x94580fd2 0x94583c32 0xc78e6 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.187 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x1326f0 of class NSPathStore2 autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94577767 0x9457f4af 0x9457efae 0x9457eeb6 0x94584f58 0xc79fc 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.188 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x1320c0 of class NSBundle autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94576562 0xc79fc 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.191 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x132a30 of class NSCFArray autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94576562 0x945a88f1 0x945a88ba 0xc7ad2 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.192 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x133150 of class NSPathStore2 autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94577767 0x94576869 0x94580fd2 0x94580e62 0x945a905a 0x945a89bf 0x945a88ba 0xc7ad2 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.196 osascript[4815:10b] LCC Scroll Enhancer loaded
    2008-07-02 21:34:25.198 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x134e90 of class NSMachPort autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94576562 0x94595f65 0x945bce4f 0xce702 0xce5bf 0xc7b2e 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.199 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x136160 of class NSCFNumber autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94576562 0xcf1b2 0xce766 0xce5bf 0xc7b2e 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.200 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x1365a0 of class NSCFString autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94576562 0x945f702a 0xce766 0xce5bf 0xc7b2e 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.200 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x1365e0 of class NSPathStore2 autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94577767 0x94585d75 0xce782 0xce5bf 0xc7b2e 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07 0x28bfa5 0x283a2d 0x92c75f31 0x957d7168 0x29f6c4 0x29f7e2 0x29f915 0x29f11c 0x29f8c9 0x92c75f31 0x957e8513 0x20c9)
    2008-07-02 21:34:25.207 osascript[4815:10b] * _NSAutoreleaseNoPool(): Object 0x136770 of class NSCFData autoreleased with no pool in place - just leaking
    Stack: (0x94669cdf 0x94576562 0x9458ac35 0x945989fa 0x945988b8 0x945986d5 0xce79e 0xce5bf 0xc7b2e 0xc7b5b 0x957d8f97 0x957d92f6 0x9681bc74 0x9680d648 0x968167be 0x968195ab 0x91a6acaf 0x2a017a 0x2a3dfd 0x2a3fc0 0x28bc3d 0x28bf07

Maybe you are looking for