1
0
Fork 0
mirror of https://github.com/sbrl/bin.git synced 2018-01-10 21:33:46 +00:00
bin/hastebin

22 lines
352 B
Text
Raw Normal View History

2016-07-05 17:49:21 +00:00
#!/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