Last active
December 24, 2015 15:19
-
-
Save mjf/6819431 to your computer and use it in GitHub Desktop.
GETPOS - Get screen position (column, line)
This file contains hidden or 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 | |
exec < /dev/tty | |
ostty=`stty -g` | |
stty raw -echo min 0 | |
printf -- '\033[6n' > /dev/tty | |
IFS=\; read -d R -r line col | |
stty $ostty | |
printf -- '%d,%d\n' `expr ${col%R} - 1` `expr ${line:2} - 1` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment