mirror / busybox

BusyBox mirror
https://www.busybox.net/
Other
1.61k stars 605 forks source link

truncate: support for SIZE prefix #75

Open tjanas opened 1 year ago

tjanas commented 1 year ago
~/Test $ truncate --help
BusyBox v1.37.0.git (2023-08-01 12:16:57 UTC)

Usage: truncate [-c] -s SIZE FILE...

Truncate FILEs to SIZE

        -c      Do not create files
        -s SIZE
~/Test $ truncate -s -64 testFile.bin
truncate: invalid number '-64'

From man pages:

SIZE may also be prefixed by one of the following modifying characters: ‘+’ extend by, ‘-’ reduce by, ‘<’ at most, ‘>’ at least, ‘/’ round down to multiple of, ‘%’ round up to multiple of.