Created
April 20, 2013 19:01
-
-
Save anonymous/5427004 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
if [ -n "$1" ] | |
then | |
if [ `yaourt -Qqe | grep $1 | awk '{print NR " " $0 }' | wc -l` = 0 ] | |
then | |
echo "No packages matching". | |
else | |
if [ `yaourt -Qqe | grep $1 | awk '{print NR " " $0 }' | wc -l` = 1 ] | |
then | |
yaourt -Rs `yaourt -Qqe | grep $1` | |
else | |
echo -e '\033[0;32m' `yaourt -Qqe | grep $1 | awk '{print NR " " $0 }' && tput sgr0` | |
echo "Which package would you like to remove with all the dependences?(Type its number or "all" to remove all the packages in the list)" | |
read number | |
if [ ${number} = all ] | |
then | |
yaourt -Rs `yaourt -Qqe | grep $1` | |
else | |
yaourt -Rs `yaourt -Qqe | grep $1 | sed -n "${number}p"` | |
fi | |
fi | |
fi | |
else | |
echo "Please, type the name(or the part of the name) of the package you want to remove." | |
read pkg | |
if [ `yaourt -Qqe | grep ${pkg} | awk '{print NR " " $0 }' | wc -l` = 0 ] | |
then | |
echo "No packages matching". | |
else | |
if [ `yaourt -Qqe | grep ${pkg} | awk '{print NR " " $0 }' | wc -l` = 1 ] | |
then | |
yaourt -Rs `yaourt -Qqe | grep ${pkg}` | |
else | |
echo "Here is the list of your packages:" | |
echo -e '\033[0;32m' `yaourt -Qqe | grep ${pkg} | awk '{print NR " " $0 }'` && tput sgr0 | |
echo "Which package would you like to remove with all the dependences?(Type its number or "all" to remove all the packages in the list)" | |
read number | |
if [ ${number} = all ] | |
then | |
yaourt -Rs `yaourt -Qqe | grep ${pkg}` | |
else | |
yaourt -Rs `yaourt -Qqe | grep ${pkg} | sed -n "${number}p"` | |
fi | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment