Skip to content

Instantly share code, notes, and snippets.

@mgor
Last active December 2, 2016 06:48
Show Gist options
  • Select an option

  • Save mgor/b69dea465fc5b5f02a17f2ef20d47e27 to your computer and use it in GitHub Desktop.

Select an option

Save mgor/b69dea465fc5b5f02a17f2ef20d47e27 to your computer and use it in GitHub Desktop.
test if terminal supports unicode
test_unicode() {
echo -ne "\xe2\x88\xb4\033[6n\033[1K\r"
# shellcheck disable=SC2034
read -d R foo
echo -ne "\033[1K\r"
echo -e "${foo}" | cut -d \[ -f 2 | cut -d";" -f 2 | (
read UNICODE
[[ $UNICODE -eq 2 ]]
) 2>/dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment