-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathtopline.sh
executable file
·32 lines (31 loc) · 943 Bytes
/
topline.sh
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
32
#! /bin/sh
# topline.sh.
# update top lines in docs.
# get version number and current date
ver=$(grep PACKAGE_VERSION config.h | sed 's/.*VERSION *"\(.*\)".*/\1/')
if test -z "$ver"; then
echo "Cannot get version from config.h" 1>&2
exit 1
fi
date=$(date +"%Y-%m-%d")
# update
if test -z "$@"; then
files=$(grep -l '^#=====' * 2>/dev/null)
else
files=$@
fi
for fnm in $files; do
if [ "$fnm" = "NEWS" ] ; then
continue
fi
echo "Updating $fnm..." 1>&2
{ echo "#============================================================================"
echo "# Enca v$ver ($date) guess and convert encoding of text files"
echo "# Copyright (C) 2000-2003 David Necas (Yeti) <[email protected]>"
echo "# Copyright (C) 2009-2016 Michal Cihar <[email protected]>"
echo "#============================================================================"
sed -e '1,5 d' "$fnm"
} > tmp$$
mv -f tmp$$ $fnm
done
rm -f tmp$$