Skip to content

Instantly share code, notes, and snippets.

@alex-bender
Forked from flores/hastebin.sh
Created October 13, 2016 10:58
Show Gist options
  • Save alex-bender/a70e8a090abc7a6bfc7c540fa5016851 to your computer and use it in GitHub Desktop.
Save alex-bender/a70e8a090abc7a6bfc7c540fa5016851 to your computer and use it in GitHub Desktop.
hastebin shell client
#!/bin/bash
server='hastebin.com';
usage="$0 pastes into $server
usage: $0 something
example: '$0 pie' or 'ps aufx |$0'"
if [ -z $1 ]; then
str=`cat /dev/stdin`;
else
str=$1;
fi
if [ -z "$str" ]; then
echo $usage;
exit 1;
fi
output=`curl -s -X POST -d "$str" $server/documents |perl -pi -e 's|.+:\"(.+)\"}|$1|'`
echo $server/$output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment