Skip to content

Instantly share code, notes, and snippets.

@jameswebb68
Last active December 31, 2015 16:38
Show Gist options
  • Save jameswebb68/8014473 to your computer and use it in GitHub Desktop.
Save jameswebb68/8014473 to your computer and use it in GitHub Desktop.
For CYGWIN, check if windows x86_64 64-bit and windows is 7 through 8.1. redundant accurate check
# is Windows NT 6+
check-os-ver() {
local WMIC="$(wmic os get version | grep -oE ^6\.[2-3]{1})" # 6.0 - 6.3
local CYGW="$(uname -s | grep -oE 6\.[2-3]{1})" # 6.0 - 6.3
[[ -n "$WMIC" && -n "$CYGW" && "$WMIC" == "$CYGW" ]]
}
# is 64-bit windows
check-windows-arch() {
local WMIC="$(wmic OS get OSArchitecture /value | grep -o '64-bit')"
local PATH="$(cd -P "$(cygpath -W)"; cd ../Program\ Files\ \(x86\) 2>/dev/null && echo "64-bit")"
[[ -n "$WMIC" && -n "$PATH" && "$WMIC" == "$PATH" ]]
}
check-os-ver || echo "not supported"
check-windows-arch || echo "not supported"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment