Getting screen dimensions in a shell script To run a game on my Nexus 5 (5.1), I need to change my screen resolution. I'm trying to write a shell script that will detect the current resolution and change it, basically a toggle.

I know that I can actually change the resolution using wm size XXXXxYYYY, but I don't know how I can check the current resolution. I know very, very little about regex, and I tried to figure out how to pull the results from dumpsys display, but I really had no idea what to do.

How can I get the current screen resolution for a shell script that will use if to check it, like a toggle?
you nearly answered your question already. wm size shows you the current resolution.

Saving the output of the screen reoslution into a shell variable: A=$(wm size | busybox cut -c16-)