12345678910111213141516171819202122232425262728293031 |
- #!/bin/bash
-
- url="www.pbin.in/upload.php"
-
- if [ -t 0 ]; then
- if [ "$1" = "" ]; then
- echo "pbin <file> [name]"
- exit
- elif [ ! -s "$1" ]; then
- echo "$1: no such file"
- exit
- fi
- fi
-
- if [ ! -t 0 ]; then
- echo "catting -"
- content=$(cat -)
- echo "- catted"
- name="$1"
- else
- content=$(cat $1)
- name="$2"
- fi
-
- pasteId=$(curl "$url" -s -F "name=$name" -F "content=$content")
-
- if [ $? -eq 0 ]; then
- echo "Your paste should now be at http://pbin.in/$pasteId"
- else
- echo "There was an error. The file you provided may be too big."
- fi
|