Check if the OS is Solaris

I need to logically check if the operating system of the Solaris computer is. In other words, I need a way to check if the Solaris operating system is if it returns TRUE , if not return FALSE . I can easily check whether the OS is Windows, Mac, Linux, because I have access to these systems, what type (for example, "unix", "windows") to search, because this information is usually available for Google. Something like:

 .Platform$OS.type == "unix" .Platform$OS.type == "windows" 

works, and there are other approaches well documented on SO (for example, Sys.info()["sysname"] == "Windows" ). In my search for SO and Google, I came across many questions regarding Windows, Mac, Linux, but I couldn’t determine in any way whether the OS is Solaris. For example, this link, which leads to duplication of other similar issues, addresses the OS definition, but not a logical check if Solaris.

How to check OS in R

How can I programmatically determine if the OS of a Solaris computer is?

I may need more specific information about which Solaris forms are of interest to me (I'm not sure because I know very little about the OS). Of particular interest are the Solaris systems used in CRAN checks:

  • R-patch-Solaris-x86
  • Mr.-patch-Solaris-SPARK
+4
r
source share
1 answer

Delving into the C code used by Sys.info , it ends with a call to sys/utsname.h , which should be defined for most Unix-like systems ( and indeed is part of the standard ).

Looking at this website , it looks like Solaris is using SunOS as utsname . Here's a copy just in case the link dies:

 The utsname macro We've already seen one macro in use on a Solaris 2 system, utsname. As a refresher, here is how we called the utsname macro ... Figure 12-1 Using the utsname macro ... utsname: sys SunOS 

In addition, the article in the Wikipedia uname article states that the system name is for all Solaris SunOS systems.

So, just for completeness, you can easily grep for this in a function:

 is.solaris<-function() grepl('SunOS',Sys.info()['sysname']) 
+7
source share

All Articles