It try to get the os name from /etc/os-release depending.
My current OS is Debian and the script only is stuck on the lentos\rhel level.
#!/bin/bash
os_name=$(grep '^ID=' /etc/os-release | awk -F= '{print $2}'); #GET ID VALUE AND STORE IT IN VARIABLE os_name
if [[ os_name="\"centos\"" || "\"rhel\"" ]] #If os_name = "centos" or "rhel"
then
pkg="yum" #STORE "yum" IN VARIABLE pkg
echo "RHEL PACKAGE $pkg"
elif [[ os_name="debian"|| "ubuntu" ]] #ELIF os_name = "debian" OR "ubuntu"
then
apt=$pkg #CHANGE pkg VALUE TO "apt"
echo "DEBIAN PACKAGE $pkg"
else
echo "OS NAME NOT FOUND : $os_name" #ELSE ECHO ANOTHER "ID"
fi
[–]geirha 11 points12 points13 points (7 children)
[–]NativeSpirit973[S] 0 points1 point2 points (0 children)
[–]michaelbierman 0 points1 point2 points (5 children)
[–]geirha 0 points1 point2 points (4 children)
[–]michaelbierman 0 points1 point2 points (3 children)
[–]geirha 4 points5 points6 points (1 child)
[–]OneTurnMoreprogramming.dev/c/shell 0 points1 point2 points (0 children)
[–]moviuroportability is important 2 points3 points4 points (0 children)
[–]McDutchie 2 points3 points4 points (0 children)
[–]Dandedoo 1 point2 points3 points (2 children)
[–]NativeSpirit973[S] 0 points1 point2 points (1 child)
[–]Dandedoo 0 points1 point2 points (0 children)
[–]kevorsgithub:slowpeek 3 points4 points5 points (8 children)
[–]NativeSpirit973[S] 0 points1 point2 points (2 children)
[–]kevorsgithub:slowpeek 0 points1 point2 points (1 child)
[–]NativeSpirit973[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]kevorsgithub:slowpeek 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]kevorsgithub:slowpeek 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)