summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2009-06-27 22:55:34 +0200
committerFlorian Pritz <f-p@gmx.at>2009-06-27 22:55:34 +0200
commitca1e0e165fa9258d1e06885e4a2438c84ed21bbe (patch)
treeb6c04f0034208aca237598522677071c5986c36a
parentbe44b6fa8f378fb494239611b98e13bb4b51f45c (diff)
downloadbin-ca1e0e165fa9258d1e06885e4a2438c84ed21bbe.tar.gz
bin-ca1e0e165fa9258d1e06885e4a2438c84ed21bbe.tar.xz
filebin.sh now uses stdin
-rwxr-xr-xfilebin.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/filebin.sh b/filebin.sh
index 6e414bf..1b428ed 100755
--- a/filebin.sh
+++ b/filebin.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#----------------------------------------------------
-# Version: 0.1.0
+# Version: 0.2.0
# Author: Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Licensed under WTFPL v2
@@ -11,6 +11,20 @@
# (only works if useragent contains libcurl)
#----------------------------------------------------
-URL=$(curl -# -L -F "userfile=@$1" http://filebin.server-speed.net/index.php/file/do_upload)
+tmpfile=0
+if [ -n "$1" ]; then
+ file=$1
+else
+ file=$(mktemp)
+ tmpfile=1
+ read -r input
+ echo $input > $file
+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