diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-25 10:22:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-25 10:22:32 +0000 |
commit | c298534d3a806f8003700bb6a1d2197fe7fec316 (patch) | |
tree | ddf5e80682cc70c8e420789ed37ee7938c0c6436 /tool/ifchange | |
parent | ad614795fca05b3709b39c06196cca7b1273a8ae (diff) | |
download | ruby-c298534d3a806f8003700bb6a1d2197fe7fec316.tar.gz ruby-c298534d3a806f8003700bb6a1d2197fe7fec316.tar.xz ruby-c298534d3a806f8003700bb6a1d2197fe7fec316.zip |
* tool/ifchange: commit miss.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ifchange')
-rwxr-xr-x | tool/ifchange | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tool/ifchange b/tool/ifchange new file mode 100755 index 000000000..7a192643f --- /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 |