Re: terminal and script

Radu-Adrian Popescu <[email protected]> Thu, 28 Oct 2004 14:38:14 +0300
Newsgroups gmane.comp.java.linux.general
Organization Aldratech Ltd.
Message-ID <[email protected]>
Sandro Dähler wrote:
> Hi
> 
> I want to start a terminal(gnome-terminal) and then start a script in this
> terminal.
> 
> The start of the terminal is no problem (Process p =
> Runtime.getRuntime().exec("gnome-terminal");
> 

gnome-terminal has a -x parameter described as follows:
-x, --execute                                   Execute the remainder of the
                                                 command line inside the
                                                 terminal.
For xterm, aterm and konsole the parameter is "-e".

So you'd have to run
	gnome-terminal -e /path/to/the/script

My suggestion is that you check the environment variable "TERM" and compare it 
to an exhaustive list of "known" terminal programs - you could start with the 
above. Then move this list into a properties file, pairing terminal name with 
parameter value, to allow unknown terminals to be easily added.

Or you could just help save the world and fight global hunger.

> But how can I start the script now in this terminal??
> 
> I tried with a OutputstreamWriter on the outputstream of the
> Process(p.getOutputStream) but I had no success.
> 
> Can anyone help me??
> 
> Thx sandro
> 

Peace,
-- 
Radu-Adrian Popescu
CSA, DBA, Developer
Aldrapay MD
Aldratech Ltd.
+40213212243
smime.p7s (application/x-pkcs7-signature, 3.1 KB) - not displayed