i.services revision 4477
10139N/A#!/bin/sh
10139N/A#
10139N/A# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
10139N/A# Use is subject to license terms.
10139N/A#
10139N/A
10139N/AF_A=/tmp/services.add.$$
10139N/AF_M=/tmp/s.merged.$$
10139N/A
10139N/Awhile read src dest
10139N/Ado
10139N/A if [ ! -f ${dest} ]
10139N/A then
10139N/A cp -p ${src} ${dest}
10139N/A else
10139N/A rm -f ${F_A}
10139N/A cat ${src} |
10139N/A while read service port rest_of_line
10139N/A do
10139N/A grep "^${service}[ ]*${port}[ ]*" ${dest} \
10139N/A > /dev/null
10139N/A if [ $? != 0 ]
10139N/A then
10139N/A grep "^${service}[ ]*${port}[ ]*" \
10139N/A ${src} >> ${F_A}
10139N/A fi
10139N/A done
10139N/A if [ -s ${F_A} ]
10139N/A then
10139N/A cat ${dest} ${F_A} > ${F_M}
10139N/A cp ${F_M} ${dest}
10139N/A rm -f ${F_M}
10139N/A fi
10139N/A rm -f ${F_A}
10139N/A fi
10139N/Adone
10139N/A
10139N/Aexit 0
10139N/A