In my script I want to check if 1 or 2 arguments have been passed but my if statement is not working the way I expect it to.
#!/bin/bash
if [[ $# -ne 1 || $# -ne 2 ]];
then
echo "Needs 1 or 2 arguments"
exit 1
fi
hello() {
echo "Hello world"
}
case "$1" in
hello)
hello
;;
*)
exit 1
esac
If I run
./script.sh hello
my If statement returns true and I get the echo statement "Needs 1 or 2 arguments". What am I doing wrong?