Search code examples
linuxbashterminal

Linux Gnome: Start multiple terminals and execute a command in each one


How can I implement the following scenario in Ubuntu Linux?

I want to go to my console, then execute ./startdev.sh and then

  1. Terminal 1 pops up, starts /home/foobar/bla1.sh
  2. Terminal 2 pops up, starts /home/foobar/bla2.sh
  3. Terminal 3 pops up, starts /home/foobar/bla3.sh

I already figured that the command "gnome-terminal & disown" starts a new terminal. However, until now, I don't know how to run a command in that terminal.

I accept any answer that gives me either the entire implementation for startdev.sh or a list of commands that I can use.


Solution

  • Try this content for startdev.sh:

    #!/bin/bash
    
    gnome-terminal --command=/home/foobar/bla1.sh & disown
    gnome-terminal --command=/home/foobar/bla2.sh & disown
    gnome-terminal --command=/home/foobar/bla3.sh & disown
    

    But it is not clear for me why you need to disown the launched processes.