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 531B

12345678910111213141516171819202122232425262728293031
  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. echo "catting -"
  14. content=$(cat -)
  15. echo "- catted"
  16. name="$1"
  17. else
  18. content=$(cat $1)
  19. name="$2"
  20. fi
  21. pasteId=$(curl "$url" -s -F "name=$name" -F "content=$content")
  22. if [ $? -eq 0 ]; then
  23. echo "Your paste should now be at http://pbin.in/$pasteId"
  24. else
  25. echo "There was an error. The file you provided may be too big."
  26. fi