summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/eplain/base/add-date
blob: 8465939b5b8e55d7d45601d7774fcef785675993 (plain)
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
#!/bin/sh
# This file is public domain.

# Change placeholders to variations on the current date.  Assumes
# various % constructs are recognized.

if test $# -lt 1
then
  echo "Usage: $0 [<file> <file> ...]"
  exit 1
fi

temp=${TMPDIR-/tmp}/adddate$$

for f in "$@"; do
  sed -e s/REPLACE-WITH-MONTH-YEAR/"`date +'%B %Y'`"/ \
      -e s/REPLACE-WITH-DAY-MONTH-YEAR/"`date +'%e %B %Y'`"/ \
      -e s/REPLACE-WITH-DATE/"`date`"/ \
      <$f >$temp
  if cmp -s $f $temp; then
    echo "$f: No REPLACE-WITH-<date>."
    exit 1
  fi
  rm -f $f
  mv $temp $f
done

rm -f $temp