Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How do I run .sh files in Terminal?

I'm trying to install Craftbukkit on my Ubuntu 12.04 server. However, I'm having issues with step seven, which instructs me to run ./craftbukkit.sh.

If I run it as a normal user, then I get a permissions error. If I run it using sudo, then I get sudo: ./craftbukkit.sh: command not found.

What am I doing wrong?

share|improve this question

marked as duplicate by Eliah Kagan, jokerdino, Mitch, devav2, Tom Brossman Oct 7 '12 at 11:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

You need to chmod the file 1st before run.

chmod +x file.sh

Now your can run your .sh file as follows

./file.sh

Another way to run .sh file in Linux

sh file.sh

OR

bash file.sh
share|improve this answer
    
It was already executable. –  SomeKittens Jun 19 '12 at 18:21

According to the wiki page of bukkit.

[...] type sh craftbukkit.sh to execute the script you wrote before. Your server will start and keep running until you stop it (or until it crashes).

share|improve this answer
    
Thanks, this helped me find the issue (Java wasn't installed. Duh....) –  SomeKittens Jun 19 '12 at 18:20
    
Passing an explicit shell instead of letting the system infer the right script form the shebang might lead to errors. It*s just a matter of luck that it worked here. –  user unknown Jun 19 '12 at 19:10
    
@userunknown: Well these are the contents of craftbukkit.sh: #!/bin/sh screen java -Xms1024M -Xmx1024M -jar craftbukkit.jar wiki.bukkit.org/Setting_up_a_remote_Linux_server –  pl1nk Jun 19 '12 at 19:44
1  
I told you, that it might be a matter of luck, if it works. Why don't you use sudo ./craftbukkit.sh? –  user unknown Jun 19 '12 at 20:55
1  
@userunknown You have to chmod +x ./craftbukkit.sh first, in this situation.. –  Eliah Kagan Jun 19 '12 at 21:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.