#!/bin/bash

DIALOG=Xdialog
let ZA=$RANDOM%22+11
let ZB=$RANDOM%16+4
choice=$( $DIALOG --timeout 30 \
	  --no-tags \
          --title "Zugang nur für Erwachsene" \
          --inputbox "Wieviel ist $ZA mal $ZB ?" 10 60 2>&1 )

retval=$?

if [ "$retval" -eq "0" ] ; then
  choice=$(echo $choice | tr -c -d 0-9  )
  echo choice \'$choice\'
  let res=$choice-$ZA*$ZB
  echo res=$res
  if [ "$res" -eq "0" ] ; then
    echo richtig
    exit 0
  fi  
  echo "falsche"
fi
exit 1


