master
text 25 lines 467 Bytes
Raw
1 #!/bin/sh
2 # Author: Christian Couder <chriscool@tuxfamily.org>
3 # MIT LICENSED
4
5 if test "$#" -lt 3
6 then
7 echo >&2 "usage $0 FILE VALUES MSG..."
8 exit 1
9 fi
10
11 FLAG_FILE="$1"
12 FLAG_VALS="$2"
13 shift
14 shift
15 FLAG_MSGS="$@"
16
17 test -f $FLAG_FILE || touch $FLAG_FILE
18
19 # Use x in front of tested values as flags could be
20 # interpreted by "test" to be for itself.
21 if test x"$FLAG_VALS" != x"$(cat "$FLAG_FILE")"
22 then
23 echo "$FLAG_MSGS"
24 echo "$FLAG_VALS" >"$FLAG_FILE"
25 fi