uutils truncate does not support negative sizes
GNU truncate does support negative sizes (to mean remove absolute(arg) bytes from the end)
Tested Ubuntu 25.10 version of uutils truncate.
Tested main 8f62357 (2025-11-03)
Output on main build:
echo "ABC" >/tmp/a
~/.cargo/bin/coreutils truncate -s -1 /tmp/a
error: unexpected argument '-1' found
tip: to pass '-1' as a value, use '-- -1'
Usage: truncate [OPTION]... [FILE]...
For more information, try '--help'.
No error with GNU truncate:
truncate -s -1 /tmp/a
$ echo "ABC" >/tmp/a
$ truncate -s -1 /tmp/a
$ cat /tmp/a
ABC
$ truncate -s -1 /tmp/a
$ cat /tmp/a
AB
The first truncate removes the new-line that echo adds.
uutils truncate does not support negative sizes
GNU truncate does support negative sizes (to mean remove absolute(arg) bytes from the end)
Tested Ubuntu 25.10 version of uutils truncate.
Tested main 8f62357 (2025-11-03)
Output on main build:
No error with GNU truncate:
The first truncate removes the new-line that echo adds.