Last active
July 24, 2023 21:49
-
-
Save pavax/b87be45221a8230d767c979a65409080 to your computer and use it in GitHub Desktop.
cec-tv-status.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
if [[ $1 == "turn-on" ]]; then | |
command=$(echo 'on 0.0.0.0' | cec-client -s -d 1) | |
elif [[ $1 == "turn-off" ]]; then | |
command=$(echo 'standby 0.0.0.0' | cec-client -s -d 1) | |
elif [[ $1 == "status" ]]; then | |
#command=$(echo 'pow 0.0.0.0' | cec-client -s -d 1) | |
readarray -t lines < <(echo 'pow 0.0.0.0' | cec-client -s -d 1) | |
if [[ ${lines[1]} == *"on"* ]]; then | |
echo "on" | |
exit 0 | |
else | |
echo "off" | |
exit 1 | |
fi | |
elif [[ $1 == "tx" ]]; then | |
command=$(echo 'tx' $2 | cec-client -s -d 1) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment