PHP Code:
for chat in $(cat /tmp/123.txt| head -1) # cutting the 1st line of the file which should be ram in my case
do
call=`grep -i incoming /home/$chat | wc -l ` # search for incoming in /home/ram file and taking a count of it
if [ -n "$call" ]
then
echo " got incoming call from $chat "
else
echo "no incoming calls from $chat "
CHK=$(cat /tmp/123.txt )
printf "1d\nw\nq\n" | ed -s $CHK # removing teh first line of my file so that ram will get remove and suresh will come at the top
if [ $CHK -ge 1 ] # will check wther 123.txt is ge to 1 value
then
chat ++ # then i have to perform the same for action until the file gets empty
else
exit 0
fi
done