Add aliases to copy to and paste from clipboard on the terminal for linux environments; analogous to pbpaste and pbcopy on Mac

pull/448/head
Miguel Morales 2015-04-07 15:50:52 -05:00
parent 16bc7843c4
commit 0ddf972d99
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
;;
darwin*)
;;
esac
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello
# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun!