tiny-moon-labs / guard-free-shipping

Public
Clone

https://git.dengel.dev/tiny-moon-labs/guard-free-shipping.git

Commit 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" -ge 5000 ]; then
  echo 0
else
  echo 499
fi