Skip to content

Instantly share code, notes, and snippets.

@ryo1kato
Created September 27, 2012 05:10
Show Gist options
  • Save ryo1kato/3792264 to your computer and use it in GitHub Desktop.
Save ryo1kato/3792264 to your computer and use it in GitHub Desktop.
short-cut wrapper for apt-get and apt-cache
#!/bin/bash
# a lazy guy's wrapper for apt commands
case $1 in
showpkg|showsrc|stats|search|show|depends|rdepends|pkgnames)
set -x
apt-cache "$@"
;;
# short-cuts
se|srch) shift; set -x; apt-cache search "$@";;
dep) shift; set -x; apt-cache depends "$@";;
rdep) shift; set -x; apt-cache rdepends "$@";;
update|upgrade|install|remove|source|check|autoclean|autoremove|uninstall)
set -x
sudo apt-get "$@"
;;
get|cache)
aptcmd="apt-$1"
shift
$aptcmd "$@"
;;
''|-h|--help)
echo "Usage: apt {Commands for apt-get or apt-cache}"
;;
*)
echo "ERROR: unsupported apt-(get|cache) command for this wrapper: $1"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment