全部博文(47)
2010年(47)
分类:
2010-02-18 15:17:31
Option | Meaning |
---|---|
-a ANAME | The words are assigned to sequential indexes of the array variable ANAME, starting at 0. All elements are removed from ANAME before the assignment. Other NAME arguments are ignored. |
-d DELIM | The first character of DELIM is used to terminate the input line, rather than newline. |
-e | readline is used to obtain the line. |
-n NCHARS | read returns after reading NCHARS characters rather than waiting for a complete line of input. |
-p PROMPT | Display PROMPT, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal. |
-r | If this option is given, backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation. |
-s | Silent mode. If input is coming from a terminal, characters are not echoed. |
-t TIMEOUT | Cause read to time out and return failure if a complete line of input is not read within TIMEOUT seconds. This option has no effect if read is not reading input from the terminal or from a pipe. |
-u FD | Read input from file descriptor FD. |
#!/bin/bash运行它, 得到下面的图形:
DIALOG=${DIALOG=dialog}
$DIALOG --title " My first dialog" --clear \
--yesno "Hello , this is my first dialog program" 10 30
将DIALOG=${DIALOG=dialog}改为DIALOG=${DIALOG=Xdialog}, 再次执行上述的脚本
下面解释一下上述的脚本:
#!/bin/bash就不用多说了, 所有的bash脚本起始行都是它.
DIALOG=${DIALOG=dialog} 设置DIALOG变量, 你可以将它设置为dialog或Xdialog(注意X为大写!)
重点是dialog的选项, 选项以"--"为前缀, 后面跟着可选的参数.
--title : 窗口的名称.
--clear : 在显示窗口之前清屏.
--yesno : 指定窗口的模板. dialog支持多种窗口, 见下表:
选 项 | 窗口类型 |
--yesnobox | 含有"yes"和"no"按钮 |
--menu | 构建菜单 |
--inputbox | 读取用户输入 |
--msgbox | 只含有"ok"按钮 |
--textbox | 在dialog中显示文本文文件的内容 |
--infobox | 与--msgbox相似 |
--checklist | 与--menu相似, 但可显示那些条目被选择了. |
--radiolist | 与--menu相似, 但可显示那些条目被选择了. |