问题
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
回答1:
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"
来源:https://stackoverflow.com/questions/22656359/bash-shell-script-opening-multiple-terminals-and-executing-distinct-commands