linux - 在对话框实用程序中使用 --output-fd 参数

标签 linux bash redirect dialog stdout

我正在开发一个嵌入式 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/

相关文章:

bash - 获取后台 gnome 终端进程的 pid

linux - 如何在 bash 脚本中执行命令,然后聚焦出现的窗口

bash - 如何在 Bash 中用定界符拆分字符串?

php - 来自 Blade 模板的 Laravel 重定向问题

php - 输出用户消息后重定向 PHP 页面

linux - Squid ecap_adapter_gzip问题

linux - 如何使用 Xlib 恢复窗口?

linux - 内核 panic ——copy_from_user、kmalloc 失败?

linux - bsqldb 登录失败

Wordpress 站点从 https 恢复...链接断开