Hi I'm trying to add bookmarklets to firefox from the command line. I'm editing bookmarks.html to insert the proper bookmarks but it doesn't seem to give me the proper result (the file is edited but the bookmarklets don't appear). Can you help?
cd ~/.mozilla/firefox/*.default
lineNum=`grep -n -A10 PERSONAL_TOOLBAR_FOLDER bookmarks.html | grep -A5 "Latest Headlines" | grep "</DL><p>" | sed 's/-.*//g'`
#add following text to end of section
cat > addBookmarklet.txt << EOF
<DL><p>
<DT><A HREF="javascript:(function(){f='http://delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv5','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()" ADD_DATE="1277224402" LAST_MODIFIED="1277224402">Bookmark on Delicious</A>
<\DL><p>
<DL><p>
<DT><A HREF="javascript:void(location.href=%22http://proxy.lib.sfu.ca/login?url=%22+location.href)" ADD_DATE="1277227680" LAST_MODIFIED="1277227680">SFU library Off Campus Access Bookmarklet</A>
<\DL><p>
EOF
mv bookmarks.html bookmarks.html.bk
awk 'NR<='$lineNum' {print}' bookmarks.html.bk > bookmarks.html
awk '{print}' addBookmarklet.txt >> bookmarks.html
awk 'NR>$lineNum {print}' bookmarks.html.bk >> bookmarks.html
I'm looking at this link for possible insights: http://stackoverflow.com/questions/2034373/python-cli-to-edit-firefox-bookmarks