我正在开发一个嵌入式 linux 系统;我的控制台是一个串行端口,在/dev/tty0 有一个 VGA 视频输出。
我正在尝试使用“对话框”(1) 实用程序在 VGA 屏幕上显示类似菜单的显示。
我可以在控制台上获得对话框输出:
dialog --inputbox "Hello Dialog World" 10 30
我可以通过重定向在 VGA 屏幕上得到类似的东西:
dialog --inputbox "Hello Dialog World" 10 30 >/dev/tty0
但我想在对话框中使用“--output-fd
”参数来获得类似的结果,但我无法让它工作。
我已经在 bash 脚本中尝试过类似的东西:
exec 4>/dev/tty0
dialog --output-fd 4 --inputbox "Hello Dialog World" 10 30
exec 4>&-
但这似乎像以前一样写入控制台。
我似乎误解了 --output-fd
参数的操作 - 谁能帮忙?
(实际上,我想对对话框使用 python-dialog 包装器;但在进行下一步之前,我需要了解如何使用底层对话框实用程序)
最佳答案
引自手册页:
Some widgets, e.g., checklist, will write text to dialog’s output. Normally that is the standard error, but there are options for changing this: "--out-put-fd", "--stderr" and "--stdout".
这意味着 --output-fd
选项不会为任何输出指定文件描述符,而只会为某些小部件生成的数据指定文件描述符。
关于linux - 在对话框实用程序中使用 --output-fd 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16860414/