|
我正在编写一个用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
#----------------------------------------------------
我想一定是语法格式不正确,请大家集思广益.谢谢 |
|