dialog可以显示文本接口程序

#当dialog指令不存在时,可用下面指令进行安装
[root@zhu1 shell]# yum -y install dialog

1.显示信息(msgbox)

[root@zhu1 shell]# dialog --msgbox "千山鸟飞绝" 10 40
语法:
dialog --msgbox 信息内容  高度 宽度

153726347.jpg

窗口按钮只有一个,若使用者按下enter键,窗口便结束,离去状态为0,若按下ESC键窗口状态也会结束,离去状态为255,可用$?来检查

--backtitle #出在背景顶部的标题
--title #出现在对话框顶部的标题
--no-shadow #外框不要有阴影的效果

[root@zhu1 shell]# dialog --backtitle "beijing" --title "dialog" --no-shadow --msgbox "千山鸟飞绝" 10 40

2.是否对话框

[root@zhu1 shell]# dialog --yesno "千山鸟飞绝" 10 4
dialog --yesno “内容” 高度  宽度

#此时若$?的值为0,表示选是,为1表示选否,为255表示选ESC键

3.还可以显示多种对话框,如选择框,密码框,文本框等

[root@zhu1 shell]# dialog --help
cdialog (ComeOn Dialog!) version 1.0-20051107
Copyright (C) 2005 Thomas E. Dickey
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* Display dialog boxes from shell scripts *
Usage: dialog <options> { --and-widget <options> }
where options are "common" options, followed by "box" options
Special options:
[--create-rc "file"]
Common options:
[--aspect <ratio>] [--backtitle <backtitle>] [--begin <y> <x>]
[--cancel-label <str>] [--clear] [--colors] [--cr-wrap]
[--default-item <str>] [--defaultno] [--exit-label <str>]
[--extra-button] [--extra-label <str>] [--help-button]
[--help-label <str>] [--help-status] [--ignore] [--input-fd <fd>]
[--insecure] [--item-help] [--keep-window] [--max-input <n>]
[--no-cancel] [--no-collapse] [--no-kill] [--no-label <str>]
[--no-shadow] [--ok-label <str>] [--output-fd <fd>] [--print-maxsize]
[--print-size] [--print-version] [--separate-output]
[--separate-widget <str>] [--shadow] [--single-quoted] [--size-err]
[--sleep <secs>] [--stderr] [--stdout] [--tab-correct] [--tab-len <n>]
[--timeout <secs>] [--title <title>] [--trim] [--visit-items]
[--version] [--yes-label <str>]
Box options:
--calendar     <text> <height> <width> <day> <month> <year>
--checklist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
--form         <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
--fselect      <filepath> <height> <width>
--gauge        <text> <height> <width> [<percent>]
--infobox      <text> <height> <width>
--inputbox     <text> <height> <width> [<init>]
--inputmenu    <text> <height> <width> <menu height> <tag1> <item1>...
--menu         <text> <height> <width> <menu height> <tag1> <item1>...
--msgbox       <text> <height> <width>
--passwordbox  <text> <height> <width> [<init>]
--pause        <text> <height> <width> <seconds>
--radiolist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
--tailbox      <file> <height> <width>
--tailboxbg    <file> <height> <width>
--textbox      <file> <height> <width>
--timebox      <text> <height> <width> <hour> <minute> <second>
--yesno        <text> <height> <width>
Auto-size with height and width = 0. Maximize with height and width = -1.
Global-auto-size if also menu_height/list_height = 0.