Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux change to another /dev/ttyX and run program there

Tags:

linux

sh

tty

Is it possible to run a script on /dev/tty1 and spawn a program to run on /dev/tty2 and wait for it to complete and run the other commands in the script? For instance:

echo "Hello, this is from terminal 1"
chvt 2
sh myprogram.sh (I want it to run on tty2, but it runs on tty1)
chvt 1

myprogram.sh:

echo "Hello' this is from terminal 2, please type your input:"
read A
exit A
like image 908
Mustafa Avatar asked Feb 19 '26 05:02

Mustafa


1 Answers

Yes, you can do this using openvt.

openvt -c 2 sh myprogram.sh
like image 123
Igor Chubin Avatar answered Feb 20 '26 20:02

Igor Chubin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!