LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-16-2010, 09:54 PM   #1
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 106

Rep: Reputation: 17
Is command line invocation of gnome-terminal to run more than one command possible?


Hello,

I am trying to learn how to pass more than a one-command startup for gnome-terminal.

I will give an example of what I'm trying to do here:
Code:
#! /bin/bash
#
#TODO write this for gnome and xterm

USAGE="
______________________________________________

${0##*/} [-x] [-g]

run midnight commander in a terminal window

-x	run in xterm (the default)
-g	run in gnome
______________________________________________
"

mcTerm () {
	sleep .5
	mc
	bash
}
export -f mcTerm

if [ "$1" = -h ] ; then echo "$USAGE" ; exit ; fi


if [ $# -lt 1 -o "$1" = -x ]; then
	(
	xterm -maximized -e mcTerm
	) &
else
	(
	gnome-terminal -x mcTerm
	) &
fi
The default option runs xterm without any problem.

However, running with the -g option to invoke gnome-terminal, I get a "There was an error creating the child process for this terminal" error.

This same error occurs if the gnome-terminal line is changed to
Code:
gnome-terminal -e mcTerm
Is there any way to pass more than one command on to gnome-terminal? I have tried various single and double quoting senarios and in a final attempt, I abstracted to an exported function all to no avail. Perhaps even though gnome-term is better at many things than xterm, xterm trumps it in this instance.

With thanks,
Narnie

Last edited by narnie; 02-17-2010 at 05:32 PM. Reason: Fix spelling and grammar
 
Old 02-16-2010, 10:53 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
<deleted>

Sorry... I was a little too trigger happy, testing now

Last edited by kbp; 02-16-2010 at 10:59 PM.
 
Old 02-17-2010, 05:31 PM   #3
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 106

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by kbp View Post
<deleted>

Sorry... I was a little too trigger happy, testing now
hehe, np
 
Old 02-17-2010, 06:37 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Doesn't seem to.... you could download the src to confirm though. Have you tried passing it a script ?
 
Old 02-17-2010, 10:39 PM   #5
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Wheezy (Fluxbox WM)
Posts: 1,363
Blog Entries: 52

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
You could perhaps run bash from within the gnome-terminal, ie:
Code:
gnome-terminal -x bash -c "sleep .5; mc; bash"
 
1 members found this post helpful.
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
run command in new gnome-terminal checkchan Linux - General 10 08-29-2012 03:55 AM
How do I resize the terminal window from the command line in the gnome terminal QuIcKSpArK Linux - Newbie 5 04-21-2012 02:04 PM
Command line gnome terminal question sudz28 Linux - Desktop 3 04-20-2012 03:21 AM
switching from command line terminal to gnome or kde odiliko Linux - Newbie 2 08-15-2006 11:27 PM
gnome-terminal command line startup fredgarvin Red Hat 2 09-16-2004 10:39 PM


All times are GMT -5. The time now is 02:17 AM.

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