#!/bin/sh

set -e

if [ -n "$1" ]; then
  pbcopy <"$1"
  echo File copied to clipboard
  exit
fi

if [ -t 0 ]; then
  pbpaste
else
  pbcopy </dev/stdin
fi
