4sports/bin/padto.sh

12 lines
237 B
Bash
Raw Normal View History

2021-02-16 06:01:22 +00:00
#!/bin/bash
totalsize=$1
outfile=$2
[[ "$OSTYPE" == "linux-gnu" ]] \
&& filesize=$(stat -c "%s" "$outfile") \
|| filesize=$(stat -f "%z" "$outfile")
padsize=$((512-$filesize))
dd if=/dev/zero bs=1 count=$padsize >> "$outfile"