Created
February 1, 2018 08:52
-
-
Save alepez/bded337bf72a30c8755013fdc5b0ba7e to your computer and use it in GitHub Desktop.
Shell script to programmatically list xrandr output modes
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/sh | |
output="" | |
xrandr | while read line; do | |
if echo "${line}" | grep 'connected' > /dev/null; then | |
if echo "${line}" | grep ' connected' > /dev/null; then | |
output="$( echo "${line}" | sed 's/\(.*\) connected.*/\1/' )" | |
fi | |
elif ! echo "${line}" | grep '^Screen' > /dev/null; then | |
echo "${output}:$( echo "${line}" | awk '{ print $1 }' )" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment