I am trying to make a small bash script and using Xdialog.
Code:
#!/bin/sh
Xdialog --no-tags \
--title "RADIOLIST BOX" \
--radiolist "blahblahblah ?" 20 50 3 \
"first" "something 3" ON \
"second" "something2" off \
"third" "something3" off 2>/tmp/checklist.tmp.$$
retval=$?
choice=`cat /tmp/checklist.tmp.$$`
rm -f /tmp/checklist.tmp.$$
case $retval in
0)
echo "$choice";;
1)
echo "Cancel pressed.";;
255)
echo "Box closed.";;
esac
I am having problems with $choice, I can echo it and get the right output, but I can't
compare it to any value or other variable.
All I want to do is this
Code:
if [ "$choice" -eq "first" ]
then
<do something>
elif [ "$choice" -eq "second" ]
then
<do something else>
else
<do some third thing>
fi
but it will not work, I don't get why?