Skip to content

Instantly share code, notes, and snippets.

@AlexMoffat
Last active May 21, 2016 01:21
Show Gist options
  • Save AlexMoffat/77e8b137cf63a17e7951d024ee09a789 to your computer and use it in GitHub Desktop.
Save AlexMoffat/77e8b137cf63a17e7951d024ee09a789 to your computer and use it in GitHub Desktop.
raspberry pi turn off hdmi connected display. Easier that the inverse. Only turn the display off if tvservice does not report it's already off.
#!/bin/bash
set -o pipefail
tvservice -s | grep -q '\[TV is off\]'
if [[ $? -eq 1 ]]; then
/usr/bin/tvservice -o &> /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment