如何从 Linux 中的 bash 脚本显示 GUI 消息框? [英] How to show a GUI message box from a bash script in linux?

查看:37
本文介绍了如何从 Linux 中的 bash 脚本显示 GUI 消息框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Ubuntu linux 下编写一些小的 bash 脚本.我希望能够从 GUI 运行它们,而无需终端窗口来输入任何输入或查看任何输出.

I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output.

到目前为止,唯一需要的输入是 sudo 的密码 - 而 gksudo 可以很好地处理.但是我还没有找到一种简单的方法来显示消息框.是否有某种gkmessage"命令可用?我更喜欢默认 Ubuntu 安装中存在的东西,但我不介意在必要时安装新包.

So far the only input required is a password for sudo - and gksudo handles that fine. But I haven't found an easy way to show a message box yet. Is there some kind of 'gkmessage' command available? I'd prefer something present in a default Ubuntu install, but I don't mind installing a new package if necessary.

推荐答案

我相信 Zenity 会做些什么你要.它专为从命令行显示 GTK 对话框而设计,可作为 Ubuntu 包使用.

I believe Zenity will do what you want. It's specifically designed for displaying GTK dialogs from the command line, and it's available as an Ubuntu package.

这篇关于如何从 Linux 中的 bash 脚本显示 GUI 消息框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆