summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-25 10:22:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-25 10:22:32 +0000
commit8af627ba4a248c64a1f2517b3d939dcb7443469d (patch)
treeddf5e80682cc70c8e420789ed37ee7938c0c6436
parent6d91bf3b0c423f647094846b8c9ec2c8d9829f9e (diff)
downloadruby-8af627ba4a248c64a1f2517b3d939dcb7443469d.tar.gz
* tool/ifchange: commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rwxr-xr-xtool/ifchange16
1 files changed, 16 insertions, 0 deletions
diff --git a/tool/ifchange b/tool/ifchange
new file mode 100755
index 0000000000..7a192643f9
--- /dev/null
+++ b/tool/ifchange
@@ -0,0 +1,16 @@
+#!/bin/sh
+# usage: ifchange target temporary
+
+target="$1"
+temp="$2"
+if [ "$temp" = - ]; then
+ temp="tmpdata$$.tmp~"
+ cat > "$temp" || exit $?
+ trap 'rm -f "$temp"' 0
+fi
+if cmp "$target" "$temp" >/dev/null 2>&1; then
+ echo "$target unchanged"
+else
+ echo "$target updated"
+ mv -f "$temp" "$target"
+fi