#!/bin/bash # # paste output of commands directly to pastebin.ca # regards by dpecka alias nettezzaumana ## check for -h or --help option if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then echo -e 'usage :: `foo | pastebin.sh [-f]`'; exit; fi ## check for wget availability and if is able to upload files .. if test ! -x "$(which wget 2>/dev/null)"; then echo "can't find executable wget .. it's over"; exit; fi if test -z "$(wget --help | grep 'post-file=')"; then echo "seems like your wget can't upload files .. it's over"; exit; fi PASTEBINKEY="bU5WOzg358e+D6pSAHRvuTJj/YUhY+zk"; PLINES="0"; ## build tempfile to upload .. echo "name=$USER&type=23&description=/tmp/pastebin.sh.tmpx&expiry=&s=Submit+Post&content=" > /tmp/pastebin.sh.tmpx while IFS= read -r line; do echo "$line" >> /tmp/pastebin.sh.tmpx; PLINES=$(($PLINES + 1)); done