I want to install a list of packages from a file on a debian based system. But if there is any error I just one to log the package and output a list of packages that couldn’t be installed at the end, when every package has finished installing. I don’t want to see any other output. I don’t want the installation to stop if a package gives an error, like it’s missing or can’t be installed. I want the packages to be installed without any input whenever possible.

This is the function I’m using right now, which I would like to substitute:

install_packages() {
  xargs pacstall -I < pacscripts
  sudo apt install --ignore-missing $(cat apt-pkglist)
}