Re: Getting dialog to work

2000-03-08 Thread Allan M. Wind
On 2000-03-07 15:21:29, Matheson wrote:

> I'm still trying to get this stupid dialog thing to work, so I tried to
> do this example script.  Unfortunately, if gives me the same output no
> matter what the user chooses.  If anyone could help me, that would help
> me a lot.  Here it is:
> 
> #!/bin/sh
> #  Cameron Matheson
> 
> DIALOG=${DIALOG=dialog}
> tempfile=`tempfile`

Use '' instead of ``.

> 
> $DIALOG --clear --title "Snes9x Options" \
> --backtitle "Super Nintendo" --shadow \
> --menu "Choose the ROM you want to load:" 0 0 0 \
> 1 "Final Fantasy VI" \
> 2 "Quit" 2> $tempfile

Dumping the result in the file $tempfile.

> 
> retval=$?
> 
> case $retval in

$retval is undefined, so case will probably not yield anything or
fail.

>   0)
> if [ "$tempfile"="1" ]; then

Compare $tempfile which is `tempfile` with "1", that will always be
unequal.

> clear
> echo "Hey"
> exit 0
> fi
> if [ "$tempfile"="2" ]; then
> clear
> echo "Bye"
> exit 0
> fi;;
> 1)
> echo "Cancel Pressed";;
> 2)
> echo "ESC Pressed";;
> esac

Try again.


/Allan
-- 
Allan M. Wind   Finger: [EMAIL PROTECTED] (GPG/PGP)
P.O. Box 2022   Email: [EMAIL PROTECTED]
Woburn, MA 01888-0022   ICQ: 44214251
USA Phone: 781.279.4513


Getting dialog to work

2000-03-07 Thread Matheson
Hey,

I'm still trying to get this stupid dialog thing to work, so I tried to
do this example script.  Unfortunately, if gives me the same output no
matter what the user chooses.  If anyone could help me, that would help
me a lot.  Here it is:

#!/bin/sh
#  Cameron Matheson

DIALOG=${DIALOG=dialog}
tempfile=`tempfile`

$DIALOG --clear --title "Snes9x Options" \
--backtitle "Super Nintendo" --shadow \
--menu "Choose the ROM you want to load:" 0 0 0 \
1 "Final Fantasy VI" \
2 "Quit" 2> $tempfile

retval=$?

case $retval in
  0)
if [ "$tempfile"="1" ]; then
clear
echo "Hey"
exit 0
fi
if [ "$tempfile"="2" ]; then
clear
echo "Bye"
exit 0
fi;;
1)
echo "Cancel Pressed";;
2)
echo "ESC Pressed";;
esac

Thanks,
Cameron Matheson