#!/bin/sh

run_user=$(id -u)
if [ "$run_user" -eq 0 ] || [ "$run_user" -eq 1000 ]; then
  if [ -f "$1" ]; then
    for u in $(members users); do
      sed -e "s/USERNAME/${u}/g" "$1" | sendmail "$u"
    done
  else
    printf "Filename of email required.\\n"
  fi
else
  printf "This script really isn't meant for users. You cannot use it.\\n"
fi
