I want to write Bash Script with User Input for my assignment called "book store service". Firstly, it has option menu like "add new book name " "author name" "remove book" "update" "search" "show book list" "Exit". If I choice option 1, I've got to input new book's name. How could I write the user input and display output data when I choice "show book list" option. I've got trouble with this Assignment. Pls someone help me to clear about this, that would be really helpful and thankful to all of you.
Take a look at the
select statement. It allows you to create a menu.
PS3="Please choose an option " select option in go stay wait quit do case $option in go) echo "Going";; stay|wait) echo "Standing by";; quit) break;; esac done
Which would look like:
1) go 2) stay 3) wait 4) quit Please choose an option
One of your options might prompt for user input:
read -rp "Enter a phrase: " phrase echo "The phrase you entered was $phrase"