>>652
http://stackoverflow.com/questions/10082204/add-a-newline-only-if-it-doesnt-exist
awk
{ rm file;awk 1 >file; }<file

bash
[[ $(tail -c1 file) && -f file ]]&&echo ''>>file