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?
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&& cd -
to return to your original directory at the end of that alias. – Jeff Puckett Aug 15 '16 at 22:17tinkering 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