Redirection caveat Solution: use a temporary file instead prog file.txt > file.tmp mv -f file.tmp file.txt