[arch-general] How do you extract version from pacman?

Christian Hesse list at eworm.de
Fri Jul 27 03:58:01 EDT 2012


Oon-Ee Ng <ngoonee.talk at 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);}


More information about the arch-general mailing list