Guest User

Alias to apt, apt-get completion.

a guest
Apr 30th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. alias ai="sudo apt install"
  2. alias ar="sudo apt remove"
  3. alias as="sudo apt search"
  4.  
  5. getAptCache() {
  6. mapfile -t COMPREPLY < <(apt-cache --no-generate pkgnames "$2");
  7. }
  8.  
  9. getInstalledPackages() {
  10. mapfile -t COMPREPLY < <(dpkg --get-selections | grep -v deinstall | cut -f 1 | grep "$2");
  11. }
  12.  
  13. complete -F getAptCache ai
  14. complete -F getInstalledPa ckages ar
  15. complete -F getAptCache as
Advertisement
Add Comment
Please, Sign In to add comment