#!/bin/sh
ofn=$1; shift
tfn=${ofn}.tmp
if "$@" > $tfn; then mv -f $tfn $ofn; else res=$?; rm -f $tfn; exit $res; fi
