summaryrefslogtreecommitdiffstats
path: root/filebin.sh
blob: 7376997835a62265d90dbf01388d8b48ea015f0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#----------------------------------------------------
# Version:      0.2.2
# Author:       Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Licensed under WTFPL v2
#   (see COPYING for full license text)
#
#----------------------------------------------------
# Upload file to my filebin and copy URL to clipboard
# or nopaste stdin
# (only works if useragent contains libcurl)
#----------------------------------------------------

tmpfile=0
if [ -n "$1" ]; then
  file=$1
else
  file=$(mktemp)
  tmpfile=1
  while read -r input; do
    echo "$input" >> $file
  done
fi

URL=$(curl -# -L -F "userfile=@$file" http://filebin.server-speed.net/index.php/file/do_upload)
echo $URL
echo $URL | nohup &> /dev/null xclip

if [ "$tmpfile" == "1" ]; then
  rm $file
fi