Check return status of awk when adding an entry.

This will avoid truncating data file to zero length when disk is full.
This commit is contained in:
Sławomir Nizio committed 2011-06-26 01:01:40 +02:00
1 parent 3e103cf8a5
commit 3f22f53d7d
1 file changed
+3 -1
+3 -1
View File
@@ -60,7 +60,9 @@ _z() {
} else for( i in rank ) print i "|" rank[i] "|" time[i]
}
' "$datafile" 2>/dev/null >| "$tempfile"
env mv -f "$tempfile" "$datafile"
if [ $? -eq 0 ]; then
env mv -f "$tempfile" "$datafile"
fi
# tab completion
elif [ "$1" = "--complete" ]; then