Files
dotfiles/utils/.local/bin/copy

18 lines
339 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
if hash pbcopy 2>/dev/null; then
exec pbcopy
elif hash xclip 2>/dev/null; then
exec xclip -selection clipboard
elif hash putclip 2>/dev/null; then
exec putclip
else
rm -f /tmp/clipboard 2> /dev/null
if [ $# -eq 0 ]; then
cat > /tmp/clipboard
else
cat "$1" > /tmp/clipboard
fi
fi