Monday, October 17, 2016

Bash (Unix shell): Select Menu Example: PS3

Command:

$ PS3="please select item > "; select item in "item1" "item2" "item3"; do if [ $REPLY = "q" ]; then break; fi; done;


Result:

1) item1
2) item2
3) item3
please select item >


User input:

1


Result:

please select item >


User input:

q