0

I'm writing a shell script that should be able to be used with a variety of Linux distros. I want to see what base the distro is, without hardcoding everything (since there are hundreds of distros), since this script installs packages that are distro-specific (and I need to know which package manager to use). I've seen /etc/os-release, but I have heard that some distros don't have that file, or it is in a different format. Also, that won't give me what it's based on.

Thanks!

bobtho'-'
  • 175

1 Answers1

2

You could read one or more of these files:

/etc/issue

/etc/os-release

/usr/lib/os-release

They should be available in most, if not all, distributions (their eventual absence can also be used to identify the distribution).

You can find more details in the answer to Is "/etc/issue" common for all Linux distributions?.