Last active
December 31, 2015 16:38
-
-
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
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
# 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