Skip to content

Instantly share code, notes, and snippets.

@flores
Created September 8, 2012 00:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save flores/3670953 to your computer and use it in GitHub Desktop.
Save flores/3670953 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
@sbrl
Copy link

sbrl commented Jul 5, 2016

Suggestion: Add the http:// prefix to the output as it makes the link clickable in some terminals. Example: http://hastebin.com/uyemorejay

@Justinzobel
Copy link

Doesn't work :(

@Justinzobel
Copy link

cat somefile | hb (alias for hastebin.sh)

-i used with no filenames on the command line, reading from STDIN.
hastebin.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment