Results 1 to 3 of 3
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-13-2013 #1
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?
Thanks.
- 01-13-2013 #2Linux Newbie
- Join Date
- Dec 2011
- Posts
- 112
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:Code:cd $DIR; xterm -e $COMMAND
SCRIPT.sh can be as complicated as you like.Code:#!/bin/sh cd $DIR $COMMAND $arg1 $arg2 $arg3
and then
Of course, change $DIR with the real directory, and $COMMAND with the real command.Code:xterm -e SCRIPT.sh
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.
- 01-13-2013 #3


Reply With Quote
