tiny-moon-labs / guard-free-shipping
PublicCommit
0897557#!/bin/sh
# Print the shipping fee in cents for a cart subtotal in cents.
set -eu
case ${1-} in
''|*[!0-9]*) echo 'Usage: sh shipping.sh SUBTOTAL_IN_CENTS' >&2; exit 2 ;;
esac
if [ "${#1}" -gt 9 ]; then
echo 'Subtotal exceeds the supported range (999999999 cents).' >&2
exit 2
fi
if [ "$1" -gt 5000 ]; then
echo 0
else
echo 499
fi
