Project

General

Profile

« Previous | Next » 

Revision 3754

in_place: Documented that doesn't update file on error

View differences:

bin/in_place
8 8
temp="$(tempfile)"
9 9
trap "rm -f $temp" EXIT
10 10

  
11
"$@" <"$file" >"$temp" || exit
11
"$@" <"$file" >"$temp" || exit # don't update file on error
12 12
diff "$file" "$temp" >/dev/null && exit # don't update file if no change
13 13
mv "$temp" "$file"

Also available in: Unified diff