The operating system release

What’s the ruby way to find out “the operating system release”? Thanks.

IMO there is no simple way to find it out.
I would first test the PLATFORM constant.
If it is some kind of UNIX you can use
uname
or the uname module from
http://www.ruby-lang.org/raa/list.rhtml?name=sys-uname

For Windows I don’t know.

···

On Mon, Jan 06, 2003 at 09:20:27PM +0900, TOTO wrote:

What’s the ruby way to find out “the operating system release”? Thanks.


Dalibor Sramek insula.cz | In the eyes of cats,
dalibor.sramek@insula.cz | all things belong to cats.

You can use the PLATFORM constant to get the OS:

irb(main):001:0> PLATFORM
"i586-mswin32"

If you want to get the version of the OS, under linux (and perhaps other
unix) you can call the command “uname”.

os_version = uname -a

regards

If you want to get the version of the OS, under linux (and perhaps other
unix) you can call the command “uname”.

os_version = uname -a

regards

Yes. I knew this. But my goal is to implement a Unix uname clone. So I
can’t use uname itself to do that.

Well, there is /etc/redhat-release on Redhat and Mandrake systems. Maybe you could check for this file, and maybe there are like files on other distributions like Suse and Debian?

···

On Tue, 7 Jan 2003 12:03:07 +0900 zhoujing@comp.nus.edu.sg (TOTO) wrote:

If you want to get the version of the OS, under linux (and perhaps other
unix) you can call the command “uname”.

os_version = uname -a

regards

Yes. I knew this. But my goal is to implement a Unix uname clone. So I
can’t use uname itself to do that.


“Daniel P. Zepeda” <daniel@z,e,p,e,d,a,-,z,o,n,e.net>
(Remove commas for address)