[arch-general] How do you extract version from pacman?
With the new virtualbox update I had to obtain virtualbox version in a script (and of course, virtualbox binary doesn't have a sane --version parameter...). Anyway, its pretty simple to pacman -Qi virtualbox | grep -e "^Version" | awk '{print $3}' | sed 's|-.||' Perhaps it may be nice to have a pacman flag to obtain just the version string. I'll file a feature request, but before that anyone has an comments on why it would be useless or a bad idea?
On Thu, Jul 26, 2012 at 11:19 AM, Oon-Ee Ng <ngoonee.talk@gmail.com> wrote:
With the new virtualbox update I had to obtain virtualbox version in a script (and of course, virtualbox binary doesn't have a sane --version parameter...).
Anyway, its pretty simple to pacman -Qi virtualbox | grep -e "^Version" | awk '{print $3}' | sed 's|-.||'
Perhaps it may be nice to have a pacman flag to obtain just the version string. I'll file a feature request, but before that anyone has an comments on why it would be useless or a bad idea?
you could just use: $ pacman -Q virtualbox | awk '{print $2}' 4.1.18-4
Morris <lorimz@gmail.com> on Thu, 2012/07/26 11:24:
On Thu, Jul 26, 2012 at 11:19 AM, Oon-Ee Ng <ngoonee.talk@gmail.com> wrote:
With the new virtualbox update I had to obtain virtualbox version in a script (and of course, virtualbox binary doesn't have a sane --version parameter...).
Anyway, its pretty simple to pacman -Qi virtualbox | grep -e "^Version" | awk '{print $3}' | sed 's|-.||'
Perhaps it may be nice to have a pacman flag to obtain just the version string. I'll file a feature request, but before that anyone has an comments on why it would be useless or a bad idea?
you could just use: $ pacman -Q virtualbox | awk '{print $2}' 4.1.18-4
Or the same with cut: $ pacman -Q virtualbox | cut -d' ' -f2 4.1.18-4 Getting the complete package information is not required. -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
On Thu, Jul 26, 2012 at 11:19 AM, Oon-Ee Ng <ngoonee.talk@gmail.com> wrote:
Perhaps it may be nice to have a pacman flag to obtain just the version string. I'll file a feature request, but before that anyone has an comments on why it would be useless or a bad idea?
Use expac: $ expac %v -S virtualbox 4.1.18-3 (I don't have it installed, so I had to use '-S').
Thanks to Morris and Christian (karol too, but rather not have an additional package). Can't seem to find a reference to this specific behaviour on the pacman manpage, unfortunately, but it'll simplify my script. Looks like there's no way not to have the last -4 included though, but since that's version reference and quite important, I guess no way around me having to sed it out. Thanks again =)
Oon-Ee Ng <ngoonee.talk@gmail.com> on Fri, 2012/07/27 11:33:
Thanks to Morris and Christian (karol too, but rather not have an additional package). Can't seem to find a reference to this specific behaviour on the pacman manpage, unfortunately, but it'll simplify my script.
Looks like there's no way not to have the last -4 included though, but since that's version reference and quite important, I guess no way around me having to sed it out. Thanks again =)
Or use cut for that as well: $ pacman -Q virtualbox | cut -d' ' -f2 | cut -d- -f1 4.1.18 -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
On 26 July 2012 06:37, Christian Hesse <list@eworm.de> wrote:
Morris <lorimz@gmail.com> on Thu, 2012/07/26 11:24:
On Thu, Jul 26, 2012 at 11:19 AM, Oon-Ee Ng <ngoonee.talk@gmail.com> wrote:
Or the same with cut:
$ pacman -Q virtualbox | cut -d' ' -f2 4.1.18-4
Getting the complete package information is not required. -
I was just to suggest this! Anyway, this diversity and broad way to achieve the same goal is what makes Unix-like OSes so pretty: all roads leads to Rome ^_^ -- -msx
On Thu, Jul 26, 2012 at 5:19 PM, Oon-Ee Ng <ngoonee.talk@gmail.com> wrote:
With the new virtualbox update I had to obtain virtualbox version in a script (and of course, virtualbox binary doesn't have a sane --version parameter...).
Anyway, its pretty simple to pacman -Qi virtualbox | grep -e "^Version" | awk '{print $3}' | sed 's|-.||'
Perhaps it may be nice to have a pacman flag to obtain just the version string. I'll file a feature request, but before that anyone has an comments on why it would be useless or a bad idea?
$ pacman -Q virtualbox virtualbox 4.1.18-4 $ vboxmanage -v 4.1.18_OSEr78361
participants (6)
-
Auguste Pop
-
Christian Hesse
-
Karol Blazewicz
-
Martin Cigorraga
-
Morris
-
Oon-Ee Ng