Hello All,
I have got a section of shell script which was working earlier but now it is giving some different results:
MSG=
while true
do
themenu
getchar =
case $answer in
1) export_Config_tables;;
2) export_config_tables_file;;
3) export_Accounts_tables;;
4) export_both_tables;;
5) load_config_tables;;
6) load_config_tables_file;;
x|X) break;;
q|Q) break;;
d|D) toggle_debug;;
*) badchoice;;
esac
done
clear
------- the menu function ---------
themenu () {
clear
echo `date `
echo
echo " summit Data Extract utility (SOPRA v1.1)"
echo
echo
echo "1. Extract summit configuration data only"
echo "2. Extract summit config data in flat files only"
echo "3. Extract summit account data only"
echo "4. Extract all data "
echo "5. Load summit configuration data from Dump"
echo "6. Load summit config data from flat files only"
echo
echo
echo "x. Exit"
echo
echo $MSG
echo
echo "Select option : ";
}
------ the getchar function -----------------
getchar (){
stty raw
answer=`dd bs=1 count=1 2> /dev/null `
stty -raw
}
------ the bad choice function -------
badchoice () {
MSG="Invalid menu choice"
}
After executing the script, it displays the menu
<System date>
summit Data Extract utility (SOPRA v1.1)
1. Extract summit configuration data only
2. Extract summit config data in flat files only
3. Extract summit account data only
4. Extract all data
5. Load summit configuration data from Dump
6. Load summit config data from flat files only
x. Exit
Select option :
User inputs 5, but it doesn't display on the screen and after pressing <Enter> 2-3 times, it displays the message : Invalid menu choice.
I am unable to figure out where it is causing problem ? The menu function executes fine, it causes problem when it enters getchar() function and the case statement.
Please suggest where it is going wrong and what I should correct in the script.
Thanks.