From 56ad1507b912f0aadecc24d7bef1cf130af7b963 Mon Sep 17 00:00:00 2001 From: Greg Wildman Date: Mon, 22 Jul 2019 12:19:41 +0200 Subject: [PATCH] Use the correct stat command for macos and linux --- bin/padto | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/padto b/bin/padto index cf4d29694..eb4deb7cb 100755 --- a/bin/padto +++ b/bin/padto @@ -2,6 +2,10 @@ totalsize=$1 outfile=$2 -filesize=`stat -f "%z" "$outfile"` + +[[ "$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"