LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 822|回复: 0

新需求,关于dialog的循环显示

[复制链接]
发表于 2007-4-16 21:49:54 | 显示全部楼层 |阅读模式
我正在编写一个用dialog显示的小程序.其中用到了checkridio功能.

为了实现一个小小的功能.我花费了一天的时间调试.

这个功能是:
#----------------------------------------------------
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

$DIALOG --backtitle "Test" \
        --title "Dictionary" --clear \
        --radiolist "Which of the following are fruits?" 20 61 5 \
#####在这里插入一个函数,这个函数读取了不少数据,比如ls显示的数据,组建成合法的字符串
#####可是这里连注释都不能添加,dialog的移植性不可能这么脆弱吧.
"Lemon"  "You know how it tastes." off 2> $tempfile
retval=$?

choice=`cat $tempfile`
case $retval in
  0)
    echo "'$choice' chosen.";;
  1)
    echo "Cancel pressed.";;
  255)
    echo "ESC pressed.";;
esac

#----------------------------------------------------
我想一定是语法格式不正确,请大家集思广益.谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表