Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to scripting, but somewhat familiar with Linux. I am actually using this on a Fedora16 build, with Gnome3 and gnome-terminal... fyi.

I flip through all sorts of ssh terminals all day long and I thought it would be nice to create a ssh script called lambda that contains information that is sent to a terminal_wrapper script that accepts all sorts of variables and creates a new gnome-terminal based on those given variables. The information I would like would be to rename the title, change bg and fg colors, and start an ssh in a new gnome-terminal window.

I feel like I'm close to getting the ssh to work, but I'm missing something. Here is what I've got for my ssh script for lambda:

terminal_wrapper user lambda.company.com

And here is my terminal_wrapper:

gnome-terminal --title=$2 -e ssh $1 $2

It opens a new window for me, renames it to the lambda.company.com, and then sits there and closes after a second.

Any help? Thanks.

share|improve this question

migrated from askubuntu.com Jan 15 '12 at 18:48

This question came from our site for Ubuntu users and developers.

I think it should be gnome-terminal --title=$2 -e ssh "$1"@"$2" – bodhi.zazen Jan 9 '12 at 22:45
You may also want to look at getopt (and either error checking or setting defaults) aplawrence.com/Unix/getopts.html – bodhi.zazen Jan 9 '12 at 22:52
Changing it to "$1"@"$2" seems to make sense, but doesn't seem to work for me. Anything else I might be missing? I'll check out getopts too. – Mr. Monkey Jan 9 '12 at 22:59
Try without the quotes $1@$2 – bodhi.zazen Jan 9 '12 at 23:02
Nope. Didn't work either. – Mr. Monkey Jan 9 '12 at 23:20
up vote 0 down vote accepted

Please, use this command:

gnome-terminal --title=$2 --command "ssh $1@$2" --window &
share|improve this answer

After trying a couple more things a friend suggested that maybe the -e command on gnome-terminal expects a complete command. After changing the code to the following it works:

gnome-terminal --title=$2 -e "ssh $1@$2"

Thanks for your input.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.