Skip to content

Instantly share code, notes, and snippets.

@mtornwall
Created September 1, 2013 13:05
Show Gist options
  • Save mtornwall/6404350 to your computer and use it in GitHub Desktop.
Save mtornwall/6404350 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 $2 $3 $4 $5 $6 $7 $8 $9 | xclip -selection clipboard
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment