Results 1 to 8 of 8

Thread: shell script - open a new tab in terminal

  1. #1
    Join Date
    Mar 2006
    Beans
    146

    shell script - open a new tab in terminal

    Hello,
    I have a little shell script which launch some commands and I'd like to know if it's possible to open programmaticaly a new tab or terminal to launch each of the commands in a different window/tab.

    Thank you

  2. #2
    Join Date
    Jul 2007
    Location
    USA
    Beans
    227
    Distro
    Ubuntu Studio 11.04 Natty Narwhal

    Re: shell script - open a new tab in terminal

    You might be able to do it so it opens them each in new instances of Terminal, but almost certainly not in tabs. Shell scripting basically works within the shell and is limited to there, so it cannot manipulate something outside of the shell, such as a GUI.
    Linux Mint 9 Isadora | Linux User #450508 | Ubuntu User #16172
    SilverScreenPhile | folding@home team #45104 | World Community Grid

  3. #3
    Join Date
    Mar 2006
    Beans
    146

    Re: shell script - open a new tab in terminal

    ok I think this should work:
    #!/bin/sh

    gnome-terminal -e "ping www.free.fr"
    gnome-terminal -e "ping www.google.fr"
    Last edited by Tex-Twil; July 25th, 2007 at 09:53 AM.

  4. #4
    Join Date
    Dec 2005
    Beans
    527
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: shell script - open a new tab in terminal

    I would look into screen if I where you. It should do what you need. Its kinda like tabbing inside the terminal window.

  5. #5
    Join Date
    Jun 2006
    Location
    Michigan
    Beans
    20
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: shell script - open a new tab in terminal

    Quote Originally Posted by nichipet View Post
    You might be able to do it so it opens them each in new instances of Terminal, but almost certainly not in tabs. Shell scripting basically works within the shell and is limited to there, so it cannot manipulate something outside of the shell, such as a GUI.
    If you want it in two different tabs you could do something like this:

    Code:
    gnome-terminal -e "ping www.free.fr" --tab -e "ping www.google.fr"

  6. #6
    Join Date
    Jul 2007
    Location
    USA
    Beans
    227
    Distro
    Ubuntu Studio 11.04 Natty Narwhal

    Re: shell script - open a new tab in terminal

    Quote Originally Posted by mikec13 View Post
    If you want it in two different tabs you could do something like this:

    Code:
    gnome-terminal -e "ping www.free.fr" --tab -e "ping www.google.fr"
    Thanks for pointing that out. I use konsole mostly, it's good to learn something new about gnome-terminal.
    Linux Mint 9 Isadora | Linux User #450508 | Ubuntu User #16172
    SilverScreenPhile | folding@home team #45104 | World Community Grid

  7. #7
    Join Date
    Dec 2005
    Beans
    527
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: shell script - open a new tab in terminal

    er every one ignored my suggestion of screen huh...

  8. #8
    Join Date
    Oct 2004
    Location
    Pennsylvania
    Beans
    1,698

    Re: shell script - open a new tab in terminal

    Quote Originally Posted by nichipet View Post
    Thanks for pointing that out. I use konsole mostly, it's good to learn something new about gnome-terminal.
    You can probably use the "dcop" command to automate konsole. Try running "kdcop" and experiment sending messages to an open konsole (try the newSession method).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •