Linux更改为另一个/ dev / ttyX并在那里运行程序

时间:2012-08-01 09:53:18

标签: linux sh tty

是否可以在/ dev / tty1上运行脚本并生成一个程序在/ dev / tty2上运行并等待它完成并运行脚本中的其他命令?例如:

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

1 个答案:

答案 0 :(得分:4)

是的,您可以使用openvt

执行此操作
openvt -c 2 sh myprogram.sh