i want to check multiple variables in bash but end up too much, is there any way to shorten this
i end up like this
if [[ $1 == -a || $2 == -a || $3 = -a ]] && [[ $1 == -b || $2 == -b || $3 = -b ]] && [[ $1 == -c || $2 == -c || $3 = -c ]] && [ $# -eq 4 ]; then
echo "insert some words"
exit
fi
i've tried this to shorten it but won't work
a=-a
b=-b
c=-c
if [[ ${@:1:3} == $a || ${@:1:3} == $b || ${@:1:3} == $c ]] && [ $# -eq 4 ]; then
echo "insert some words"
exit
fi
is there any way to shorten this? thanks in advance!