Introduction:
I have a \'magic\' tool that can perform a command line operation on a machine if I provide the IP. The tool knows the OS that machine is
Safest way to determine Linux/version is
cat /etc/*release
Sample output.
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=17
DISTRIB_CODENAME=qiana
DISTRIB_DESCRIPTION="Linux Mint 17 Qiana"
NAME="Ubuntu"
VERSION="14.04.1 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.1 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
If I understood your problem correctly, then uname is the ideal command. If it's any Unix-system (including OSX), it'll return the correct variable, and if it's Windows it'll return command not found or similar.
Another command that should work is set, which displays name and value of each environment variable. Any shell on Linux supports it (although output is different between csh and bash). Output from a Windows system would have PROCESSOR_ARCHITECTURE and other standard variables in it (see https://ss64.com/nt/syntax-variables.html), which are very unlikely to be set in Linux.