Is there a way (from a script) to identify the default system package manager?
To clarify, what I want to do is run a given command and, on Debian or any of its derivatives it'll return something like "apt", on openSUSE it'll return "zypp", on Fedora et al it'll return "yum", on Arch Linux it'll return "pacman" etc.
I know I can do this with something like the following, I just wondered if there was a more robust method that won't break as soon as there is an executable with the same name.
which apt >/dev/null 2>&1 if [ $? -eq 0 ] then echo "apt" fi # etc...