summaryrefslogtreecommitdiffstats
path: root/xup.sh
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2009-01-12 19:45:48 +0100
committerFlorian Pritz <f-p@gmx.at>2009-01-12 19:45:48 +0100
commit323816ffd1e4d78ba5ac596de5f6c36b48c31434 (patch)
tree222f32f6f394aa04ab7ed6a34539cd425b4f67d7 /xup.sh
parent2c6e3fddb3d0a3a95afd395c16f119def05e2a28 (diff)
downloadbin-323816ffd1e4d78ba5ac596de5f6c36b48c31434.tar.gz
bin-323816ffd1e4d78ba5ac596de5f6c36b48c31434.tar.xz
forgot to commit for some time... :(
Diffstat (limited to 'xup.sh')
-rwxr-xr-xxup.sh26
1 files changed, 14 insertions, 12 deletions
diff --git a/xup.sh b/xup.sh
index bacd7a2..5a271eb 100755
--- a/xup.sh
+++ b/xup.sh
@@ -1,8 +1,8 @@
#!/bin/sh
#----------------------------------------------------#
# File: xup.sh
-# Version: 0.1.1
-# Date: 2008-12-14
+# Version: 0.1.3
+# Date: 2009-01-12
# Author: Florian "Bluewind" Pritz <f-p@gmx.at>
# Upload file to XUP, copy URL to clipboard and
# save to historyfile
@@ -21,17 +21,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
XUPHIST="${HOME}/.xup_history"
-FILE=$(basename $1)
-DIR=$(dirname $1)
-cd $DIR
+FILE="$(basename "$1")"
+DIR="$(dirname "$1")"
+cd "$DIR"
URLS=$(curl -# -F "F1=@$FILE" -L "http://www.xup.in/xtrans.php" -H "Expect: ")
-DL_URL=$(echo -n ${URLS} | ack -o "\"http://www.xup.in/dl,.{8}/$FILE/\"" | sed "s#\"##g")
-DEL_URL=$(echo -n ${URLS} | ack -o "\"http://www.xup.in/kill,.{8},.{10}/\"" | sed "s#\"##g")
+DL_URL=$(echo -n ${URLS} | egrep -o "\"http://www.xup.in/dl,.{8}/$FILE/\"" | sed "s#\"##g")
+DEL_URL=$(echo -n ${URLS} | egrep -o "\"http://www.xup.in/kill,.{8},.{10}/\"" | sed "s#\"##g")
-echo $(date) >> $XUPHIST
-echo "$PWD/$FILE" >> $XUPHIST
-echo $DL_URL >> $XUPHIST
+echo $(date) >> "$XUPHIST"
+echo "$PWD/$FILE" >> "$XUPHIST"
+echo $DL_URL >> "$XUPHIST"
echo -n $DL_URL | xclip
-echo $DEL_URL >> $XUPHIST
-echo "" >> $XUPHIST
+echo -n $DL_URL
+echo $DEL_URL >> "$XUPHIST"
+echo "" >> "$XUPHIST"
+sleep 2