#! /bin/bash
COUNTER=100
echo "Change the counter value currently set at ${COUNTER} ? [y/n]"
read ANS
if [ "${ANS}" = "y" ] || [ "${ANS}" = "Y" ];then
echo -n " Enter a sensible value: "
read VALUE
expr ${VALUE} + 10 > /dev/null 2>&1
STATUS=$?
if [ "${VALUE}" = "" ];then
echo "you enterd nothing " >&2
exit 1
elif [ "${STATUS}" != "0" ];then
echo "you enter a non-numeric " >&2
exit 1
else
COUNTER=$(expr ${COUNTER} + ${VALUE})
echo " Counter now set to ${COUNTER} "
exit 0
fi
fi
echo "do nothing! "
exit 0
COUNTER=100
echo "Change the counter value currently set at ${COUNTER} ? [y/n]"
read ANS
if [ "${ANS}" = "y" ] || [ "${ANS}" = "Y" ];then
echo -n " Enter a sensible value: "
read VALUE
expr ${VALUE} + 10 > /dev/null 2>&1
STATUS=$?
if [ "${VALUE}" = "" ];then
echo "you enterd nothing " >&2
exit 1
elif [ "${STATUS}" != "0" ];then
echo "you enter a non-numeric " >&2
exit 1
else
COUNTER=$(expr ${COUNTER} + ${VALUE})
echo " Counter now set to ${COUNTER} "
exit 0
fi
fi
echo "do nothing! "
exit 0

