Reputation: 3
I am writing a shell script. I have a getopts
case statement initally and then I have another case statement that simply checks $@
. In the second case statement I check if the user has typed --update or --uninstall.
In the first getopts case statement I have an error case:
"?") if [[ $@ -ne "--uninstall" ]] && [[ $@ -ne "--update" ]]; then
echo "Invalid option"
However it's not working as expected. I'm familiar with De Morgan's laws where !(A && B) = !A || !B and vice verrsa however this is not working in my script.
The expected behaviour would be I can run my script with the argument --uninstall or --update and run those functions. However not matter the configuration I have this if statement at best I can get one of the functions to run but not the other.
In the snippet I posted above running it with --uninstall it doesn't work, however --update works.
Upvotes: 0
Views: 115