Skip to content

Instantly share code, notes, and snippets.

@robdyke
Forked from flores/hastebin.sh
Last active July 12, 2017 20:20
Show Gist options
  • Select an option

  • Save robdyke/3f96dc433a8773d499930702a1b006b0 to your computer and use it in GitHub Desktop.

Select an option

Save robdyke/3f96dc433a8773d499930702a1b006b0 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
response=`curl -s -X POST -d "$str" https://$server/documents`
output=`echo $response|cut -d '"' -f 4`
echo https://$server/$output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment