请问linux的dialog设计对话框不同的对话框可以嵌套吗?如果可以的话怎么嵌套呢??
比如下面这段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;
精彩评论