+bin/pb
This commit is contained in:
parent
c9f13d2eca
commit
5441c4f0c8
29
bin/pb
Executable file
29
bin/pb
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# An OS-agnostic wrapper around the system clipboard (well, for MacOS and
|
||||
# Linux).
|
||||
|
||||
if [[ -t 0 ]]; then
|
||||
if command -v xclip >/dev/null; then
|
||||
xclip -selection clipboard -out
|
||||
elif command -v xsel >/dev/null; then
|
||||
xsel --clipboard --output
|
||||
elif command -v pbpaste >/dev/null; then
|
||||
pbpaste
|
||||
else
|
||||
>&2 echo "No clipboard detected. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if command -v xclip >/dev/null; then
|
||||
xclip -selection clipboard -in
|
||||
elif command -v xsel >/dev/null; then
|
||||
xsel --clipboard --input
|
||||
elif command -v pbcopy >/dev/null; then
|
||||
pbcopy
|
||||
else
|
||||
>&2 echo "No clipboard detected. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in a new issue