Simple image host.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pbin 471B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. url="www.pbin.in/upload.php"
  3. if [ -t 0 ]; then
  4. if [ "$1" = "" ]; then
  5. echo "pbin <file> [name]"
  6. exit
  7. elif [ ! -s "$1" ]; then
  8. echo "$1: no such file"
  9. exit
  10. fi
  11. fi
  12. if [ ! -t 0 ]; then
  13. content=$(cat -)
  14. name="$1"
  15. else
  16. content=$(cat $1)
  17. name="$2"
  18. fi
  19. pasteId=$(curl "$url" -s --data-urlencode "name=$name" --data-urlencode "content=$content")
  20. if [ $? -eq 0 ]; then
  21. echo "http://pbin.in/$pasteId"
  22. else
  23. echo "An error occurred." 1>&2
  24. exit 1
  25. fi