forked from Bash-it/bash-it
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Bash-it#1773 from tbhaxor/feature/clipboard-copy
added alias for xclip command
- Loading branch information
Showing
1 changed file
with
9 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
# shellcheck shell=bash | ||
cite 'about-alias' | ||
about-alias 'pbcopy and pbpaste shortcuts to linux' | ||
about-alias 'xclip shortcuts' | ||
|
||
case $OSTYPE in | ||
linux*) | ||
XCLIP=$(command -v xclip) | ||
[[ $XCLIP ]] && \ | ||
alias pbcopy="$XCLIP -selection clipboard" && \ | ||
alias pbpaste="$XCLIP -selection clipboard -o" | ||
;; | ||
esac | ||
alias pbcopy="xclip -selection clipboard" | ||
alias pbpaste="xclip -selection clipboard -o" | ||
|
||
alias xcpy="xclip -selection clipboard" | ||
alias xpst="xclip -selection clipboard -o" | ||
# to use it just install xclip on your distribution and it would work like: | ||
# $ echo "hello" | pbcopy | ||
# $ pbpaste | ||
# $ echo "hello" | xcpy | ||
# $ xpst | ||
# hello | ||
|
||
# very useful for things like: | ||
# cat ~/.ssh/id_rsa.pub | pbcopy | ||
# cat ~/.ssh/id_rsa.pub | xcpy | ||
# have fun! |