Getting started with conditionals

  • + 2 comments

    The solution

    read a
    [[ "$a" == [yY] ]] && echo 'YES'
    [[ "$a" == [nN] ]] && echo 'NO'
    # here "$a" -eq [nN] Note that -eq is not possible here. Operand is required.