SHARE
TWEET

Untitled

a guest Aug 12th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # edited by ItsMe
  4. # changes:
  5. #   - third url     ~> main url of imgur is returned, too
  6. #   - colors    ~> based on bash color codes
  7. #   - process bar   ~> default with progress
  8. #           ~> if 2. argument is "np" - no progress
  9. #
  10.  
  11. # imgur script by Bart Nagel <bart@tremby.net>
  12. # version 2
  13. # I release this as public domain. Do with it what you will.
  14.  
  15. # Required: curl
  16. #
  17. # Optional: xsel or xclip for automatically putting the URL on the X selection
  18. # for easy pasting
  19. #
  20. # Instructions:
  21. # Put it somewhere in your path and maybe rename it:
  22. #   mv ~/Downloads/imgur.sh ~/bin/imgur
  23. # Make it executable:
  24. #   chmod  x ~/bin/imgur
  25. # Stick your API key in the top:
  26. #   vim ~/bin/imgur
  27. # Upload an image:
  28. #   imgur images/hilarious/manfallingover.jpg
  29. # The URL will be displayed (and the delete page's URL will be displayed on
  30. # stderr). If you have xsel or xclip the URL will also be put on the X
  31. # selection, which you can usually paste with a middle click.
  32.  
  33. # API Key provided by Alan@imgur.com
  34. #apikey="b3625162d3418ac51a9ee805b1840452"
  35. apikey="5a86dc503660d0675d2ce33f9003c2b5"
  36.  
  37. # function to output usage instructions
  38. function usage {
  39.     echo "Usage: $(basename $0) <filename> <np>
  40. Upload an image to imgur and output its new URL to stdout.
  41. If np (no process) is set, output has no process bar.
  42. Its main page is output to stderr.
  43. Its delete page is output to stderr.
  44. If xsel or xclip is available, the URL is put on the X selection for easy pasting." >
RAW Paste Data
Top