#!/bin/bash if [ $# -ne 1 ]; then echo "Usage: $0 filename" exit 1 fi if [ ! -f "$1" ]; then echo "File $1 does not exist." exit 1 fi TMPFILE=$(tempfile) #echo "Temp File: $TMPFILE" curl -s -c $TMPFILE -H Expect: -d username= -d password= http://kpaste.net/login curl -s -D- -b $TMPFILE -H Expect: --data-urlencode code2@$1 -d paste=Send -d private=no -d expiry=d -d format=text http://kpaste.net | grep Location: | awk '{print "http://kpaste.net" $2}' rm -f $TMPFILE