#!/bin/sh

if [ -z "$1" ]; then
  echo "ERROR: please specify a crontab file" >&2
  exit 1
fi

if [ -n "$2" ]; then
  cd "$2"
fi

if [ ! -f "$1" ]; then
  echo "ERROR: file does not exist" >&2
  exit 1
fi

/bin/cat "$1" | /usr/bin/crontab -

echo "New crontab for $USER:"
echo ""
/usr/bin/crontab -l
