Linux命令之Dialog练习

dialog命令可以封装shell,做成简单的GUI界面


yum install dialog

下面是一些练习 记录

针对Xwindows的dialog  叫Xdialog

yum install Xdialog

KDE 桌面也有kdialog

gnome好像是zenity (语法不太一样)

练习一下,需要用的时候 找相应的组件,细节可以查man手册。


#!/bin/bash
DIALOG=${DIALOG=dialog}
# 日历
#$DIALOG  --title 'nice' --calendar    "wowow" 3 30  28 10 2014
#$DIALOG --title 'nice'   --calendar     <text> <height> <width> <day> <month> <year>

# 多选框
#$DIALOG --title 'nice'  --checklist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
#$DIALOG   --title 'nice'  --checklist    "check" 20  100  20  tag1 item1 status1  tag2 item2 status2 tag3 item3 status3 

# 目录选择框
#$DIALOG --title 'nice'  --dselect      /home/devop/  20 100

#$DIALOG --title 'nice'  --editbox      <file> <height> <width>
# 文件编辑框
#$DIALOG --title 'nice'  --editbox       /home/devop/1.sh 20 100
#$DIALOG --title 'nice'  --fselect      <filepath> <height> <width>
# 文件选择框
#$DIALOG --title 'nice'  --fselect      <filepath> <height> <width>
#$DIALOG --title 'nice'  --fselect      /home/devop 20 100

# 进度条
#$DIALOG --title 'nice'  --gauge        <text> <height> <width> [<percent>]
#(for i in $(seq 1 100); do sleep 0.1 ; echo $i ; done) | $DIALOG --title 'nice'  --gauge        nice 20 100
#http://bash.cyberciti.biz/guide/A_progress_bar_(gauge_box)

# 消息提示框 (会自动消失)
#$DIALOG --title 'nice'  --infobox      <text> <height> <width>
#$DIALOG --title 'nice'  --infobox     nice 20 100 

#输入框
#$DIALOG --title 'nice'  --inputbox     <text> <height> <width> [<init>]
#$DIALOG --title 'nice'  --inputbox     wow  20 100 shalk 

#菜单修改框 Xdialog 不支持
#$DIALOG --title 'nice'  --inputmenu    wow 20 100   20  tag1 item1 tag2 item2 

#菜单框
#$DIALOG --title 'nice'  --menu        wow 20 100   20  tag1 item1 tag2 item2

# 消息框
#$DIALOG --title 'nice'  --msgbox       <text> <height> <width>
#$DIALOG --title 'msgbox'  --msgbox       wow 20 100


# 密码框
#$DIALOG --title 'nice'  --passwordbox  <text> <height> <width> [<init>]
#$DIALOG --title 'passwordbox'  --passwordbox  wow 20 100 111111 

#时间暂停框 Xdialog 不支持
#$DIALOG --title 'nice'  --pause        <text> <height> <width> <seconds>
#$DIALOG --title 'pause'  --pause        wow 20 100 5 

#文本框 tailf 会自动退出 Xdialog 不支持
#$DIALOG --title 'nice'  --progressbox  [<text>] <height> <width>
#cat '/etc/hosts' | $DIALOG --title 'progressbox'  --progressbox  20 100 

#菜单框 选中的前面有一个点 和menu差不多
#$DIALOG --title 'nice'  --radiolist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
#$DIALOG --title 'radiolist'  --radiolist    wow 20 100  50  tag1 item1 status1 tag2 item2 status2

#文本框 tail -f 版本
#$DIALOG --title 'nice'  --tailbox      <file> <height> <width>
#$DIALOG --title 'tailbox'  --tailbox      /home/devop/1.sh 20 100
#文本框 tailf -f &版本
#$DIALOG --title 'nice'  --tailboxbg    <file> <height> <width>
#$DIALOG --title 'tailboxbg'  --tailboxbg  /home/devop/1.sh 20 100
#普通文本框 阅读
#$DIALOG --title 'nice'  --textbox      <file> <height> <width>
#$DIALOG --title 'textbox'  --textbox     /home/devop/1.sh 20 100
# 时间框
#$DIALOG --title 'nice'  --timebox      <text> <height> <width> <hour> <minute> <second>
#$DIALOG --title  'timebox'  --timebox     wow 20 100 15 30 30 
# yes/no 判断框
#$DIALOG --title 'nice'  --yesno        <text> <height> <width>
#$DIALOG --title 'yesno'  --yesno        wow 20 100 


你可能感兴趣的:(Linux命令之Dialog练习)