0

I have an if/then statement prompting for user input:

if [[ "$email_answer" = [Yy] ]]; then

How do I get that statement to accept the word "Yes", "YES" or "yes" in addition to "Y" or "y"?

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
bluethundr
  • 1,005
  • 17
  • 68
  • 141

1 Answers1

2

You can use case for this:

case $email_answer in
  [yY][eE][sS]|[yY])
  ;;
esac
anubhava
  • 761,203
  • 64
  • 569
  • 643