set x $(LC_ALL=C ls -l "$file") &&
size=$6 &&
{ test $size -eq 0 ||
dd obs=1 seek=$(($size - 1)) if=/dev/null of="$file"; }
A more portable way to do that would be to use 'dd', e.g., something like the
following where 'file' contains name of the file to be trimmed:
- tests: factor the generation of files without the final eol Akim Demaille
- Re: tests: factor the generation of files without the f... Paul Eggert
- Re: tests: factor the generation of files without t... Akim Demaille
- Re: tests: factor the generation of files witho... Paul Eggert
- Re: tests: factor the generation of files w... Akim Demaille
