I am trying to write a script but it is giving the above error
if [ [ [ "$1" != "abc" ] && [ "$1" != "def" ] ] || [ [ "$2" != "1" ] && [ "$2" != "0" ] ] ];
then
echo "Hello World"
fi
Be careful with && and ||. You can simplify it to this in BASH:
if [[ "$1" != "abc" && "$1" != "def" ]] || [[ "$2" != "1" && "$2" != "0" ]];
then
echo "Hello World"
fi
[[ ("$1" != "abc" && "$1" != "def" ) || ( "$2" != "1" && "$2" != "0" ) ]], which is equivalent to [[ "$1" != "abc" && "$1" != "def" || "$2" != "1" && "$2" != "0" ]].[[ ( "$1" != "abc" && "$1" != "def" ) || ( "$2" != "1" && "$2" != "0" ) ]] should also work.
fish=$1; shark=$2[is not a grouping operator; it's a command name, and as such you cannot nest them.