Post 9t2FooNBoyaPLUMmh6 by irl@57n.org
(DIR) More posts by irl@57n.org
(DIR) Post #9t2FLLFv02CMdrugD2 by irl@57n.org
2020-03-15T15:17:41.632945Z
0 likes, 0 repeats
Learned a new way to truncate a file from a shell, it’s so simple:> filenameYou execute no command and redirect the output to the filename you’d like to truncate. It gets opened for writing, truncates it, writes nothing, then closes it again.
(DIR) Post #9t2FLLPqP88d8eYbgG by wolf480pl@mstdn.io
2020-03-15T15:19:23Z
0 likes, 0 repeats
@irl ok, but how do you truncate it to a non-zero size?
(DIR) Post #9t2FiSUgFqTDkcqCfY by irl@57n.org
2020-03-15T15:21:06.372942Z
0 likes, 0 repeats
@wolf480pldd if=filename of=filename2 bs=1 count=$N && mv filename2 filenameI really have no idea
(DIR) Post #9t2FiT5Y2lxday5e8O by wolf480pl@mstdn.io
2020-03-15T15:23:33Z
0 likes, 0 repeats
@irl truncate -s $N filenameUnfortunately not POSIX or SUS, but present in FreeBSD and GNU.
(DIR) Post #9t2FooNBoyaPLUMmh6 by irl@57n.org
2020-03-15T15:24:22.389013Z
0 likes, 0 repeats
@wolf480pl on OpenBSD thoughksh: truncate: not found
(DIR) Post #9t2FoofciRKcGezVQW by wolf480pl@mstdn.io
2020-03-15T15:24:42Z
0 likes, 0 repeats
@irl :(