forked from openSUSE/twopence
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubst.sh
More file actions
executable file
·37 lines (32 loc) · 753 Bytes
/
subst.sh
File metadata and controls
executable file
·37 lines (32 loc) · 753 Bytes
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
33
34
35
36
37
#!/bin/bash
#
# Replace version and date information in header files,
# manpages etc.
#
#
# The following two variables control all occurences of the version
# and date string as they appear in manpages, ruby gems etc.
#
# Whenever you update the minor version or patch level of twopence,
# this is all you need to touch.
#
# If we ever bump the major version number, more manual work is
# required.
#
VERSION=0.4.2
DATE="August 2021"
# Special case
if [ $# -eq 1 -a "$1" = "--version" ]; then
echo "$VERSION"
exit 0
fi
SEDOPT=""
# If no arguments are given, act as a pipe command, otherwise
# edit files in-place using "sed -i"
if [ $# -ne 0 ]; then
SEDOPT=-i
fi
exec sed $SEDOPT \
-e "s:@VERSION@:$VERSION:g" \
-e "s:@DATE@:$DATE:g" \
"$@"