Created
March 10, 2015 22:57
-
-
Save nibalizer/c1ea8e5a389b99c4df65 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
echo '[' | |
pkgs=`dpkg -l ` | |
IFS=' | |
' | |
count=0 | |
for pkg in $pkgs | |
do | |
if [ $count -le 4 ]; then | |
count=$((count + 1)) | |
continue | |
fi | |
installed=`echo $pkg | awk '{print $1}'` | |
name=`echo $pkg | awk '{print $2}'` | |
version=`echo $pkg | awk '{print $3}'` | |
arch=`echo $pkg | awk '{print $4}'` | |
description=`echo $pkg | awk '{print $5}'` | |
echo -n '{"name":' '"'$name'", ' | |
echo -n '"installed":' '"'$installed'", ' | |
echo -n '"arch":' '"'$arch'", ' | |
echo '"description":' '"'$description'"},' | |
done | |
echo '{}' | |
echo ']' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment