0

For a certain task, everytime I have to open 10 bash terminals and write different commands on them. Any way to automate this ?

I am running Fedora linux.

1
  • This probably depends heavily on what desktop environment (e.g. Gnome, KDE, awesome, ...) you are using. Jul 29, 2010 at 8:59

2 Answers 2

3

Just create a shell script which spawns those terminals and executes your commands upon startup. For example, with gnome-terminal you could do

#!/bin/bash
gnome-terminal -e your_command1 &
gnome-terminal -e your_command2 &
gnome-terminal -e your_command3 &
gnome-terminal -e your_command4 &

(and so on...)

EDIT: Removed unnecessary nohup command since it wasn't needed in this case. My original idea was to include nohup so the spawned gnome-terminal windows would not get killed in case the window where the script was started would be closed. It appears that those launhed terminal windows will stay alive just fine even without nohup.

3
  • Just being curious, what is the advantage of using nohup in this example?
    – nisc
    Jul 29, 2010 at 10:26
  • If you close the terminal window where you started the above script from, the spawned gnome-terminal windows will stay alive. Without nohup they will get killed together with the original terminal window. EDIT: I just tried without nohup, still seems to work. Oh well. I'm sure under some conditions I've managed to kill my original window. Maybe that was just a dream. (Yes, yes, using screen while starting up the script would help, but one can't always remember to start screen so that's why the safety measure...) Jul 29, 2010 at 10:31
  • niscy: I edited my original answer, thank you for noting me about the unnecessary nohup :) Jul 29, 2010 at 10:37
2

There is already an answer which gives a straight forward solution to your problem, but if you one day want to do more advanced GUI automation stuff, I can highly recommend Sikuli.

http://www.sikuli.org

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .