I try to write a script to get the version of my distro so that I can pass it to a variable.
The following command is what I wrote to achieve the result.
lsb_release -ar | grep -i release | cut -s -f2
The unwanted output:
No LSB modules are available.
18.04
As you can see, the No LSB modules are available message is the unwanted part.
Since I prefer my script to be portable across servers, I don't want to install any extra packages beside utilizing the lsb_release -a command.
No LSB modules are available. Can you confirm that your solution - in addition to printing only the bare version number - also suppresses that message? – AdminBee Apr 24 '20 at 09:41The reason that the OP gets the unwanted information is because the package
– JoKi Apr 26 '20 at 05:59lsb-coreis not installed.lsb_release -adoes the trick too – NanoNova Aug 25 '22 at 16:06lsb_release -srDOES show me "No LSB modules are available." as well :/ – Michael Große Jun 08 '23 at 15:30
– JoKi Jun 09 '23 at 17:06$ lsb_release -sr 2>/dev/null