Created
January 26, 2023 10:21
-
-
Save holiman/95dad588a43af6f6139a3c7522059cc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Linux version | |
# Use this script to pipe in/out of the clipboard | |
# | |
# Usage: someapp | clipboard # Pipe someapp's output into clipboard | |
# clipboard | someapp # Pipe clipboard's content into someapp | |
# | |
if command -v xclip 1>/dev/null; then | |
if [[ -p /dev/stdin ]] ; then | |
# stdin is a pipe | |
# stdin -> clipboard | |
xclip -i -selection clipboard | |
else | |
# stdin is not a pipe | |
# clipboard -> stdout | |
xclip -o -selection clipboard | |
fi | |
else | |
echo "Remember to install xclip" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment