I am trying to write a script which works based on the knowledge that each Linux Mint release was based on a particular Ubuntu release.
However, I do not want to install Linux Mint to verify that, but instead let the users of the script test it, if they need it.
Can I rely on the presence of /etc/debian_version, though? I am doing this in order to detect Debian and its derivatives. It works reliably on Debian and Ubuntu, but does Linux Mint have this file?
Note: I am aware of lsb_release and I am using that in order to figure out more details later on. But the existence of /etc/debian_version is a way to make assumptions about certain things before even checking for and invoking lsb_release.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
As mentioned in @kirill-a’s answer, /etc/debian_version should be present in any Debian derivative.
Another useful approach to find out information on the current Debian-based distribution and its “ancestry” is dpkg-vendor; for instance,
dpkg-vendor --derives-from Debian
should succeed on any Debian derivative (and on Debian itself),
dpkg-vendor --derives-from Ubuntu
should succeed on any Ubuntu derivative (and on Ubuntu itself), etc. A distribution is considered a derivative of itself as well as of its parents, so Ubuntu is a derivative of Ubuntu and of Debian.
dpkg-vendor is shipped in dpkg-dev so that needs to be installed for the command to be available, which reduces the usefulness somewhat.
Method 2
Yes, as in any Ubuntu derivative, this file is present.

Method 3
I’m running Mint 19
$ lsb_release -d Description: Linux Mint 19 Tara $uname -a Linux mymc 4.15.0-20-generic #21-Ubuntu SMP ... $ cat /etc/debian_version buster/sid
This: cat /etc/debian_version | grep -o '[0-9]'| head -1|sed -e 's/ //'
should tell you what version of debian is used, but mint obscured it.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0