#!/bin/sh
#
# Returns the sign of an integer or a rational. It assumes that zero will
# always be written as "0", never "+0" or "-0". For positive numbers, the
# sign can be omitted.
#
case "$#" in
  1) ;;
  *) echo "Usage: $0 <number>" 1>&2; exit 1;;
esac
case "$1" in
  0)  echo  "0"; exit;;
  -*) echo "-1"; exit;;
  *)  echo "+1"; exit;;
esac
