Linux脚本里的whiptail界面

概览:

效果

实现

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh


do_info() {
whiptail --msgbox "display tool info" 20 60 1
}

do_change() {
whiptail --msgbox "Now tools is changing" 20 60 1
}

do_finish() {
whiptail --msgbox "finish configure" 20 60 1
}

while true; do
FUN=$(whiptail --menu "Test Window" 20 80 10 --cancel-button Exit \
"info" "about this tool" \
"change" "configure this tool" \
"finish" "Finish config" \
3>&1 1>&2 2>&3)
if [ $? -ne 0 ]; then
exit 1;
else
"do_$FUN" || whiptail --msgbox "There was an error running do_$FUN" 20 60 1
fi
done
------ 文章已经结束,谢谢你的阅读 ------
------ article has ended,thank you for reading ------
Thanks support Me

---------------- The End ----------------