Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using CASE 1

Status
Not open for further replies.

Kipnep70

Technical User
Nov 18, 2003
81
US
I wrote a script that uses CASE for picking menu options and continuously loops until the user inputs a "0" or a selection that is invalid.

I just want it so if I (or somebody else) forgets what the choices are, then by just hitting the 'enter' key it will print the menu options again...

Code:
echo "1 - Slots Available in PX720 Library"
echo "2 - Available Scratch in PX720 Library"
echo "3 - Display Active Jobs"
echo "4 - Perform Inventory PX-720 Library"
echo "5 - Run Test Backup on Quantum PX-720"
echo " "
echo "0 - Exit"
echo " "
while [[ ${mytype} != "0" ]] do
print -n "\nEnter option number from above list: ";read var

EMAIL_LIST=nathan.kippen@csd.disa.mil
case $var in

1) mytype=availableSlots;;
2) mytype=availableScratch;;
3) mytype=activeJobs;;
4) mytype=inventoryPX;;
5) mytype=quantumTest;;
0) mytype="0";;
*) echo no valid selection, exiting script ; exit;;
esac
 
A starting point:
Code:
EMAIL_LIST=nathan.kippen@csd.disa.mil
while echo "
1 - Slots Available in PX720 Library
2 - Available Scratch in PX720 Library
3 - Display Active Jobs
4 - Perform Inventory PX-720 Library
5 - Run Test Backup on Quantum PX-720

0 - Exit
"
do
  print -n "\nEnter option number from above list: "; read var
  case "$var" in
    1) mytype=availableSlots;;
    2) mytype=availableScratch;;
    3) mytype=activeJobs;;
    4) mytype=inventoryPX;;
    5) mytype=quantumTest;;
    0) mytype=0; break;;
    "") continue;;
    *) echo no valid selection, exiting script; exit;;
  esac
done

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top