【发布时间】:2021-08-09 13:11:29
【问题描述】:
我需要在 linuxkit 启动时进行 tty 交互。
现在,setsid -w agetty -a root -L 38400 ttyS0 vt100 正在工作。
但我想运行一个特定的程序。有什么办法吗?
感谢“Mahdy Mirzade”的回复,
$ setsid sh -c 'exec ls <> /dev/tty2 >&0 2>&1'
这很好用,但它无法控制 tty。
$ setsid sh -c 'exec sh -c "echo hello > /dev/tty" <> /dev/tty10>&0 2>&1'
(error message) cannot create /dev/tty: Inappropriate ioctl for device
因此,无法运行通过 tty 接收用户输入的程序。有没有办法解决这个问题?
【问题讨论】: