Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I'm wondering if anyone can spot some errors in this script. I'm only really interested in Syntax errors (or logical ones if they are blatant!) I have not ...
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    2
    Hi all,

    I'm wondering if anyone can spot some errors in this script.

    I'm only really interested in Syntax errors (or logical ones if they are blatant!)

    I have not run this script yet, the Linux machine is not yet available.

    I'm looking for a heads up on obvious syntax errors before I let her rip..

    Thanks in Advance,
    Patrick


    You can assume that the VARIABLES MOM_HOME and JAVA_HOME are well defined.


    -----------------------------------------------------------------------------------------
    Code:
    #!/bin/sh -vx
    ################################################## #####
    # 
    ################################################## #####
    
    
    # Verify if MOM_HOME is well defined
    
    if [ -f $MOM_HOME/tests/tests.jar ]
    then
    
        # Verify if JAVA_HOME is well defined
    
        if [ -f $JAVA_HOME/bin/java ]
        then
    
            export HOST=10.1.1.50
    
            export CLASSPATH=$MOM_HOME/joram-mom.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/JCup.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/spring-core.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/spring-dao.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/spring-jdbc.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/spring-jmx.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/spring-web.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/tests/tests.jar
            export CLASSPATH=$CLASSPATH;$MOM_HOME/tests/junit-4.1.jar
        
            $JAVA_HOME/bin/java -classpath $CLASSPATH com.babelnetworks.service.messaging.impl.Util $HOST root root intTestCleanup 0
            $JAVA_HOME/bin/java -classpath $CLASSPATH com.babelnetworks.service.messaging.impl.Util $HOST root root intTestSetup 0
            $JAVA_HOME/bin/java -classpath $CLASSPATH com.babelnetworks.service.messaging.impl.Util $HOST root root info
    
        else
    
            echo "The JAVA_HOME environment variable is not defined correctly"
    
        fi
    
    else
    
    echo "The MOM_HOME environment variable is not defined correctly"
    
    fi
    
    
    #END
    --------------------------------------------------------------------------
    Last edited by devils casper; 08-14-2007 at 04:25 PM. Reason: Posts merged.

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    I think your CLASSPATH will work better with colon separators, not semicolons. This isn't a toy system, remember!

  3. #3
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    A couple notes:
    • /bin/sh is actually just a symlink to /bin/bash on most GNU/Linux systems, FWIW.
    • You can check for syntax errors on your own.
      Example: bash -n /path/to/script

  4. #4
    Just Joined!
    Join Date
    Aug 2007
    Posts
    2
    Quote Originally Posted by anomie View Post
    A couple notes:
    • /bin/sh is actually just a symlink to /bin/bash on most GNU/Linux systems, FWIW.
    • You can check for syntax errors on your own.
      Example: bash -n /path/to/script

    Thanks for the tip. quite a good idea!


    I think your CLASSPATH will work better with colon separators, not semicolons. This isn't a toy system, remember!

    of course it is! Linux programmers always have so much fun!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...