Hi,
I am using two files - one file contains list of service name , other file contains commands for each of these service name .
I have to read each service name and check this string in 1.cfg file , if it exists , then i have to read another file (commands file ) and take the string and check if it is in 2.cfg file . i have to continue till end of the line in the files.
Note : it should be one after the another .
I wrote a script which is has below
for x in `cat service_list
do
grep $x 1.cfg > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$x exits"
echo "Now checking another file"
fi
for y in `cat command_list`
do
grep $y 2.cfg > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$y exists"
fi
done
done
here the inner for loop executes completly first , checks all commands and then goes to outer for loop . but my requirement is to check service then check command . and it should repeat like check service and then command.
Please help
Thanks