Maybe I am approaching this the wrong way, so I am open for suggestions. I am trying to avoid adding the output of INSTALLED_LIST to a file. I wish to use it within a variable.
Basically, I want to check if a list (INSTALLATION_PACKAGES) of packages are installed on a system. If not, record which ones failed to install, record the information, and exit. Outside of the if statement, this works fine (see commented out line), I am just having issues implementing it within an if statement.
Thx in advance for your help.
INSTALLED_LIST=`dpkg --list` for i in $INSTALLTION_PACKAGES; do apt-get -y install $i # echo "$INSTALLED_LIST" | grep -ie "^ii $i " if ! echo "$INSTALLED_LIST" | grep -ie "^ii $i " ; then echo $i >> $FAILED_INSTALL fi done