From 285f63eaea55b3442223fbf077b7c4ac4cf3e696 Mon Sep 17 00:00:00 2001 From: Ibrahim Bassam Date: Wed, 12 May 2021 00:01:49 +0500 Subject: [PATCH] fixed WSL1 and WSL2 --- osdetect.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/osdetect.sh b/osdetect.sh index 3a493af..592ebb6 100644 --- a/osdetect.sh +++ b/osdetect.sh @@ -1,20 +1,26 @@ #!/bin/bash -if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ $(uname -r | grep -oE Microsoft) = "Microsoft" ] +WSL1=$(uname -r | grep -oE Microsoft) +WSL2=$(uname -r | grep -oE microsoft) +MAC=$(uname -a | grep -oE Darwin | tail -n1) +ANDROID=$(uname -a | grep -oE Android) + +if [ "$WSL1" = "Microsoft" ] || [ "$WSL2" = "microsoft" ] then - OS=windows + OS=windows #echo ${red}WSL Not Supported!${reset} 1>&2 #exit -elif [ $(uname -a | grep -oE Darwin | tail -n1) = "Darwin" ] +elif [ "$MAC" = "Darwin" ] then - OS=macos - export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" + OS=macos + export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" #echo ${red}MacOS Not Supported!${reset} 1>&2 #exit -elif [ "uname -a | grep -oE Android" = "Android" ] - then - OS=android +elif [ "$ANDROID" = "Android" ] + then + OS=android else : fi source readpass.sh +