Skip to content

Instantly share code, notes, and snippets.

@gigawhitlocks
Forked from mtornwall/gist:6404350
Created September 1, 2013 21:13
Show Gist options
  • Save gigawhitlocks/6407346 to your computer and use it in GitHub Desktop.
Save gigawhitlocks/6407346 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Snarf a file or the output of a command into the
# X11 paste buffer using xclip(1).
if [ -z $1 ]; then
name=`basename $0`
echo "Usage: $name [command] <arg1> ... <argN>, or"
echo " $name [file]"
exit 1
fi
if [ -f $1 ]; then
xclip -selection clipboard < $1
else
"${@:1}" | xclip -selection clipboard
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment