Skip to content

Instantly share code, notes, and snippets.

@GrayedFox
Created October 5, 2022 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrayedFox/da5c2f78c141427dba9fa54effc7ba67 to your computer and use it in GitHub Desktop.
Save GrayedFox/da5c2f78c141427dba9fa54effc7ba67 to your computer and use it in GitHub Desktop.
Copy contents of a file using xclip
#!/usr/bin/env bash
if [ $# -ne 1 ] ; then
echo "error: you must pass a single argument that is the file you wish to copy the contents of"
exit 1
fi
FILE=$1
xclip -selection clipboard < $FILE
# Copy the contents of a file using xclip (must install xclip if not present)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment