This commit is contained in:
Kaspar V. 2025-03-22 20:31:15 +00:00 committed by GitHub
commit fd0611dfb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -279,3 +279,30 @@ function omz_urldecode {
echo -E "$decoded"
}
# The OS is linux
function is_linux { [[ "$OSTYPE" == linux* ]]; }
# The OS is Android
function is_android { [[ "$OSTYPE" == linux-android* ]]; }
# The OS is NetBSD
function is_netbsd() { [[ "$OSTYPE" == netbsd* ]]; }
# The OS is OpenBSD
function is_openbsd() { [[ "$OSTYPE" == openbsd* ]]; }
# The OS is FreeBSD
function is_freebsd() { [[ "$OSTYPE" == freebsd* ]]; }
# The OS is macOS (darwin)
function is_mac() { [[ "$OSTYPE" == darwin* ]]; }
# The OS is macOS (darwin) running on series of ARM-based systems-on-a-chip designed by Apple Inc
function is_mac_arm() { is_mac && [[ "$CPUTYPE" == arm64 ]]; }
# The OS is macOS (darwin) running on series of Intel (amd64 / x86_64) CPU
function is_mac_intel() { is_mac && [[ "$CPUTYPE" == x86_64 ]]; }
# The OS is a BSD derivate
function is_bsd() { [[ "$OSTYPE" == (darwin|freebsd|openbsd|netbsd|dragonfly)* ]]; }
# The OS is Solaris
function is_solaris { [[ "$OSTYPE" == solaris* ]]; }
# The Platform is Cygwin (Windows)
function is_cygwin { [[ "$OSTYPE" == cygwin* ]]; }
# The platform is MinGW (Windows)
function is_msys { [[ "$OSTYPE" == msys* ]]; }
# The OS is Windows
function is_windows { [[ "$OSTYPE" == (cygwin|msys)* ]]; }