[NTLUG:Discuss] How to keep an xterm from closing after command is finished?

steve sjbaker1 at airmail.net
Sat Dec 17 17:00:14 CST 2005


Lance Simmons wrote:
> * steve <sjbaker1 at airmail.net> [051217 00:17]:
> 
>>Lance Simmons wrote:
>>
>>>I want to run a command in an xterm or a gnome-terminal and keep the
>>>terminal open in order to look at the results after the command is
>>>finished.  How do I do it?
>>
>>  xterm -hold -e mycommand
>>        ^^^^^
>>      Add this
>
> Thanks.  That works, but unfortunately nautilus does not pass the
> appropriate relative path to xterm.  "No absolute path found for shell"
> is the error xterm gives.  Nautilus gives gnome-terminal the correct
> relative path.
> 
> Fortunately, there's a roundabout way to do this in gnome-terminal.
> It's not a command-line option.  You have to first create a
> gnome-terminal "profile" that behaves the way you want, and then invoke
> gnome-terminal with a commandline option that tells it which profile to
> use.  It's a bit of a pain, but it does solve the problem.  You helped
> me find the solution, because once I knew what I was looking for I
> googled for "gnome-terminal hold xterm" and found someone saying the
> hold option could be done in gnome-terminal via profiles.  Thanks again.
> 

If absolutely all else fails, put your program command inside a script
and run that instead of the program itself.  Then, the last line of
the script can be:

   sleep 100000000

...so the window stays open until either you kill it or the universe
ends.  :-)





More information about the Discuss mailing list