creating a new gnome terminal, running a command when the term starts...

Cameron Simpson cs at zip.com.au
Sat Oct 3 05:35:20 UTC 2009


On 28Sep2009 11:17, bruce <bedouglas at earthlink.net> wrote:
| I'm trying to create/invoke a new gnome-terminal, were i start/run a script
| when the term starts up..
| 
| from the gnome-terminal docs, i'm assuming i can accomplish this by using
| the "-x/-e" attribute when i fire up gnome-terminal...
| 
| this doesn't work... others appear to have the same issue...
| 
| so, when i do:
| 	gnome-terminal -x "foo"
| 
| a new gnome term is created, but it hangs without a bash prompt (or any
| prompt) created.

Of course not. You're running "foo". It's _still_ a terminal!
Sounds like correct behaviour to me.

| so it appears that a useless blank term window is displayed. the "foo"
| script is simply an empty script for testing. it has the chgrp of 777 with a
| chown of 777 and a chmod of +x.

Try this:

  gnome-terminal -e sh -c 'foo & exec $SHELL'
or:
  gnome-terminal -e 'foo & exec $SHELL'

The -e option _ought_ to take a command-and-arguments like xterm
does, thus the 'sh -c '....'" invocation. But I have in the back of
my mind that gnome-terminal got this wrong so I've supplied you the
"-e shell-command-string" variation as well.

You might prefer 'foo; exec $SHELL', depending on your needs.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Your eyes are weary from staring at the CRT.  You feel sleepy.  Notice how
restful it is to watch the cursor blink.  Close your eyes.  The opinions
stated above are yours.  You cannot imagine why you ever felt otherwise.
        - gabrielh at tplrd.tpl.oz.au




More information about the fedora-list mailing list