dosya_yukle 505 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. #
  3. transfer() {
  4. if [ $# -eq 0 ]; then
  5. echo -e "dosya belirtin: dosya_yukle dosyaABC ";
  6. return 1;
  7. fi
  8. tmpfile=$( mktemp -t transferXXX );
  9. if tty -s; then
  10. basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
  11. curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
  12. else
  13. curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
  14. fi;
  15. echo -e "\n" >> $tmpfile;
  16. cat $tmpfile ;
  17. rm -f $tmpfile;
  18. }
  19. transfer $1