Опять же, не мудрствуя, просто скрипт. С папрметром -h как бы дает краткую спраку.
#!/bin/bash # # pastebash # # author: Livid # http://livid.pp.ru/?p=367 # # Simple bash script to paste to pastebin.com. Requires file, # and curl. # Based on lydgates apaste script # http://lydgate.nonlogic.org/archlinux/apaste.sh # #specify defaults here USER="Anonymous" TYPELIST="help" BASE=`basename $0` [ -e "`which curl`" ] || ( echo "Curl not found!"; exit 1) while getopts "u:t:h" opt; do case $opt in u) USER="$OPTARG";; t) TYPE="$OPTARG" if [ "$TYPE" == "$TYPELIST" ]; then echo "Type is one of:" curl -s http://pastebin.com |\ tr -d '\r\n' |\ sed -r 's:.*(<select +name="format">(<option[^>]+value="[^"]*">[^<]*</option>)+</select>).*:\1:; s:</*select[^>]*>::g; s:<option[^>]+value="([^"]+)">([^<]+)</option>:\t\1 - \2\n:g' |\ sort -u | grep -v -e "---------------" exit 4 fi ;; ?|h) echo -e " Usage: $BASE [-u User] [-t Type] [file|-] where User is an arbitrary string, default is '$USER' file is source file or - for stdin Type is one of regitered pastebin types. Run $BASE -t $TYPELIST to see full list By default, we attempt type autodetection based on 'file' output" exit 3 ;; esac done shift $(($OPTIND-1)) [ "$TYPE" ] || case `file "$1"` in *Bourne*) TYPE="bash";; *python*) TYPE="python";; *perl*) TYPE="perl";; *HTML*) TYPE="html4strict";; *) TYPE="text";; esac DATA=`cat "$1"` || exit 2 curl -d "format=$TYPE" \ --data-urlencode "code2=$DATA" \ -d "poster=$USER" \ -d "expiry=expiry_day" \ -d "paste=Send" \ -i -s "http://pastebin.com/pastebin.php" \ | grep 'Location'
GPLv3, если что.
Связанные посты:

$ /path/to/subj/script /path/to/textfile без реакции (проходит ли что-то через сетевую не смотрел)
Комментарий by su6s — Октябрь 8, 2009 @ 23:18
Ну да, я забыл убрать отладочный echo в конце. Извините, бывает.
Исправил, теперь должно работать.
Комментарий by Livid — Октябрь 9, 2009 @ 08:14