#!/usr/bin/env bash clear; echo "+------------------------------------------------------------------------------------------------+"; echo "| please enter a search string for apt-cache search "; echo "+------------------------------------------------------------------------------------------------+"; read search; echo "here are all the matches to apt-cache $search"; sudo apt-cache search $search; echo "+------------------------------------------------------------------------------------------------+"; echo "| do you want to narrow this list with filter string? y/n "; echo "| << note: grep filter will parse only the package name, not the description >> "; echo "+------------------------------------------------------------------------------------------------+"; read yn if [[ $yn == "y" ]] then echo "enter your filter string:"; read filter; if [ "$filter" ] then echo "+------------------------------------------------------------------------------------------------+"; echo "| here are the results for apt-cache search $search | grep $filter "; echo "+------------------------------------------------------------------------------------------------+"; sudo apt-cache search $search | grep $filter echo "+------------------------------------------------------------------------------------------------+"; echo "| proceed to download these results? y/n "; echo "+------------------------------------------------------------------------------------------------+"; read yn if [[ $yn == y* ]] then for i in `sudo apt-cache search $search | awk '{ print $1 }' | grep $filter ` do echo "# $i" >> $0; sudo apt-get install -y $i; done else exit; fi fi else echo "+------------------------------------------------------------------------------------------------+"; echo "| you do not want a filter "; echo "| proceed to download all results of apt-cache search? y/n "; echo "+------------------------------------------------------------------------------------------------+"; read yn if [[ $yn == y* ]] then for i in `sudo apt-cache search $search | awk '{ print $1 }'` do echo "# $i" >> $0; sudo apt-get install -y $i; done else exit; fi fi
Friday, May 20, 2011
Ubuntu Download Helper using apt-get and apt-cache search
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment