D
D
Danil Antoshkin2017-05-28 11:19:30
linux
Danil Antoshkin, 2017-05-28 11:19:30

How can I determine which distribution the script is running on?

Good afternoon, I want to write a script, but there was one problem
. Depending on the distribution, you need to install different packages (and package managers are different)
How can I determine on which distribution the script is run and it is desirable that there are no dependencies on the version?
All of them: Ubuntu-Based/Debian, Arch, Fedora, Gentoo

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2017-05-28
@TwerTrue

cat /etc/*release | grep PRETTY_NAME
Try it.
Works on gentoo, centos(redhat) and debian-based.
arch\fedora don't have

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question