#!/bin/bash if (($#<2)); then echo "usage: ${0##*/} " exit 1 fi pkg=$1 new_dep=$2 additional_pkgs=($(comm -13 <(pactree -sl "$pkg" | sort -u) <(pactree -sl "$new_dep" | sort -u))) expac -SH M "%n - %m" "${additional_pkgs[@]}"