#!/bin/sh test $# = 1||exec echo usage: $0 file; test -f $1||exec echo $1 does not exist; test ! -f $1.tmp||exec echo $1.tmp exists; cat > $1.tmp; mv $1.tmp $1;
Just was intrigued, googled it, read about it and know it solves a problem I had elegantly. Some new tool in my belt from now on.
Thank you.
While you're at it, may as well create a backup of the $1 file.
Never have I ever needed -f.