#!/bin/bash
(...)
if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" == "" ] || [ "$4" == "" ] ; then # WORKS!
echo "Erro #1: Nao inseriu todos os argumentos necessarios! Tente novamente!"
echo "Ajuda #1: Lembre-se, ep1.sh [diretoria] [modo] [informação] <nome_do_ficheiro>"
elif [[ "$2" != "contar" || "$2" != "hist" ]] ; then **# THE PROBLEM!!!**
echo "Erro #2: O segundo argumento está incorrecto! Tente novamente!"
echo "Ajuda #2: Use contar ou hist."
elif [[ "$3" != "palavras" || "$3" != "bytes" ]] ; then # CAN'T TEST BECAUSE OF FIRST ELIF
echo "Erro #3: O terceiro argumento está incorrecto! Tente novamente!"
echo "Ajuda #3: Use palavras ou bytes."
(...)
fi
So, my problem is in the first elif
, when the elif
is False, the program should not enter in the elif
, but enters.
I do not see what could be the problem.
Can anyone help me?