Existem várias maneiras úteis de conseguir isso (em bash
):
dois cheques
echo -n "Enter test: "
read test
if [[ $test == "a" || $test == "A" ]]; then
echo "worked"
else
echo "failed"
fi
faça a entrada em minúsculas
echo -n "Enter test: "
read test
test="${test,,}"
if [[ $test == "a" ]]; then
echo "worked"
else
echo "failed"
fi
regex para ambos os casos
echo -n "Enter test: "
read test
if [[ $test =~ ^[aA]$ ]]; then
echo "worked"
else
echo "failed"
fi
faça o shell ignorar o caso
echo -n "Enter test: "
read test
shopt -s nocasematch
if [[ $test == a ]]; then
echo "worked"
else
echo "failed"
fi