I want to create a toggle key for a Gnome extension. An extension keeps up with its state in a property. I chose this extension for example purpose:
gnome-extensions show email@example.com | grep State
I was expecting to use the turned value and do a string compare, but I am having problems. The returned value does not seem to be a string.
#!/bin/bash STATE="$(gnome-extensions show firstname.lastname@example.org | grep State)" echo $STATE # output: State: ENABLED COMPARE="State: ENABLED" # does not work if [ "$STATE" = "$COMPARE" ]; then echo "the state is enabled" fi
My guess is that the returned result is not a string and that the colon has an obvious meaning in this, but I can’t figure out how to go about this.