Project

General

Profile

« Previous | Next » 

Revision 3755

in_place: Wrap EXIT handler in shell function so that "-escaping can easily be used on the temp file path

View differences:

in_place
6 6
shift
7 7

  
8 8
temp="$(tempfile)"
9
trap "rm -f $temp" EXIT
9
onExit () { rm -f "$temp"; }
10
trap onExit EXIT
10 11

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

Also available in: Unified diff