I am trying to display the version number of a Linux distro on a web page. The distro is DietPi. The version number is stored in /DietPi/dietpi/.version and looks like this;
G_DIETPI_VERSION_CORE=7
G_DIETPI_VERSION_SUB=3
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
This is what I have experimented with so far, which I've put together from examples I have found on SO.
<?php system("cat /DietPi/dietpi/.version | cut -f2 -d'=' | sed 's/[^0-9]*//g' ") ;?>
This works but there are spaces between the digits thus
7 3 2
and I need to add periods so it looks like this
7.3.2
I suspect the above is probably not the most efficient way of doing this. I'd welcome help on inserting the periods or ideas on simpler methods that would work for me.