I have to open multiple xterm windows and save them later to run different commands in each of them while keeping them alive.
An example (not correct at all) would be:
term1= xterm -hold -title "term1"
term2= xterm -hold -title "term2"
term3= xterm -hold -title "term3"
Compute same commands for all of them:
for i in term1 term2 term3
do
$i -e "cd somewhere; source something"
done
then run different commands for some of them:
$term1 -e "cd somewhere else; ./..."
$term2 -e "do other thing"
I have very little experience in shell scripts, as you may notice, if someone could help me I would be really happy.
EDIT: add example in response to @dessert
Disclaimer: I'm currently working in the ROS ambient.
The script should open four terminal (either xterm, terminator, default terminal) windows; three of them must source a bash script in the same folder and then roscd to another one, of this two of them must execute various commands (one has to launch a launch_file while tho other has to run a script). The fourth one must cd to a different folder where he has to source a .bash and then launch another launch_file. It would be even better if the fourth one can wait x seconds before launching.
tmux
-- you can split a single terminal into several "panes", and send commands simultaneously to all of them. – glenn jackman Oct 30 '17 at 16:11screen
(website)! – dessert Oct 30 '17 at 16:25