I am trying to make a distribution checker for an installer but am getting errors that I can not figure out. Would someone help with this distribution checker - am I doing the variable declaration wrong here? The script gives me the errors:
read: `NAME=Fedora': not a valid identifier and blank.
Is there any other way I could achieve the same thing without uname? I'll check uname after I have fixed this so that I can have the installer work on mac as well.
#!/usr/bin/bash
#distribution detection system
NAME=$(head -n 1; grep NAME= "/etc/os-release")
#installer promt
read -p "Install tools [y/n]?" insatll_base
case "$insatll_base" in
y|Y ) echo "installing addtional programs and tools";
#checks for fedora
read $NAME;
if [$NAME="Fedora"]; then
dnf install cpan -y;
cpan install Menu::Item;
fi;
read $NAME;
if [$NAME="NAME=Redhat"]; then
dnf install cpan -y;
cpan install Menu::Item;
fi;