if [ "$1" == "INSTALL" ]; then OPTION="" else OPTION="--dry-run" fi CMD='upgradepkg $OPTION /mnt/storage/storage0/share/slackware/slackware-10.2/patches/packages/*.tgz' if [ ! "$1" == "INSTALL" ]; then RAW=`$CMD` OUT=`echo "$RAW" | grep -v 'already installed'` echo -e "\nWOULD NOT UPGRADE:" echo "$OUT" | sed -n 's/ would not be upgraded / /p' echo -e "\nWOULD UPGRADE:" echo "$OUT" | sed -n 's/ would upgrade: \(.*\)*/\t(\1)/p' else $CMD fi