bash - Shell script opening multiple terminals and executing distinct commands
bash, shell, terminal, unix
Solution
Without `-hold`, the xterm will close as soon as the command is completed. You can execute multiple commands by using double quotes and command separators (eg `;`, `&`):
xterm -title "App 1" -e "mycommand; mysecondcommand"
Problem
I've tried to write my own shell script. So far I've managed to open 4 xterminals that can only execute ONE command because of the 'hold' option. If i don't use this option, the terminals just disappear. Here is my code : ``` #!/bin/sh xterm -title "App 1" -hold -e mycommand | mysecondcommand & xterm -title "App 2" -hold -e mycommand | mysecondcommand & xterm -title "App 3" -hold -e mycommand | mysecondcommand & xterm -title "App 4" -hold -e mycommand | mysecondcommand ``` Not so sure if I'm supposed to execute the second command in the same terminal that way. Any ideas ? Thank you