Make a bash script run another file in Debian

1

I've finished installing a Team Fortress 2 server on my Debian server, and I'd like to create a bash script to start my server without having to run ./srcds_run -game tf -maxplayers 32 every time I want to start it. This file is located in /home/steam/orangebox.

I've tried created a bash script (named run.sh) like this:

#!/bin/bash
/home/steam/orangebox/./srcds_run -game tf -maxplayers 32

and I've done chmod -x run.sh and tried to run it, but when I run it, I get bash: ./run.sh: Permission denied returned.

What do I need to change to make this bash script work?

John

Posted 2012-08-16T14:24:36.813

Reputation: 121

You mean chmod +x run.sh? – Bobby – 2012-08-16T15:07:57.683

Answers

2

Assuming you have the rights to run it..

#!/bin/bash
/home/steam/orangebox/srcds_run -game tf -maxplayers 32

A single . is used for the current directory, .. for a level up, etc. There is no need to add it when you are using the full path.

If interested, some additional information on the dot commands can be found here.

p0rkjello

Posted 2012-08-16T14:24:36.813

Reputation: 555

Oh wow, I feel silly for not figuring that out. It works great now! Thank you! – John – 2012-08-16T14:38:37.080