1

OS: Ubuntu Server 16.04 LTS, but willing to find a universal solution.

I have written a script that starts my Minecraft Server. Let's say I want to create a command (e.g. startmc) to start the server without tinkering with the path to the script, cd-ing to directory etc... So, how can I associate some Bash commands to a simple - custom command I can run from the Terminal or SSH?

  • 4
    Did you consider using an alias ? Such as alias startmc='cd my/directory/location; ./myscipt.sh' If you put this into your .bash_profile or .bash_rc, or even in .bash_aliases if it is being called by either of the former two I pointed out. – MelBurslan Aug 15 '16 at 22:13
  • 1
    since the alias is run from current shell, then I would add && cd - to return to your original directory at the end of that alias. – Jeff Puckett Aug 15 '16 at 22:17
  • 2
    tinkering with the path to the script, cd-ing to directory etc um, that's what scripts are actually for . . . .or .bashrc functions. You write it once, execute each time after you set this up properly. And why are you even trying to do bash if you don't like tinkering ? – Sergiy Kolodyazhnyy Aug 15 '16 at 22:30
  • I meant, tinker with the path EVERY single time I want to start my server. I'd like to just open SSH on my phone, run startmc and start my Minecraft server without having to cd to the script and server folder everytime. – Manchineel Aug 16 '16 at 08:18

0 Answers0