/usr/bin/cpif is in noweb 2.11b-11.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/bin/sh
# cpif [ -eq -ne ] file...
# copy standard input to each of the named files
# if new * old is true or old doesn't exist;
# * defaults to -ne
PATH=/bin:/usr/bin
# set -x
op=-ne
case "$1" in
-eq|-ne) op=$1; shift ;;
-*) echo 'Usage: '`basename $0`' [ -eq -ne ] file...' 1>&2; exit 2
esac
case $# in
0) echo 'Usage: '`basename $0`' [ -eq -ne ] file...' 1>&2; exit 2
esac
new=$(tempfile)
trap 'rm -f $new; exit 1' 1 2 15 # clean up files
cat >$new
for i
do
cmp -s $new $i
case $op$? in
-eq0|-ne1|*2) cp $new $i || { rm -f $new; exit 1; }
esac
done
rm -f $new
|