The "release" part of the Linux Standard Base (LSB) allow answering this question.
- to install it under GNU/Linux Fedora, use yum install redhat-lsb
- to install it under GNU/Linux Debian, use apt-get install lsb-release
Then, simply use the command lsb_release -i.
This is output instances:
- under GNU/Linux Fedora, it answers "Distributor ID: Fedora"
- under GNU/Linux Debian, it answers "Distributor ID: Debian"