Usability testing of a shell script I wrote found that people had different expectations on how to answer a question that expected ‘yes’ as the answer. See variations in the below code example.
Surely there must be a better way that what I came up with? What is your readable and shorter form take on this?
read -p 'Answer this question with yes: ' answer if [ "$answer" = 'Y' -o "$answer" = 'YES' -o "$answer" = 'Yes' -o "$answer" = 'y' -o "$answer" = 'yes' -o some-alternate-condition ]; then echo 'Surely this can be written better?' fi