Hi I have created a script in Thread822-422199 and also added in a new option to exit from this back to the main menu, it goes back ok and I can select a different update item but once that has done and goes back to the main menu it will not quit as it loops once and then quits.
Also the count works OK but after entering it wrong 2 times the 3rd time i can enter it correctly it still tells me i am wrong and resets the count and I can start all over again with the count.
Regards
Ian
function monitornew
{
cat $jsfile >> $logfile
app=$(cat $jsfile | tr -s 'D' '\t' | awk '{print $1}')
monitorcolour=$(cat $jsfile | cut -d "|" -f2)
message=$(cat $jsfile | cut -d "|" -f3)
echo "\\t The colour status of the monitoring screen $app at the moment is $monitorcolour "
echo "\\t The last timestamp and message is $message "
echo ""
echo "\\t Please select an option you wish to change the monitor screen colour to ..."
echo "\\t \\t r - Red"
echo "\\t \\t a - Amber"
echo "\\t \\t g - Green"
echo "\\t \\t x - Main Menu"
echo "\\t \\t q - Quit"
echo ""
echo "\\t Type your option here: \\c"
typeset -i CNT
CNT=0
CHOICE='INVALID'
read usercolour
while [[ $CHOICE != 'VALID' ]] do
CHOICE='VALID'
case $usercolour in
r|R) usercolour=red ;;
a|A) usercolour=amber ;;
g|G) usercolour=green ;;
x|X) mainmenu ;;
q|Q) echo ""; echo "\\t \\t Quitting the update monitoring screen menu program..." ; echo "" ; exit 0;;
*) echo "\\t \\t That was not a valid option please try again: \\c"; CHOICE='INVALID'; read usercolour;;
esac
(( CNT = CNT + 1 ))
if
(( CNT > 2 ))
then
echo \\t'Are you Confused?'
CHOICE='INVALID'
CNT=0
fi
done
echo ""
echo "\\t Please type in the popup message you wish to appear when clicked"
echo ""
echo "\\t Type your message here: \\c"
read popup
timeNow=$(date +"%H%M"
echo ""
echo "\\t The monitoring screen has now changed the following information is now being displayed ..."
echo ""
echo "\\t The screen is now $usercolour and has the message $popup time stamped at $timeNow"
app=$(cat $jsfile | tr -s 'D' '\t' | awk '{print $1}' |sed 's/$/Data/')
echo "$app[0]=\"|$usercolour|$timeNow - $popup|\"" > $jsfile
echo ""
echo "\\t Hit Return to go back to the main menu"
read
}
Also the count works OK but after entering it wrong 2 times the 3rd time i can enter it correctly it still tells me i am wrong and resets the count and I can start all over again with the count.
Regards
Ian
function monitornew
{
cat $jsfile >> $logfile
app=$(cat $jsfile | tr -s 'D' '\t' | awk '{print $1}')
monitorcolour=$(cat $jsfile | cut -d "|" -f2)
message=$(cat $jsfile | cut -d "|" -f3)
echo "\\t The colour status of the monitoring screen $app at the moment is $monitorcolour "
echo "\\t The last timestamp and message is $message "
echo ""
echo "\\t Please select an option you wish to change the monitor screen colour to ..."
echo "\\t \\t r - Red"
echo "\\t \\t a - Amber"
echo "\\t \\t g - Green"
echo "\\t \\t x - Main Menu"
echo "\\t \\t q - Quit"
echo ""
echo "\\t Type your option here: \\c"
typeset -i CNT
CNT=0
CHOICE='INVALID'
read usercolour
while [[ $CHOICE != 'VALID' ]] do
CHOICE='VALID'
case $usercolour in
r|R) usercolour=red ;;
a|A) usercolour=amber ;;
g|G) usercolour=green ;;
x|X) mainmenu ;;
q|Q) echo ""; echo "\\t \\t Quitting the update monitoring screen menu program..." ; echo "" ; exit 0;;
*) echo "\\t \\t That was not a valid option please try again: \\c"; CHOICE='INVALID'; read usercolour;;
esac
(( CNT = CNT + 1 ))
if
(( CNT > 2 ))
then
echo \\t'Are you Confused?'
CHOICE='INVALID'
CNT=0
fi
done
echo ""
echo "\\t Please type in the popup message you wish to appear when clicked"
echo ""
echo "\\t Type your message here: \\c"
read popup
timeNow=$(date +"%H%M"
echo ""
echo "\\t The monitoring screen has now changed the following information is now being displayed ..."
echo ""
echo "\\t The screen is now $usercolour and has the message $popup time stamped at $timeNow"
app=$(cat $jsfile | tr -s 'D' '\t' | awk '{print $1}' |sed 's/$/Data/')
echo "$app[0]=\"|$usercolour|$timeNow - $popup|\"" > $jsfile
echo ""
echo "\\t Hit Return to go back to the main menu"
read
}