Shell-Script 'if on==on' 'on==on': command not found
Hello,
I was just trying to expand my script to enable/disable my AirPort card with launch/quit an application and for some reason, the syntax in if is recognized as unknown command.
The script I'm trying to expand (found somewhere on the internet some time ago) is as follows:
device="$(networksetup -listallhardwareports |
grep -E '(AirPort|Wi-Fi)' -A 1 | grep -o "en.")"
[[ "$(networksetup -getairportpower $device)" == *On ]] && val=off || val=on
networksetup -setairportpower $device $val
after multiple tries of shorter forms I finally tried expanding with:
if [["$val"=="on"]]
then osascript -e 'quit app "AdGuard"'
else
open /Applications/AdGuard.app
fi
I only get the error "on==on: command not found" or "off==on: command not found"
I hope someone is able to help me out on this.
MacBook Pro (13-inch, 2017, 4 TBT3), macOS High Sierra (10.13), null