Is command line invocation of gnome-terminal to run more than one command possible?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is command line invocation of gnome-terminal to run more than one command possible?
# 1  
Old 02-16-2010
Is command line invocation of gnome-terminal to run more than one command possible?

Hello,

I am trying to learn how to pass something 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 withoug 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

A new OSX 10.12.x terminal from the command line.

Hi guys and gals... After much searching on the good ol' internet I could find nothing, so this is the result. ALthough many people seem to have asked this question no-one seems to have a solution so here we go. I need for AudioScope.sh, 'xterm' to run a second program for some of its... (2 Replies)
Discussion started by: wisecracker
2 Replies

2. Shell Programming and Scripting

Open gnome-terminal with multi tabs and automatically run a script in each tab

Hi All , i am trying to create an alias to open a new gnome-terminal and run some commands in each tab & to have a specific name for each tab i am using csh , tried this command gnome-terminal --tab -t "s1" --tab -t "s2" --tab -t "s3" --tab -t "s4" it opened 4 tabs but the title didn't... (0 Replies)
Discussion started by: Assem
0 Replies

3. Shell Programming and Scripting

Problem run script inside a gnome-terminal

hi, I would like to ask about using gnome-terminal command, I had a script that will run my VBOX VM in headless and i want to display the output(STDOUT) on the gnome-terminal window. The purpose that i want to display the STDOUT of the script cause i will used it or create a desktop shortcut for... (11 Replies)
Discussion started by: jao_madn
11 Replies

4. Shell Programming and Scripting

command invocation

Hello, I've tested something like this: tcpdump -r /tmp/out.out > /tmp/out.ra 2> /dev/null works fine - there is no status message visible. if I place in a bash-script this line: $(tcpdump -r /tmp/out.out > /tmp/out.ra 2> /dev/null) I get status information on executing :confused:. I... (2 Replies)
Discussion started by: daWonderer
2 Replies

5. Ubuntu

run multiple command at the same time in one window terminal using multiplexer

Hi, I would like to ask if someone knows or accomplished this task in the terminal multiplexer in a single window with multiple splitted pane: In the script run multiple command at the same time in diff splitted pane or simulatneously. As an example: I would like to run iptraf, iotop, htop,... (2 Replies)
Discussion started by: jao_madn
2 Replies

6. Linux

How to open a gnome-terminal in specific workspace and run script within it automatically upon login

OK this is a bit messy. I run Fedora with gnome on a compiz desktop, I have a script (userstart) that opens my 'standard' environment for all my machines when I login. userstart flips to a specific workspace and then opens the required applications in that workspace then flips to the next... (2 Replies)
Discussion started by: Bashingaway
2 Replies

7. UNIX for Dummies Questions & Answers

Script to run a command in a new terminal

Hey, I am trying to write a script that will open all of my session windows, and then secure shell into the appropriate server in the new windows. Seems simple, but I cant get it to work! Please help! :confused: (1 Reply)
Discussion started by: sojo1024
1 Replies

8. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

9. Shell Programming and Scripting

Need Mac .sh to run command line app in seperate terminal

Hello, currently we are executing a .sh from terminal. The current .sh looks like this: #!/usr/bin/env bash /Users/user/my.app/Contents/MacOS/my & -- Now, we also need to run a third line in the .sh - It's a command line application that I need to run when I execute the above .sh... (0 Replies)
Discussion started by: yoyoyo777
0 Replies

10. UNIX and Linux Applications

Gnome file associations from command line

Sol 10 x86 update 4 , trying to find out how to set acroread file associations from the command line. (0 Replies)
Discussion started by: squrcles
0 Replies
Login or Register to Ask a Question