0

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.

6
  • 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
0

Please, use this command:

gnome-terminal --title=$2 --command "ssh $1@$2" --window &
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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