Get version number in variable

Currently we can do the following in our script to create variable which holds the serial of the device:

:global serial [/system routerboard get serial-number]

However, we would like to set a variable which holds the version of the device for example:

:global serial [/system routerboard get version]

The above does not work…

I have tried doing the following:

:global version [/system resource print]

However, not only does it contain more information than what we need, when I print out the variable with

:put $version

it comes up with

input does not match any value of value-name

.

Any help would be much appreciated…

Maybe this will help !

:global version ([/system resource print as-value] -> "version")

Do not use print on scripts, until command already exist for do the same on simpler way.

What exactly you want?

RouterOS version

:global rosver [/system resource get version]

or RouterBOOT version?

:global rbootver [/system routerboard get current-firmware]

Thanks very much, both work well!