* tool/ifchange: commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6d91bf3b0c
commit
8af627ba4a
16
tool/ifchange
Executable file
16
tool/ifchange
Executable file
@ -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
|
Loading…
x
Reference in New Issue
Block a user