I'm trying to Create OS detect portable function in bash script,
So I just want to know, the file
"/etc/issue" is common for all Linux Flavors ?
Yes this is a standard file across distributions. It's standard on most distros, Fedora/CentOS/RHEL/Debian/Ubuntu etc.
In addition to slm's answer, it's worth remembering that anyone (with root access) can edit the content of
/etc/issue. Some organisations may do so to present pre-login warnings or disclaimers, and others may remove all identification of the distribution for security reasons (it doesn't matter how effective either of these measures are).
Therefore, while /etc/issue may exist almost all the time, the content is not necessarily suitable for detecting the OS (as you put it, or more likely, the Linux distribution).
@EightBitTony's answer is correct. Also it does not exist by default on fedora 23.
Do not rely on it for identifying random systems. I'd use
/etc/os-release but not sure how much universal that is.
Reading a bit
/etc/os-release comes with
systemd so I guess won't work with archaic distros (or any that hate
systemd). Could not find authoritative info about
/etc/system-release. I guess one has to check many files if compatibility is important. Or use
/etc/os-release if edge cases are not important.