LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Is command line invocation of gnome-terminal to run more than one command possible? (https://www.linuxquestions.org/questions/programming-9/is-command-line-invocation-of-gnome-terminal-to-run-more-than-one-command-possible-789599/)

narnie 02-16-2010 09:54 PM

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

kbp 02-16-2010 10:53 PM

<deleted>

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

narnie 02-17-2010 05:31 PM

Quote:

Originally Posted by kbp (Post 3866406)
<deleted>

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

hehe, np ;)

kbp 02-17-2010 06:37 PM

Doesn't seem to.... you could download the src to confirm though. Have you tried passing it a script ?

neonsignal 02-17-2010 10:39 PM

You could perhaps run bash from within the gnome-terminal, ie:
Code:

gnome-terminal -x bash -c "sleep .5; mc; bash"


All times are GMT -5. The time now is 12:21 AM.