Skip to content

Instantly share code, notes, and snippets.

@MartinSeeler
Created August 6, 2013 15:03
Show Gist options
  • Save MartinSeeler/6165281 to your computer and use it in GitHub Desktop.
Save MartinSeeler/6165281 to your computer and use it in GitHub Desktop.
some sed and grep games to extract screen dimensions
#!/bin/sh
screen_dim=$(xdpyinfo | grep dimension | awk '{print $2}')
echo "screen size is $screen_dim"
screen_dim_x=$(echo ${screen_dim} | sed -e 's/x/\n/g' | sed -n '1p' )
screen_dim_y=$(echo ${screen_dim} | sed -e 's/x/\n/g' | sed -n '2p' )
echo "screen width is $screen_dim_x"
echo "screen height is $screen_dim_y"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment