Does anyone know an alternative for 'dd', which won't truncate the file, without using: conv=notrunc
. Adding conv=notrunc
isn't supported via busybox/toybox due to limited amount of space.
For instance, I'd like the equivalent of
dd bs=4 count=3 skip=2 seek=3 if=file.in of=file.out conv=notrunc
But that would work where dd
doesn't support conv=notrunc
.
Best Answer
Use the standard
<>
sh
redirection operator which opens the file in read+write mode without truncation.To copy the content of
file.in
at the start offile.out
.If you need to seek in the input or output file, and assuming your
dd
still supports these directives:If you don't have
dd
at all, you can tryhead -c
, assuming your version takes care of leaving the pointer in the file at the right place upon exit (which IIRC older versions of busybox were not doing).For instance, the equivalent of the above would be: