Find the answer to your Linux question:
Results 1 to 7 of 7
Hello, I am trying to create a .sh file with a list of command to run with one command. What I am trying to do is similar to a .bat ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2006
    Posts
    7

    Creating a sh file


    Hello,

    I am trying to create a .sh file with a list of command to run with one command. What I am trying to do is similar to a .bat file in windows.

    I have the following commands (one per line) in my output.sh file but they do not seem to work after the first command.

    javac com/medstory/nsf/ppi/ProteinInteractionFinder.java
    java org.apache.axis.wsdl.Java2WSDL -o com/medstory/nsf/ppi/ProteinInteractionFinderService.wsdl -l"http://localhost:8080/axis/services/ProteinInteractionFinderService" -n"ppi.nsf.medstory.com" com.medstory.nsf.ppi.ProteinInteractionFinder
    java org.apache.axis.wsdl.WSDL2Java -S true com/medstory/nsf/ppi/ProteinInteractionFinderService.wsdl
    javac com/medstory/nsf/ppi/*.java
    java org.apache.axis.client.AdminClient com/medstory/nsf/ppi/deploy.wsdd


    How do I get all these commands to run in a file called output.sh?

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    You need to put the magic bytecode into it to identify it as a script
    Code:
    #!/bin/sh
    I would normally suggest having a look at the advanced bash scripting guide but you seem to be using mostly java there.

  3. #3
    Just Joined!
    Join Date
    Aug 2006
    Posts
    7
    Quote Originally Posted by bigtomrodney
    You need to put the magic bytecode into it to identify it as a script
    Code:
    #!/bin/sh
    I would normally suggest having a look at the advanced bash scripting guide but you seem to be using mostly java there.
    I actually had that and it still doesn't work. I just want these java command to be done when I use this shell file.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    Make sure you've made the script executable.

    Code:
    chmod 777 output.sh
    If this doesn't solve your problem, please give more info such as what happens when you try to run it. Most error messages point to the problem

    DT

  6. #5
    Just Joined!
    Join Date
    Aug 2006
    Posts
    6
    Make sure, the basics are followed

    1] Add the magic line
    2] chmod u+x file.sh
    3] ./file.sh

    Make sure the commands inside the shell scripts are syntatically and semantically correct.
    A little more o/p information from you will be easy for debugging

  7. #6
    Just Joined!
    Join Date
    Aug 2006
    Posts
    7
    When I do this I get the error message

    : bad interpreter: No such file or directory


    Quote Originally Posted by rajkumarmathavand
    Make sure, the basics are followed

    1] Add the magic line
    2] chmod u+x file.sh
    3] ./file.sh

    Make sure the commands inside the shell scripts are syntatically and semantically correct.
    A little more o/p information from you will be easy for debugging

  8. #7
    Just Joined!
    Join Date
    Dec 2011
    Posts
    1

    create the file

    I had created the file using the vi editor. i had copied the loading.sh and pasted it in the editor. then saved and made executable. The problem i had was making it stop when my program started.

    1. enter vi loading
    2. press i
    3. pasted script
    4. press shift+: then x
    5. enter chmod u+a loading
    5. exicute with ./loading

Posting Permissions

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