Skip to content

Instantly share code, notes, and snippets.

@jdsumsion
Last active December 14, 2015 12:09
Show Gist options
  • Save jdsumsion/5084496 to your computer and use it in GitHub Desktop.
Save jdsumsion/5084496 to your computer and use it in GitHub Desktop.
X Clipboard helper script
#!/bin/bash
#
# While 'xclip' is helpful, it's way too verbose,
# and the defaults are unhelpful for common
# "Ctrl-C/V" type usages.
#
# This 'xcl' utility transforms 'xclip' into a
# helpful cmdline friend.
#
# usage:
# - cat some_file | xcl
# - xcl > some_file
#
# read from clipboard if stdin is a tty, otherwise write to clipboard
[ -t 0 ] && xclip -o -selection clipboard || xclip -i -selection clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment