I need to run a part of a script in other terminal windows. For example:
# first echo run in terminal window 1
echo "This echo command print in window 1"
# first echo run in terminal window 2
echo "This echo command print in window 2"
# first echo run in terminal window 3
echo "This echo command print in window 3"
Please answer with example code.
CodePudding user response:
xterm -e 'echo "This echo command print in window 1"'
will start an Xterm window and tell it to execute that command.
Replace xterm
with the actual terminal program you're using (e.g. gnome-terminal
). It may also use different syntax for providing a command to execute, so check its documentation for the correct syntax.