News:

Tekforums.net - The improved home of Tekforums! :D

Main Menu

Run script on opening a terminal window...

Started by M3ta7h3ad, February 26, 2008, 11:59:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

M3ta7h3ad

In work I work on various servers using ssh from one server to other servers in the work environment. (almost like an ssh proxy)

Ive written a little script to prompt for input for a server hostname and it makes the connection with the necessary settings.

Just wondering how I get this to run every time I open a terminal window? Tried .bash_profile but think that only comes into play when I first log into the server. Any ideas?

Mardoni

Not sure how to do what youre doing but a suggestion:

Add the script to the path and then you can just use it like an alias. i.e. I have a similar thing setup that appends the domain suffix to hostnames for me when I telnet. To telnet to one of these machines I do:

tel abc123

which runs my script; telnet abc123.xyz.com

hope that at least gives you a possible solution ?!?

cornet

M3ta7h3ad...  You using Linux ?!

If using gnome-terminal then just right click in term, select "Edit this profile"
Under the "Title and Command" tab then set the Custom Command to the name of your script.

If plain old xterm then call

xterm -e



Actually I think that sticking the command in .bashrc rather than .bash_profile might do the trick as well since .bashrc is executed for every interactive shell where as .bash_profile is only executed per login shell.


Oh and also "necessary settings" ?! - If they are ssh settings then stick them in ~/.ssh/config