📄 00000004.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>翻译by GaryLee!! <BR> <BR>dialog 使用说明: <BR> <BR>名称: <BR> dialog - 由shell script中, 显示对话框! <BR> <BR>语法: <BR> dialog --clear <BR> dialog --create-rc file <BR> dialog [--title title] [--clear] box-options <BR> <BR>描述: <BR> Dialog是一个可以让你显示各种讯息或者是讯问问题, 要求输入资料的 <BR> 一个程式, 可以在shell script中使用. 目前有支援下面几种形态的对 <BR> 话框: <BR> <BR> yes/no box -- YES/NO讯息框 <BR> menu box -- 选单讯息框 <BR> input box -- 输入框 <BR> message box -- 讯息显示框 <BR> text box -- 文字显示框 <BR> info box -- 资讯显示框 <BR> checklist box -- 选项确定列表框 <BR> <BR>选项: <BR> <BR> --clear <BR> 清除萤幕 <BR> <BR> --create-rc file <BR> 因为dialog支援run-time configuration, 所以这个选项可以用 <BR> 在倾印出目前的configuration的状况到file所指定的档案中. <BR> <BR> --title title <BR> 用来指定显示在对话框上方的字串. <BR> <BR> <BR> BOX OPTIONs <BR> --yesno text height width <BR> 在萤幕上show出一个width x height大小的对话框, 同时这个对 <BR> 话框会有一个yes及一个no的选择项. 同时对话框内会显示text所 <BR> 指定的字串. 如果要将该字串断行, 可以加入换行字元"\n". <BR> 如果想要在yes及no的选择中切换, 可用tab键!! <BR> <BR> EXAMPLE: <BR> <BR> dialog --yesno "Are you sure?" 7 30 <BR> <BR> --msgbox text height width <BR> 在萤幕上show出一个width x height大小的对话框, 同时这个对 <BR> 话框会有一个OK的选项. 按ENTER後可以离开. 其他的部份与 <BR> yes/no box相同. <BR> <BR> EXAMPLE: <BR> <BR> dialog --msgbox "Hello, Dialog Box" 7 30 <BR> <BR> --infobox text height width <BR> 这是一个简单的message box, dialog在显示完text所指定的字串 <BR> 後, 会立即结束. 但不会将萤幕清除, 除非你呼叫其他的dialog <BR> 选项来清除它. 当你想show一些message给user时, 然後在一段时 <BR> 间後自动清除它时, 就可以用这个选项. <BR> <BR> EXAMPLE: <BR> <BR> dialog --infobox "abcdefg\n1234567890" 6 20 <BR> sleep 5 <BR> dialog --clear <BR> <BR> --inputbox text height width <BR> 在萤幕上show出一个width x height大小的对话框, 同时这个对 <BR> 话框之中还会有一个输入框, 让user输入文字, text所指定的提示 <BR> 字串则会show在输入框的上方. user输入的文字会由stderr中show <BR> 出. <BR> <BR> EXAMPLE: <BR> <BR> dialog --inputbox "Name :" 10 30 2> yourname.tmp <BR> cat yourname.tmp <BR> <BR> --textbox file height width <BR> 和message box相同, 唯一不同在於message box的讯息是用text <BR> 选项所指定的字串, 而text box的讯息则是使用file选项所指定的 <BR> 档案中的内容. 若文章的大小超过box的大小, 可以用UP/DOWN, <BR> PGUP/PGDN, HOME/END, 以及LEFT/RIGHT等键来移动显示文字的 <BR> □围. <BR> <BR> EXAMPLE: <BR> <BR> dialog --textbox /etc/hosts 20 70 <BR> <BR> --menubox text height width menu-height [ tag item ] ... <BR> 这个对话框会提供一系列的选单来让使用者选择, 每个选项包含 <BR> 了一个标签字串(tag string). 以及一个选项提示字串(item <BR> string) tag string是用来分别不同的item用的, item string <BR> 则是用来, 显示在萤幕上给user看的, 主要是用来描述这个item. <BR> user可以用UP/DOWN来在不同的选项间移动. menu-height是用来 <BR> 指定一次要在萤幕上show的item的数目. 当dialog结束後, 会把 <BR> user所选择的item的tag string输出到stderr上. <BR> <BR> EXAMPLE: <BR> <BR> dialog --menubox "your choice?" 20 40 10 item1 "item 1" \ <BR> item2 "item 2" item3 "item 3" item4 "item 4" 2> choice.tmp <BR> cat choice.tmp <BR> <BR> --checklist text height width list-height [ tag item status ] ... <BR> 和menu box类似, 不同的地方在於menu box一次仅能选择一个 <BR> item, 而checklist box则可以同时指定数个item. 个选项的功用 <BR> 也差不多, 其中list-height跟menu-height是相同的. 至於 <BR> status所代表的意义则是否要一开始就先帮使用者选取该item, <BR> 既所谓的default选项, status的可以为on或是off. dialog执行 <BR> 结束後, 被选到的item的tag string将会输出到stderr上. <BR> <BR> EXAMPLE: <BR> <BR> dialog --checklist "your choices?" 20 40 10 \ <BR> item1 "item one" on \ <BR> item2 "item two" off \ <BR> item3 "item three" on \ <BR> item4 "item four" on \ <BR> item5 "item five" off \ <BR> item6 "item six" off 2> choices.tmp <BR> cat choices.tmp <BR> <BR>dialog之exit status: <BR> 如果dialog的exit status是0的话, 表示YES或是OK的button被按下. 如 <BR> 果是1 的话表示NO或CANCEL button被按下, 如果有错误发生, 或是被按下 <BR> ESC键结束的话, 则exit status为-1. <BR> <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -