A simple hastebin client. This client is meant to work on systems that have the json command. If the command is not there, this will bomb out.
#!/bin/bash
url='hastebin.com';
curl_args='--silent --request POST --data'
[[ -z $1 ]] && str=$(cat /dev/stdin) || str=$1
[[ -x $(which curl) ]] || (printf "%s\n" "Unable to locate cURL executable"; exit 1)
if [ -z "$str" ]; then
echo $usage;
exit 1;
fi
function post () {
output=$(curl $curl_args "$str" "$url/documents" | json key); ret=$?
printf "URL: %s\n" $url/$output
return $ret
}
usage="$0 pastes into $url
usage: $0 something
example: '$0 pie' or 'ps aufx |$0'"
post; exit $?