4 ms·
Yes because you could just do > save_my_butt.img and now it's 0 bytes.
by geocrasher 6y ago
Yes because you could just do
> save_my_butt.img
and now it's 0 bytes.
- kiwijamo 6y agoWould that work? The fs may actually allocate a new file before deleting the exisiting allocation so the risk of it not working is still there I would think?
- quesera 6y agoIt might vary by kernel, filesystem, or shell, but in my experience and confirmed with a quick test: shell redirection does not create a new file/inode.
- geocrasher 6y agoWorst case scenario, if > filename didn't null it, then just echo "0" > filename