Centos Minecraft Server Setup Script
#21
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.
Reply
#22
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.
Reply
#23
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.
Reply
#24
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
Reply
#25
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.
Reply
#26
Code:
#!/bin/bash
read test
if [ "$test" = "" ]
then echo yay
else echo nope

fi
Wink
Reply
#27
Thanks f8ll, that works perfectly.
@aatish910
I'm pretty sure that in Bash = = = Tongue
Reply
#28
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.
Reply
#29
Sorry about the name thing. I've edited my post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)