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.

sprunge 414B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. #
  3. # pbrisbin 2013 - paste stdin or the argument given to sprunge.us.
  4. #
  5. ###
  6. content=/dev/stdin
  7. if [[ -f "$1" ]]; then
  8. content="$1"; shift
  9. fi
  10. ext="$1"
  11. if [[ -z "$ext" ]] && [[ "$content" == *.* ]]; then
  12. ext="${content##*.}"
  13. fi
  14. read -r link < <(curl -# -F 'sprunge=<-' http://sprunge.us < "$content")
  15. link="$link?$ext"
  16. [[ -n "$DISPLAY" ]] && printf "$link" | xclip
  17. printf "%s\n" "$link"