Issue
I am writing a shell script in which I need the current operating system name to make it generic. Like:
if [ $Operating_System == "CentOS" ]
then
echo "CentOS";
# Do this
elif [ $Operating_System == "Ubuntu" ]
then
echo "Ubuntu";
# Do that
else
echo "Unsupported Operating System";
fi
How will it be possible? Applying regular expression on lsb_release -a
command or something else?
Thanks..
Solution
$ lsb_release -i
Distributor ID: Fedora
$ lsb_release -i | cut -f 2-
Fedora
Answered By - Ignacio Vazquez-Abrams Answer Checked By - Mildred Charles (WPSolving Admin)