You are not logged in.
Pages: 1
Imagine that I have a list of packages, some installed some not, stored in a terminal variable called ${packages}.
What commands would removed only the installed ones?
Offline
Have a look at this from the wiki
https://wiki.archlinux.org/index.php/Pa … base_group
Other than that, I suppose reading more from this link, you could get a listing of currently install packages, then work with that file anyway you see fit.
Last edited by Stratoblaster (2019-01-13 07:38:47)
Supercalifragilisticexpialidocious
Offline
Have a look at this, too:
Offline
there's already a tool for this. no need to reinvent the wheel.
# paccache -ruk0
that is, unless you need it for some reason other than clearing your cache, which doesn't really make sense unless you're just trying to get us to do your homework.
Offline
HiImTye, the OP doesn't mention anything about clearing the cache.
es20490446e, the way I read your question is that you have a list of packages (probably requirements) and you think you need to remove the ones that are already installed. If that was the right way to acheive your goal you could use `comm` on that list and the output of `pacman -Qq`. But I'm pretty sure this is an X-Y question. Do you really want to ensure that all the packages on that list are installed while not reinstalling those that already are? If so:
pacman -Syu --needed $YOUR_LIST
Or by "remove" do you mean you want to uninstall everything on that list? In that case, use a comm command to generate a list of removal targets and pass that to pacman. Unfortunately there is not --needed like flag for removal of packages (e.g., remove it it is there or ignore). And a `pacman -R` command will not do anything if any of the provided targets are not found on the system.
Last edited by Trilby (2019-01-13 14:51:35)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
So it seems that sorting first, removing after, is the simplest solution.
Offline
Pages: 1