Last active
July 26, 2017 01:57
-
-
Save rkennesson/635bc2c4bb14015a428edfaed87bdddd to your computer and use it in GitHub Desktop.
sprunge paste
This file contains hidden or 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
#!/bin/bash | |
# requires xclip to paste into xsession clipboard otherwise | |
# print to terminal | |
if hash xclip 2>/dev/null; then | |
echo "sending url to clipboard"; | |
curl -s -F 'sprunge=<-' http://sprunge.us | xclip -selection c; | |
else | |
curl -s -F 'sprunge=<-' http://sprunge.us; | |
fi | |
# original from | |
# https://www.reddit.com/r/linux/comments/5zqku2/list_of_command_line_curl_tools_like_ixio_0x0st/df1lpr8/ | |
# tmpfile=$( mktemp -t paste.XXXXXXXXXX ); | |
# curl -s -F 'sprunge=<-' http://sprunge.us >> "$tmpfile"; | |
# cat "$tmpfile"; | |
# echo "putting it in the clipboard"; | |
# cat "$tmpfile" | xclip -selection c; | |
# rm -f "$tmpfile"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment