优艾设计网

请问linux的dialog设计对话框不同的对话框可以嵌套吗?如果可以的话怎么嵌套呢??

优艾设计网 https://www.uibq.com 2023-02-13 07:43 出处:网络 作者:磨皮美容教程
比如下面这段shell脚本代码的各个对话框都是彼此独立的,我想把它们一起放到一个大对话框离里去,但不知道怎么弄: /bin/bash yesno() { dialog --title \"First screen\" --backtitle \"Test Program\" --clear --ye

比如下面这段shell脚本代码的各个对话框都是彼此独立的,我想把它们一起放到一个大对话框离里去,但不知道怎么弄:

/bin/bash

yesno()
{

dialog --title "First screen" --backtitle "Test Program" --clear --yesno"Start this test program or not ? This decesion have to make by you." 16 51# yes is 0, no is 1 , esc is 255 result=$? if [ $result -eq 1 ] ; then exit 1; elif [ $result -eq 255 ]; then exit 255; fiusername;

}

username()
{

cat /dev/null >/tmp/test.username dialog --title "Second screen" --backtitle "Test Program" --clear --inputbox"Please input your username (default: hello) " 16 51 "hello" 2>/tmp/test.usernameresult=$? if [ $result -eq 1 ] ; then yesno; elif [ $result -eq 255 ]; then exit 255; fipassword;

}

password()
{

cat /dev/null >/tmp/test.password dialog--insecure --title "Third screen" --backtitle "Test Program" --clear --passwordbox"Please input your password (default: 123456) " 16 51 "123456" 2>/tmp/test.passwordresult=$? if [ $result -eq 1 ] ; then username; elif [ $result -eq 255 ]; then exit 255; fioccupation;

}

occupation()
{

cat /dev/null >/tmp/test.occupation dialog --title "Forth screen" --backtitle "Test Program" --clear --menu"Please choose your o优艾设计网_设计百科ccupation: (default: IT)" 16 51 3IT "The worst occupation"CEO "The best occupation"Teacher "Not the best or worst"2>/tmp/test.occupationresult=$? if [ $result -eq 1 ] ; then password; elif [ $result -eq 255 ]; then exit 255; fifinish;

}

finish()
{

dialog --title "Fifth screen" --backtitle "Test Program" --clear --msgbox"Congratulations! The test program has finished! Username: $(cat /tmp/test.username) Password: $(cat /tmp/test.password) Occupation: $(cat /tmp/test.occupation)" 16 51result=$? if [ $result -eq 1 ] ; then occupation elif [ $result -eq 255 ]; then exit 255; fi

}

yesno;


0

精彩评论

暂无评论...
验证码 换一张
取 消