milis/bin/dosya_yukle

21 lines
505 B
Plaintext
Raw Normal View History

2017-04-14 21:02:09 +02:00
#!/usr/bin/env bash
#
2017-07-03 01:44:35 +02:00
transfer() {
if [ $# -eq 0 ]; then
echo -e "dosya belirtin: dosya_yukle dosyaABC ";
return 1;
fi
tmpfile=$( mktemp -t transferXXX );
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
fi;
echo -e "\n" >> $tmpfile;
cat $tmpfile ;
rm -f $tmpfile;
}
transfer $1