"Joi L. Ellis" writes:
- A rather general-purpose way to check for *nix is to cat /etc/issue.net,
- which is the login-banner for a remote shell connection.  These
- usually default to a line with the OS version and hostname, printed
- before the login prompt.

uhm, no.  While that may have once been true, I believe it was only
true of System V derived releases.  BSD releases don't have anything
like /etc/issue{.net}. (and I don't remember /etc/issue{,.net} on
any version of BSD I've touched, dating back to BSD 4.2.)

As an example:
        egsner-> uname -rs
        NetBSD 7.0_BETA
        egsner-> ls -l /etc/issue*
        ls: No match.

uname(1) or uname(3) are a much better starting point.  

I would sugguest that if uname -s returns 'Linux', then start
using alternative methods to figure out which distribution is in
use. (fyi: I am unable to find sw_vers on the CentOS/RHEL
systems I have.)

Doesn't the LSB (Linux Standards Base) require a file such as
lsb-release to describe the distibution? 

Not that RHEL has that, having /etc/redhat-release fill that role.
Hmm, maybe it's /etc/system-release that LSB specifies, my RHEL
boxes seem to have that.

No debian derived boxes to check, sorry.

- -----Original Message-----
- From: [email protected] [mailto:[email protected]] 
- On Behalf Of Greg Troxel
- Sent: Monday, January 19, 2015 19:28
- To: Eric Schnoebelen
- Cc: Jean-Louis Martineau; [email protected]
- Subject: Re: sw_vers not found on FreeBSD
- 
- 
- [email protected] (Eric Schnoebelen) writes:
- > Jean-Louis Martineau writes:
- > - selfcheck try to return the distro and version of the OS.
- > - How can it get that information on freebsd? or other bsd?
- > - How to get the 'FreeBSD' string and the '10.1' string?
- >
- >     uname -s -> 'FreeBSD'/'NetBSD'/'OpenBSD'/'DragonFlyBSD'
- >     uname -r -> '10.1'/'6.1_STABLE'/...
- >
- > "uname -s" provides the system name, and "uname -r" provides the OS 
- > revision (on every UNIX family system except Linux, where they return 
- > "Linux" and the kernel revision.  A side effect of how Linux 
- > distributions are created.)
- 
- Note that uname is specified by POSIX:
- 
- http://pubs.opengroup.org/onlinepubs/9699919799/utilities/uname.html
- 
- So really, uname output should be used first, and if there needs
- to be some Linux-specific extra information because of "distributions",
- that should be special-case code for Linux.
- 
- FWIW, uname -s and -r on a NetBSD box:
- 
- NetBSD
- 6.1_STABLE
- 

Reply via email to