Just a side note: if the intent of the command
is to clear the content of the file, you would use one of the following instead
: > logfile
echo -n > logfile
The former is the "null command", the latter is to avoid the trailing "newline" character. Indeed, if you simply overwrite the file with a zero-length string, the result will be a 1-byte file (and subsequent writes will leave a blank line at the beginning of the file).