LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-06-2010, 02:23 PM   #1
kusti85
LQ Newbie
 
Registered: Oct 2006
Posts: 7

Rep: Reputation: 0
How to get gnome terminal execute different commands from diff. tabs?


In gnome terminal it is possible to open multiple tabs with
Quote:
$ gnome-terminal --tab-with-profile=jake_lardasset --tab-with-profile=virtualsexgranny -x alpine
We got even further....


Quote:
gnome-terminal --tab-with-profile=james_treesexer --command pymol --tab-with-profile=loverboy13 --command alpine
and pymol runs, but not in the tab and alpine runs in the tab.

The problem is, that when using a script to check mail it has to be
Quote:
gnome-terminal --tab-with-profile=chrissypink --command alpine --tab-with-profile=jake_hugerichard -x ssh xxxx@xxxx.ut.ee
not the other way around

Is there a simpler way to do this?
And why is it not possible to execute ssh with the --command parameter and -x has to be used ,but top and so on can be executed with --command

Last edited by kusti85; 01-06-2010 at 02:47 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-06-2010, 05:11 PM   #2
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 47
This can be solved by quoting commands:

Code:
gnome-terminal --tab-with-profile=chrissypink --command alpine --tab-with-profile=jake_hugerichard -x ssh xxxx@xxxx.ut.ee
can be re-written as

Code:
gnome-terminal --tab-with-profile=jake_hugerichard --command "ssh xxxx@xxxx.ut.ee" --tab-with-profile=chrissypink --command alpine
The problem is that the shell parses the command line into individual words before it executes the program. Let's say that you left off the quotes:

Code:
gnome-terminal --tab-with-profile=jake_hugerichard --command ssh xxxx@xxxx.ut.ee --tab-with-profile=chrissypink --command alpine
Here's how the shell would tokenize that line (i.e. break that line apart):

Code:
gnome-terminal 
--tab-with-profile=jake_hugerichard 
--command 
ssh 
xxxx@xxxx.ut.ee 
--tab-with-profile=chrissypink 
--command 
alpine
'--command' works on the next token... in this case 'ssh'

If you quote it, you get this:

Code:
gnome-terminal 
--tab-with-profile=jake_hugerichard 
--command 
"ssh xxxx@xxxx.ut.ee" 
--tab-with-profile=chrissypink 
--command 
alpine
Because the shell sees "ssh xxxx@xxxx.ut.ee"as a single token.

--command then picks up "ssh xxxx@xxxx.ut.ee"as a single token, and is able to process it correctly.
 
2 members found this post helpful.
Old 01-06-2010, 06:16 PM   #3
kusti85
LQ Newbie
 
Registered: Oct 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks.
That is a lot.....simpler than I thought....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute a command in all tabs in gnome-terminal ganesh_k Linux - Newbie 3 11-01-2008 12:11 PM
Can you dynamically set the title of new tabs in gnome terminal? hroit Linux - General 9 08-23-2007 04:22 PM
Can you dynamically set the title of new tabs in gnome terminal? hroit Linux - General 1 08-13-2007 05:24 AM
Using tabs with Eterm similar to Gnome terminal O(V)eGA_l2el) Fedora 0 11-21-2006 09:37 AM
Execute terminal commands from .desktop files tuculover Linux - Newbie 6 10-22-2004 06:49 PM


All times are GMT -5. The time now is 05:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration