Created
October 22, 2013 23:49
-
-
Save wfarr/7110171 to your computer and use it in GitHub Desktop.
dirty hacks done right
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat lol.rb | |
require "rubygems" | |
require "json" | |
output = `/usr/bin/dpkg-query -W --showformat '{ "status": "${Status}", "package": "${Package}", "version": "${Version}" }\n'`.chomp | |
p JSON.parse("[#{output.split("\n").join(",")}]")[0..2] | |
# ruby lol.rb | |
[{"version"=>"1.2.1.30200-1", "status"=>"install ok installed", "package"=>"aacraid"}, {"version"=>"0.6.15-2ubuntu9.6.1", "status"=>"install ok installed", "package"=>"accountsservice"}, {"version"=>"2.2.51-5ubuntu1", "status"=>"install ok installed", "package"=>"acl"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment