#!/bin/sh
#
# pbp - pasteboard filter
# pipe pasteboard through the 1st argument, then place it back on pasteboard

if [ -z "$1" ]; then
  echo "Please provide a command to pipe through."
  exit 1
fi

pbpaste | "$@" | pbcopy
printf '%b\n' "Clipboard content filtered through '$*' successfully:"
pbpaste
