In Linux, write a script to create a menu guide for a customer in selecting a fl
ID: 3686373 • Letter: I
Question
In Linux, write a script to create a menu guide for a customer in selecting a flash memory device from the list of choices in the file "flashparts".
The first prompt should be 1) 8Mb 2) 16Mb 3) 32Mb Enter the desired memory size:
After selecting 1, 2, or 3 a menu for possible choices based on package type is shown, 1) 46-BGA 2) 46-MBGA 3) 48-TSOP 4) 64-BGA Enter the desired package type:
If the user selects 2, then select the recor having the least single queantity cost and display full record
Then give the user an option to continue with a new search or exit.
Explanation / Answer
Hi. I have done the first part. I am unable to understand the options after the firstc hoice is made. Can you please re-explain it? However, you can easily replicate the code for menu based choices, but you can certainly tell me the part 2.
#!/bin/bash
# Menu Based Script
PS3='Enter the desired memory size: '
options=("1) 8 MB" "2) 16 MB" "3) 32 MB" "Quit")
select opt in "${options[@]}"
do
case $opt in
"1) 8 MB")
echo "Here do your action for choice 1"
;;
"2) 16 MB")
echo "Here do your action for choice 2"
;;
"3) 32 MB")
echo "Here do your action for choice 3"
;;
"Quit")
break
;;
*) echo invalid option;;
esac
done
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.