This piece of code assign the output of the lsb_release -i command at the linux_distro variable and the script compares it against the first item of distributor_id array and then the second and so on. The first item of the array is "Distributor ID: Arch" and I am using arch so the linux_distro variable is supposed to be equal with the item of the array. Of course since I am posting here this does not seem to be the case.
if [ "$linux_distro" = "${distributor_id[0]}" ] || [ "$linux_distro" = "${distributor_id[1]}" ]; then
#checking if the yay AUR helper is available (it will be needed for some of the software installed)
if ! command -v snap > /dev/null; then
echo "yay command was not found. Please install the yay AUR helper aur.archlinux.org/packages/yay from and try running the script again."
exit 1
fi
fi
I tried printing out the variable values using echo that proved to me that everything is supposed to work as intended and I tried using the [[ command with the == operator, still no solution.
It is to be noted that I replaced yay with snap just because I got yay installed and not snap, so please don’t bother with that one.
>Solution :
you can source /etc/os-release
. /etc/os-release
if [ "$ID" = "${distributor_id[0]}" ] || [ "$ID" = "${distributor_id[1]}" ]; then
#checking if the yay AUR helper is available (it will be needed for some of the software installed)
if ! command -v snap > /dev/null; then
echo "yay command was not found. Please install the yay AUR helper aur.archlinux.org/packages/yay from and try running the script again."
exit 1
fi
fi
this file is not exists on all linux distro