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:

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"; }

Reply via email to