I have a legacy script that depends on the value of $OSTYPE
variable. What this script expects is that on Solaris the value is "SunOS" while on AIX it is "AIX". For Linux it checks the variable against the regex where the uppercased value starts with "LINUX".
I've tried to run this script from Jenkins, and discovered that the values are different: Solaris returns "solaris2.11" while AIX returns "aix7.1.0.0". I ran the echo $OSTYPE
command on exactly the same servers where Jenkins runs the script, and I get "SunOS"/"AIX" instead.
So the main question I have is: what is the source of this difference (how does the system form the value of this variable, and why does Jenkins have different values than just echo ran from bash). A side question is which is the reliable way to use $OSTYPE
.