Results 1 to 3 of 3

Thread: open terminal in different dir and run script

  1. #1
    Join Date
    Jan 2006
    Beans
    582

    open terminal in different dir and run script

    #!/bin/bash
    gnome-terminal --working-directory=/home/user

    the above will open a new terminal in any directory i want but i can not seem to figure out how to run a script in the new dir

    my script that i want to run is in /home/user/bin/script

  2. #2
    Join Date
    Apr 2009
    Location
    Tennessee, USA
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: open terminal in different dir and run script

    Are you trying to write a script, to open a terminal, to run a script...? Or am I misunderstanding something?

  3. #3
    Join Date
    Jun 2008
    Location
    California
    Beans
    2,271
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: open terminal in different dir and run script

    The following command opens a terminal window and runs a shell script. The second bash is often but not always necessary to keep the terminal window open after the script is completed. This command assumes that the directory that contains the script is in your path.

    Code:
    gnome-terminal --execute bash -c "scriptname ; bash"
    I ran a test, and the above command does work with the working-directory option.
    Last edited by kaibob; May 16th, 2010 at 05:43 AM.

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
  •