From abd93661fb75e267eeeb429c8768cf774d646d43 Mon Sep 17 00:00:00 2001 From: luxick Date: Thu, 23 Oct 2025 09:16:01 +0200 Subject: [PATCH] Add bin/copy --- bin/copy | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bin/copy diff --git a/bin/copy b/bin/copy new file mode 100644 index 0000000..fde9f51 --- /dev/null +++ b/bin/copy @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -e +set -u + +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