Getting started with conditionals

  • + 2 comments
    read char; echo -e "YES\nNO\n" | grep -i $char
    

    echo prints YES and NO in two different lines. (grep) -i means ignore case. grep returns whole line in which pattern is matched.