每个人都提到zenity,似乎还有很多其他人。 http://alternativeto.net/software/zenity/
有一个复杂但有趣的列表
首先,一个 Zenity 的例子,具有文本格式标记、窗口标题、按钮标签。
zenity \
--info \
--text="<span size=\"xx-large\">Time is $(date +%Hh%M).</span>\n\nGet your <b>coffee</b>." \
--title="Coffee time" \
--ok-label="Sip"
gxmessage
gxmessage "my text"
xmessage
xmessage 非常古老,因此它很稳定,并且可能在所有使用 X 的发行版中都可用(因为它与 X 一起发行)。它可以通过 X 资源进行定制,对于那些已经使用 Linux 或 Unix 足够长的时间来了解其含义的人(.Xdefaults,有人吗?)。
xmessage -buttons Ok:0,"Not sure":1,Cancel:2 -default Ok -nearmouse "Is xmessage enough for the job ?" -timeout 10
kdialog(KDE 工具)
kdialog --error "Some error occurred"
在 PPA 中
YAD: Zenity On Steroids [Display Graphical Dialogs From Shell Scripts] ~ Web Upd8: Ubuntu / Linux blog。似乎不会自动调整对话框大小。
echo My text | yad \
--text-info \
--width=400 \
--height=200
一个更大的例子
yad \
--title="Desktop entry editor" \
--text="Simple desktop entry editor" \
--form \
--field="Type:CB" \
--field="Name" \
--field="Generic name" \
--field="Comment" \
--field="Command:FL" \
--field="Icon" \
--field="In terminal:CHK" \
--field="Startup notify:CHK" "Application" "Name" "Generic name" "This is the comment" "/usr/bin/yad" "yad" FALSE TRUE \
--button="WebUpd8:2" \
--button="gtk-ok:0" \
--button="gtk-cancel:1"
其他不在 Ubuntu 标准存储库中
- shellgui
- xdialog
- gtkdialog
题外话(针对终端)
whiptail --msgbox "my text" 10 20
dialog --msgbox "my text" 10 20
随意编辑。