Today I wanted to truncate a file from bash and discovered that using the dummy placeholder : worked a treat:
:>example-file-to-truncate.txt
..I've been using bash for years and completely overlooked this gem - I should have devoted more effort into reading the POSIX 1003.2 standard or the bash manual a long while ago...
Doesn't the following command achieve the same result?
ReplyDelete>example-file-to-truncate.txt
@MrM, you're right, you win the optimal solution award!
ReplyDelete