Cleaned up and merge other Linux snippit repo
Meged https://git.bprieshof.nl/brammp/linux into ./Linux
This commit is contained in:
33
Linux/Scripts/detect-os-V1.sh
Normal file
33
Linux/Scripts/detect-os-V1.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
source /etc/os-release
|
||||
|
||||
#echo used Vars for testing only
|
||||
echo $VERSION
|
||||
|
||||
#formaring $VERSION to a useable fromat
|
||||
VERSION=$(echo $VERSION | grep -o '[0-9]\+.' | tr -d '\n')
|
||||
|
||||
#echo used Vars for testing only
|
||||
echo $ID
|
||||
echo $VERSION
|
||||
|
||||
#example if statement
|
||||
|
||||
if [ "$ID" = "debian" ]; then
|
||||
echo "Execute Commands"
|
||||
elif [ "$ID" = "ubuntu" ]; then
|
||||
echo "Executue Ubuntu version detection"
|
||||
if [[ "$VERSION" == "18.04"* ]]; then
|
||||
echo "this ubuntu Ubuntu 18.04"
|
||||
elif [[ "$VERSION" == "16.04"* ]]; then
|
||||
echo "this ubuntu 16.04"
|
||||
else
|
||||
echo "this version of ubuntu is not yet supported"
|
||||
fi
|
||||
elif [ "$ID" = "centos" ]; then
|
||||
echo "Executue Centos Commands"
|
||||
elif [ "$ID" = "rhel" ]; then
|
||||
echo "Executue Red hat enterpise Linux Commands"
|
||||
else
|
||||
echo "this OS is not yet supported"
|
||||
fi
|
||||
Reference in New Issue
Block a user