Prevent terminal from closing after command execution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Prevent terminal from closing after command execution
# 1  
Old 06-11-2012
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:
Code:
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:
Code:
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?

Moderator's Comments:
Mod Comment Please use next time
code tags for your code and data

Last edited by vbe; 06-11-2012 at 09:09 AM..
# 2  
Old 06-11-2012
what does this command line give you:
Code:
gnome-terminal --sync -x tcsh -exec "cd xys&& command xxx; exec tcsh" &   # or:
gnome-terminal --sync -x tcsh -exec "cd xys; command xxx && exec tcsh" &


Last edited by vbe; 06-11-2012 at 09:59 AM.. Reason: typos
# 3  
Old 06-11-2012
Using && instead of ; in the command does not change the problem that if there is a exec tcsh in the end of line the settings loaded before that are lost.
I want to do
gnome-terminal --sync -x tcsh -c "cd <some_folder>; some_command ;" &
And terminal to remain opened after some_command execution.

If in xterm that is possible I can use it instaed of gnome-terminal.
# 4  
Old 06-11-2012
Its the first - exec I wanted to know about for I have no tcsh... can only emulate in ksh without gnome...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Answers to Frequently Asked Questions

How to prevent sed command removing whole line?

hello, I'm using sed command to extract the text between 2 special characters which are /* and */ I used following command to do this. sed -n '/\/\*/,/\*\//p' file.txt But if the file.txt contains a line something like this, a=5; /* this is a comment */ the above command... (3 Replies)
Discussion started by: beginner_99
3 Replies

2. Shell Programming and Scripting

How to prevent command from deleted

Hi, I've been searching around for solution, hope that some gurus here can help. I'm using some commands in my shell script and I'd like to protect these command to be moved to another directory. For instance, cp currently in /bin/cp. If I move it to /bin/cpxxx, my script will not be able to... (3 Replies)
Discussion started by: gklntn
3 Replies

3. Shell Programming and Scripting

Sed command to replace with pattern except for text and closing parentheses

Can someone help me with a sed command: There will be multiple occurences in a file that look like this: MyFunction(12c34r5) and I need to replace that with just the 12c34r5 for every occurrence. The text between the parentheses will be different on each occurrence, so I can't search for that.... (4 Replies)
Discussion started by: missb
4 Replies

4. Shell Programming and Scripting

Terminal is closing on exit in ksh

hi while executing the following script, my terminal window is getting closed if I enter a invalid option. I want the script should go back the the command prompt. how to do achive it. i execute the script as . ./test #! /usr/bin/ksh Printf " Type of Installer : \n\t\t 1. Whole Build... (3 Replies)
Discussion started by: vij_krr
3 Replies

5. Cybersecurity

prevent user from excute command

Dears I want to prevent users from doing spesific command "history -c" or "history" in general How can I do ? (4 Replies)
Discussion started by: reaky
4 Replies

6. Shell Programming and Scripting

Closing sockets with shell-command ?

Hello everyone. (I have found in this forum lots of infos about closing socket in c, and others lenguages but never with shell-command) Im developing a tool over tcl/tk; in this application i open a socket to communicate with a ada application. In the init script i open both programs (tcl... (2 Replies)
Discussion started by: trutoman
2 Replies

7. UNIX for Dummies Questions & Answers

xterm closing automatically after command excution

Hi, I have a commands in a file called commands.file, I am using this file with the following commnad xterm -e "commands.file" After executing this file in the new xterm, it is closing automatically. I want to use that xterm after that. Please help me regarding this? :) ... (4 Replies)
Discussion started by: chaitubek
4 Replies

8. Linux

Terminal Execution By Giving a Command

Hi Guys, I am using Red Hat Linux 5 and GNOME Terminal is available there in the Accessories menu of Applications. But I don't see any run command option which can be used to type the name of the terminal and execute it directly as I used to do it under Mandrake Linux wherein I would type... (2 Replies)
Discussion started by: indiansoil
2 Replies

9. AIX

How to prevent an application from closing a file

I'm writing some software tests, & one of my test cases is to prevent an address space from closing a data file (file is closed & a new one opened every 15 minutes). I can't remove or rename the file while it's being written to, any other ideas to prevent a file from being closed - or at least... (4 Replies)
Discussion started by: jasahl
4 Replies

10. UNIX for Advanced & Expert Users

how to run a process after closing the terminal

i want to execute a shell script even if the terminal is closed. how to do? (3 Replies)
Discussion started by: lakshmananindia
3 Replies
Login or Register to Ask a Question