LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 06-11-2012, 03:51 AM   #1
tyanata
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Rep: Reputation: Disabled
prevent terminal from closing after command execution.


Hello,

I want to create application which launches some terminal, then some command is executed on that terminal and then prevent terminal from closing.

I started to do on gnome-terminal because the Gnome is the most widely used desktop-manager in the Linux distributions.

I want to do something like that:
gnome-terminal --sync -x tcsh -c "cd xys; command ;" &

In konsole there is a --noclose option preventing the terminal from closing after the command execution.

I can do it like that:
gnome-terminal --sync -x tcsh -c "cd xys; command xxx ; exec tcsh; " &
But then I lose the certain settings which I loaded in the terminal during the command xxx execution.

Do you know how to prevent gnome-terminal from closing after the command execution?
 
Old 06-11-2012, 05:31 AM   #2
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 609

Rep: Reputation: 180Reputation: 180
Can't you just embed the stdout (and stderr if meaningful) of the command you need to launch inside a window created by your own application? This way you won't depend on anything from a desktop environment.
If you can't, then I guess you should use xterm instead of gnome-terminal of konsole if you aim to target the majority of desktop users.
 
Old 06-11-2012, 06:48 AM   #3
tyanata
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
The application which I want to start is tool which is terminal based, so in fact we have to open terminal, load tcsh, set some environmental variables and then launch it ( it is a CAD design tool called Cadence ). Could not predict what will be the impact on the tool's functionality if the terminal closes after it launching.
What we want to do is to create GUI form which will make work of people easier, they just will choose the project they want to work on, and then terminal will be created, tcsh environment will be loaded and the application will be started.
Regarding xterm it is good suggestion, but I think it also closes after command execution.

Best regards,

tyanata
 
Old 06-11-2012, 09:52 AM   #4
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 609

Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by tyanata View Post
The application which I want to start is tool which is terminal based, so in fact we have to open terminal, load tcsh, set some environmental variables and then launch it ( it is a CAD design tool called Cadence ).
I don't know what language/platform you're using for this GUI application you're designing, but you should be able to launch a tcsh shell with the given environment variables and commands to execute (the -c option) and, then, capture its stdin,stdout and stderr so you can display them as you please inside a window you manage.
Quote:
Originally Posted by tyanata View Post
Regarding xterm it is good suggestion, but I think it also closes after command execution.
See the -hold option in the man page or, directly, in a xterm instance.
For example, running a 'set' command in a tcsh shell inside xterm without exiting after the command is run:
Code:
SHELL=/bin/tcsh xterm -hold -e set

Last edited by 414N; 06-11-2012 at 10:10 AM.
 
  


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
[SOLVED] how can I prevent my laptop from suspend or hibernate when closing its lid? TroN-0074 Linux - Newbie 8 03-31-2012 10:35 AM
How to prevent the execution of malicious commands? sulekha Linux - Security 3 10-16-2010 06:15 PM
prevent accidental closing of a window manoj_isi Linux - General 3 07-12-2009 04:51 AM
Prevent XLIB application from closing when close button pressed fcdev Programming 1 11-11-2007 02:47 PM
Closing a port in linux terminal..any command?? fhameed Linux - Security 1 07-21-2004 12:46 AM


All times are GMT -5. The time now is 04:45 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration