Play well with OSX and Linux clipboard servers

This commit is contained in:
Ali Ismayilov 2014-07-23 12:18:03 -03:00
parent 14c12d4285
commit 774a991d6a

View File

@ -1,13 +1,18 @@
# Copied from https://gist.github.com/henrique2010/4a474e036f2f1a7de96f by @henrique2010 # Copied from https://gist.github.com/henrique2010/4a474e036f2f1a7de96f by @henrique2010
# This command receives a file as param, upload it to upl.io and copy the url to the clipboard # This command receives a file as param, upload it to upl.io and copy the url to the clipboard
# #
# install: copy this code to your .bashrc or .zshrc # dependencies: curl and (xclip or pbcopy)
# dependencies: curl and xclip
# example: $ upload ~/Images/image.png # example: $ upload ~/Images/image.png
uplio() { uplio() {
echo 'Uploading...' echo 'Uploading...'
url=`curl http://upl.io -F file=@$1 -s` url=`curl http://upl.io -F file=@$1 -s`
echo -n $url | pbcopy if command -v pbcopy >/dev/null; then
echo -n $url | pbcopy
elif command -v xclip >/dev/null; then
echo -n $url | xclip -sel clip
else
echo 'You need either pbcopy or xclip to copy the url to clipboard'
fi
echo $url echo $url
} }