cd in script

wez1007

Senior Member
Joined
Oct 31, 2012
Messages
912
Reaction score
0
Location
KZN
Hi guys.

im fairly new to linux and terminals but i am setting up a minecraft server with a teamspeak server and have managed to get a few things running through scripts.

i want to use a script to start up said applications when the computer is logged onto (it logs in automatically) but the problem is i cant seem to cd to a directory and run a file / script in that directory.

at the moment i have this:
Code:
#!/bin/sh
xterm -hold -e java -d46 -Xincgc -Xmx1024M -jar /home/wesley/craftbukkit.jar

which does work. the only problem is i have the server files al over my home directoy which is messy. ideally id like to have the files in /home/wesley/Bukkit_server

i can then load this script into the startup applications and hopefully all will be good

thanks a mil!
 
Hi guys.

im fairly new to linux and terminals but i am setting up a minecraft server with a teamspeak server and have managed to get a few things running through scripts.

i want to use a script to start up said applications when the computer is logged onto (it logs in automatically) but the problem is i cant seem to cd to a directory and run a file / script in that directory.

at the moment i have this:
Code:
#!/bin/sh
xterm -hold -e java -d46 -Xincgc -Xmx1024M -jar /home/wesley/craftbukkit.jar

which does work. the only problem is i have the server files al over my home directoy which is messy. ideally id like to have the files in /home/wesley/Bukkit_server

i can then load this script into the startup applications and hopefully all will be good

thanks a mil!

Before Linux people start streaming in I just want to point you to Feed the Beast
 
will have a look at that sometime. bit sad that they dont have a nice write up on that.. would like to have known more about it
 
You could try something like this, assuming you have a script called script.sh in /home/user1/scripts

Code:
#!/bin/sh
cd /home/user1/scripts        #change to scripts directory
./script.sh                   # Execute script called script.sh...change to whatever your script file name

Remember to make all your scripts executable with

Code:
chmod a+x script.sh
 
thanks ill give that a shot!

might have been missing the ./ but from what ive read that's meant to go up one directory (parent directory?) if it works it works (the problem is fixed and i don't really need to know why :P ) as long as i can replicate it a few more times
 
it did indeed work! can finaly run Bukkit from a neat folder on startup!
 
might have been missing the ./ but from what ive read that's meant to go up one directory (parent directory?)

Close, ./ represents the directory you are in and ../ represents the parent directory.
 
Top
Sign up to the MyBroadband newsletter
X