boltsfrombluesky
boltsfrombluesky

Reputation: 422

Getting OS version

Is there any function to get the OS type and version?

Upvotes: 3

Views: 2572

Answers (2)

ponzao
ponzao

Reputation: 20934

uname of course prints out the kernel version, but if you want to know the distro version you could use lsb_release -a if it is available (check comment by Roman Cheplyaka).

local f = io.popen("lsb_release -a")
local s = f:read("*a")
f:close()
--# Do something with s...

The flow is the same as in the windows version.

Upvotes: 2

Jane T
Jane T

Reputation: 2091

I don't know about *nix I am afraid, but you could simply use io popen to obtain the result so for example on Windows the following will return the standard Windows Version information

local f = io.popen("ver") -- runs command
local l = f:read("*a") -- read output of command
print(l)
f:close()

Upvotes: 3

Related Questions