I have wrote this small program to check for installed and missing packages in LINUX (RHEL x86_64)
For now it perfectly prints all the installed and missing packages however I want that it loops through to the end (in either case) and
list all packages however if one or more packages are found missing then program should terminae
here is program
#echo ""
echo "Checking for installed packages...please wait"
echo ""
for PACKAGE in binutils.x86_64 compat-libstdc++-33.x86_64 glibc-common.x86_64 glibc.x86_64 glibc-devel.x86_64 \
glibc-headers.x86_64 ksh.x86_64 libaio.x86_64 libaio-devel.x86_64 libgcc.x86_64 libstdc++.x86_64 libstdc++-devel.x86_64 make.x86_64 \
compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc-devel.x86_64 libstdc++.x86_64 libstdc++-devel.x86_64 sysstat.x86_64
do
if yum list installed $PACKAGE >/dev/null 2>&1;
then
echo "$PACKAGE is installed"
else
echo "$PACKAGE not installed"
fi
no, i think exit 1 will end the loop as soon as first occurance of 'non installed' pacakge will be encountered. I dont want loop to end - #i want it to complete until it checks last package mentioned in for loop and thn exit if found any missing package.
Because than there may b last package missing - so i want to loop through all of them then list those which are missing - so that we can go back to Unix support and ask them to install the missing packages in one request, the program must also exit after listing missing packages. If none found missing than program should continue
Why don't you yum list all installed packages and then check against your list? Would have the advantage running yum just once instead of once per package.