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
Running commands in different tabs is helpful, but sometimes two different processes are closely related and we want to see them together. For this, we can split our terminal window by right-clicking on it and selecting one of the options so that we can run two in the same window.
On Linux, there are three ways to run multiple commands in a terminal: The Semicolon (;) operator. The Logical OR (||) operator. The Logical AND (&&) operator.
bash [filename] runs the commands saved in a file. $@ refers to all of a shell script's command-line arguments. $1 , $2 , etc., refer to the first command-line argument, the second command-line argument, etc. Place variables in quotes if the values might have spaces in them.
• $* - It stores complete set of positional parameter in a single string. • $@ - Quoted string treated as separate arguments. • $? - exit status of command.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With