-2

Environment

System: Linux Mint 18 / 19 Cinnamon 64-bit.

Shell: dash (POSIX).


Question

I need to dynamically account for the screen resolution in a POSIX shell script.

I prefer a function for re-use.

Vlastimil Burián
  • 3,024
  • 2
  • 31
  • 52

1 Answers1

2

Function

get_screen_resolution()
{
    xdpyinfo | awk '/dimensions:/ { print $2 }'
}

Usage

resolution=$(get_screen_resolution)
Vlastimil Burián
  • 3,024
  • 2
  • 31
  • 52