summaryrefslogtreecommitdiffstats
path: root/postit.sh
diff options
context:
space:
mode:
authorRaghavendra D Prabhu <raghu.prabhu13@gmail.com>2011-03-13 00:24:47 +0530
committerRaghavendra D Prabhu <raghu.prabhu13@gmail.com>2011-03-13 00:24:47 +0530
commit5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a (patch)
treedeabb15393558ab3a1a629fc0782d8b0c3124c48 /postit.sh
downloadScripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.gz
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.bz2
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.zip
Initial scripts update
Diffstat (limited to 'postit.sh')
-rwxr-xr-xpostit.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/postit.sh b/postit.sh
new file mode 100755
index 0000000..0becca9
--- /dev/null
+++ b/postit.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+filename="$1"
+sed 's/ /!/g' $filename > ${filename}".curl"
+api="https://api.del.icio.us/v1/posts/add"
+cred="rdprabhu13:13thwarrior"
+
+[ -f ~/bin/posts.sh ] && rm -f ~/bin/posts.sh
+
+for line in `cat $filename".curl"`
+do
+ IFS=";"
+ data=""
+ for j in $line
+ do
+ data=${data}" --data-urlencode `echo $j | tr '!' ' '`"
+ done
+ echo "curl -s -o tempfile --user $cred $data $api" >> ~/bin/posts.sh
+ echo "if ! grep -q done tempfile;then exit 1;fi" >> ~/bin/posts.sh
+ IFS=" "
+done
+echo "exit 0" >> ~/bin/posts.sh
+chmod +x ~/bin/posts.sh
+~/bin/posts.sh && [ -f ~/bin/$filename ] && rm -f ~/bin/$filename # Indicating consumption
+