Skip to content

Instantly share code, notes, and snippets.

@comm1x
Created March 14, 2016 09:49
Show Gist options
  • Save comm1x/182561cc596703391078 to your computer and use it in GitHub Desktop.
Save comm1x/182561cc596703391078 to your computer and use it in GitHub Desktop.
PT - alias wrapper for apt-get, apt-cache commands
#!/bin/bash
cmd=$1
arguments=${@:2}
if [[ $cmd = "install" ]]; then
command sudo apt-get install $arguments
exit 0
fi
if [[ $cmd = "show" ]]; then
command apt-cache show $arguments
exit 0
fi
if [[ $cmd = "search" ]]; then
command apt-cache search --names-only $arguments
exit 0
fi
if [[ $cmd = "update" ]]; then
command sudo apt-get update
command sudo apt-get upgrade
command sudo apt-get autoremove
exit 0
fi
if [[ $cmd = "installed" ]]; then
command apt list --installed *$arguments*
exit 0
fi
echo "Usage: pt {install,update,show,search,installed}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment