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.
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.
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.
Just being curious, what is the advantage of using nohup in this example? – nisc – 2010-07-29T10:26:56.893
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...) – Janne Pikkarainen – 2010-07-29T10:31:48.710
niscy: I edited my original answer, thank you for noting me about the unnecessary nohup :) – Janne Pikkarainen – 2010-07-29T10:37:17.197
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.
This probably depends heavily on what desktop environment (e.g. Gnome, KDE, awesome, ...) you are using. – Benjamin Bannier – 2010-07-29T08:59:48.647