LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-30-2010, 12:25 PM   #1
Ronayn
Member
 
Registered: Jan 2006
Posts: 55

Rep: Reputation: 0
Question gnome-terminal exits after executing parameter sent with "-x" option


I have a bash script that launches an application of mine through a gnome terminal with the following command:

gnome-terminal -x MyApplication

If MyApplication launches correctly, a GUI is displayed. If it fails to launch correctly, it reports errors to stdout (the terminal).

My problem is, the terminal immediately exits when MyApplication exits, leaving no time to see the error messages if MyApplication fails to launch.

You can also see this behavior by trying:

gnome-terminal -x ls

The gnome terminal immediately exits. Is there a way to stop this behavior? I want the terminal to remain until I close it.
 
Old 08-31-2010, 08:28 AM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
gnome-terminal -x bash -c "ls; cat"

If you want the terminal to time out, replace "cat" with "sleep 10" (for 10 seconds).

Note: you can also use zenity, dialog or whiptail to display message boxes.

Last edited by jay73; 08-31-2010 at 08:33 AM.
 
Old 08-31-2010, 09:04 AM   #3
Ronayn
Member
 
Registered: Jan 2006
Posts: 55

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jay73 View Post
gnome-terminal -x bash -c "ls; cat"

If you want the terminal to time out, replace "cat" with "sleep 10" (for 10 seconds).

Note: you can also use zenity, dialog or whiptail to display message boxes.
Thanks, the does solve part of the problem (I'd get to see the error messages), but I'd still like to use that terminal. Is there no way to force it to remain?
 
Old 08-31-2010, 02:44 PM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Are you sure you need two terminals? The gnome-terminal command opens a new one so if it is closed, you still have the one that the script was launched from.
 
Old 10-02-2010, 05:10 PM   #5
glarrain
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
I have the same question, but I don't have the first terminal because I launch the script from Nautilus.

Any ideas?

Thanks
 
Old 10-03-2010, 05:36 AM   #6
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
I don't know about gnome-terminal, but xterm has the -hold option
Code:
xterm -hold -e ls *
 
Old 06-08-2011, 08:31 AM   #7
sarpedon.tan
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
to avoid "gnome-terminal -x commands" to stop just start a new shell inside that terminal

start a shell in the started terminal e.g.
gnome-terminal -x bash
 
1 members found this post helpful.
  


Reply

Tags
bash


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 02:03 AM
Is there a "always on top" option for gnome-terminal? jsjones85 Linux - Newbie 4 06-04-2010 07:06 AM
getting "parameter has incomplete type" and "conflicting types" error yogi.aash Linux - Newbie 2 05-31-2010 07:25 PM
"New Login in a Window" Gnome option gives error message kushalkoolwal Debian 2 03-14-2009 12:14 PM
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 05:23 AM


All times are GMT -5. The time now is 01:23 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration