Add aliases to copy to and paste from clipboard on the terminal for linux environments; analogous to pbpaste and pbcopy on Mac
parent
16bc7843c4
commit
0ddf972d99
|
|
@ -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!
|
||||||
Loading…
Reference in New Issue