From 8af627ba4a248c64a1f2517b3d939dcb7443469d Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 25 Jan 2008 10:22:32 +0000 Subject: [PATCH] * tool/ifchange: commit miss. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/ifchange | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tool/ifchange 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