Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
130
rated 0 times [  130] [ 0]  / answers: 1 / hits: 160935  / 2 Years ago, sat, october 1, 2022, 11:31:54

I am writing a Bash script to store the version number of Virtualbox, but cannot succeed.



My Script is:



#!/bin/bash
installed_virtualbox=$(virtualbox --version) # --version this is what I want to change


I tried



virtualbox --version
virtualbox -v
virtualbox -V
virtualbox --Version


all seems to open the virtualbox instead of output.

virtualbox --help gives the version number, but the output is too long to store in variable and use later.


More From » bash

 Answers
4

To print or view the current VirtualBox version you should use below command:



vboxmanage --version


which will then print the current version as seen below;



enter image description here



Refer 8.2. Command overview at the official VirtualBox site for more.






To print the version using the script, see below:



#!/bin/bash
echo $(vboxmanage --version)


Hope it helps.


[#27029] Monday, October 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
barted

Total Points: 424
Total Questions: 103
Total Answers: 101

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
barted questions
;