Create small utility functions in your shell scripts that you can delegate to.
Example
#! /bin/bashsh -
# vim: set ft=sh
# size utility that works on GNU and BSD systems
size(){
if [[case $(uname) =in
(Darwin ]];| then*BSD*)
stat -Lf %z -- "$1""$1";;
else
(*) stat -c %s -- "$1"
fiesac
}
for f in $@; do
echoprintf '%s\n' "$f : $(gzip -c< $f"$f" | wc -c) bytes (versus $(size $f"$f") bytes)"
done
Based on info from @Stéphane Chazelas' answer.