Skip to content

Instantly share code, notes, and snippets.

Created April 20, 2013 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5427004 to your computer and use it in GitHub Desktop.
Save anonymous/5427004 to your computer and use it in GitHub Desktop.
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