Simple bash file.
First off I would like to say that I have googled my answer before coming here but I've had no luck(or maybe im blind :P)
All I want is to create a bash file that opens terminal, cd to a directory and runs a command. I've had no luck with getting this to work. Any help?
There's a few options here.
If the command is simple:
Or, if the command is complex or variable, make a shell script, SCRIPT.sh, and do chmod +x SCRIPT.sh, and put it somewhere in your $PATH:
cd $DIR; xterm -e $COMMAND
SCRIPT.sh can be as complicated as you like.
$COMMAND $arg1 $arg2 $arg3
Of course, change $DIR with the real directory, and $COMMAND with the real command.
I use this all the time to create a menu of various config options, for example. Once the script terminates, the xterm goes away too. If you want to see the output of the command, put a 'read' at the end of the script so it will wait for a keypress before closing.
Hope that helps.
Thanks. That helped a lot :D