Post Reply 
Centos Minecraft Server Setup Script
03-27-2012, 04:49 PM
Post: #21
RE: Centos Minecraft Server Setup Script
I'm going to be adding a few more features to the script before fully releasing it.
An example of a new feature would be that the script will ask you which version of CraftBukkit you want downloaded. The version would go by http://dl.bukkit.org/downloads/craftbukkit/
If you want the current recommended build, you can just leave it blank.
If you want the current beta build, you can type in beta and press enter.
If you want the current development build, you can type in dev and press enter.

I'll probably also be writing a new script that'll update your craftbukkit.jar file if a new recommended build comes out. It'll probably just be a wget to link.
User Tools
Quote this message in a reply


03-28-2012, 11:59 AM
Post: #22
RE: Centos Minecraft Server Setup Script
Does anyone know how to do if-thens for multiple words.

I'm trying to do the recommended/beta/development part. However, what I'm trying to do is that if they type in something that isn't one of the three words (blank (as in just pressing enter), beta, dev), then the script will go back and ask them to re-type that part.
User Tools
Quote this message in a reply
03-28-2012, 12:22 PM
Post: #23
RE: Centos Minecraft Server Setup Script
If ... elif....else....fi
E.g:
Code:
print "Input command"
read command
if command=="dev"
do this
elif command=="production"
do this
else
print "error"
A high level pseudo-code.

Don't worry about the world coming to an end today. It's already tomorrow in Australia.
User Tools
Quote this message in a reply
03-28-2012, 12:29 PM
Post: #24
RE: Centos Minecraft Server Setup Script
At the moment, I'm having trouble with the part where if you want the latest recommended build, just leave it blank and press enter, but I'm not sure how to do the if part.
I tried:

#!/bin/bash
read test
if [ $test = "" ]
then echo yay
else echo nope

fi

Normal words in there work:
[root@deathproxy ~]# ./test.sh
test
nope

Blank doesn't:
[root@deathproxy ~]# ./test.sh

./test.sh: line 3: [: =: unary operator expected
nope
User Tools
Quote this message in a reply
03-28-2012, 12:31 PM
Post: #25
RE: Centos Minecraft Server Setup Script
Is that "==" or "=" ? Mostly, "==" is used for comparision in many language. I am not too experienced on bash.
Code:
read -n3 COMMAND
if [[ "$COMMAND" == ""]]
then
echo "Yeah";
-n3 flag makes bash to accept input of length 3.

Don't worry about the world coming to an end today. It's already tomorrow in Australia.
User Tools
Quote this message in a reply
03-28-2012, 12:37 PM
Post: #26
RE: Centos Minecraft Server Setup Script
Code:
#!/bin/bash
read test
if [ "$test" = "" ]
then echo yay
else echo nope

fi
Wink
User Tools
Quote this message in a reply
03-28-2012, 12:56 PM
Post: #27
RE: Centos Minecraft Server Setup Script
Thanks f8ll, that works perfectly.
@aatish910
I'm pretty sure that in Bash = = = Tongue
User Tools
Quote this message in a reply
03-28-2012, 04:12 PM
Post: #28
RE: Centos Minecraft Server Setup Script
I found that "==" and "=" both work on Bash.

Don't worry about the world coming to an end today. It's already tomorrow in Australia.
User Tools
Quote this message in a reply
03-28-2012, 04:14 PM
Post: #29
RE: Centos Minecraft Server Setup Script
Sorry about the name thing. I've edited my post.
User Tools
Quote this message in a reply
Post Reply 


Forum Jump:



User(s) browsing this thread:
1 Guest(s)