Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clipcopy () {
- emulate -L zsh
- local file=$1
- if [[ $OSTYPE == darwin* ]]
- then
- if [[ -z $file ]]
- then
- pbcopy
- else
- cat $file | pbcopy
- fi
- elif [[ $OSTYPE == cygwin* ]]
- then
- if [[ -z $file ]]
- then
- cat > /dev/clipboard
- else
- cat $file > /dev/clipboard
- fi
- else
- if (( $+commands[xclip] ))
- then
- if [[ -z $file ]]
- then
- xclip -in -selection clipboard
- else
- xclip -in -selection clipboard $file
- fi
- elif (( $+commands[xsel] ))
- then
- if [[ -z $file ]]
- then
- xsel --clipboard --input
- else
- cat "$file" | xsel --clipboard --input
- fi
- else
- print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
- return 1
- fi
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement