| Prev |   1   2 |
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Off Topic (https://talk.maemo.org/forumdisplay.php?f=19)
-   -   Need advanced shell scripting help (https://talk.maemo.org/showthread.php?t=66465)

GameboyRMH 2010-12-03 14:01

Re: Need advanced shell scripting help
 
Alright so here is my script! It fetches emails from a Mailinator account.

Mailinator emails usually disappear after a while, but with this script you can run it hourly or whatever so you can make sure you get your emails.. Plus you can now use obfuscated mailinator addresses so nobody has to know the real name of the account you're checking.

This would be very handy for, say, the contact email on a Tor server ;)

Code:

#! /bin/sh

wget http://www.mailinator.com/rss.jsp?email=YOURMAILBOXNAMEGOESHERE -O /tmp/mailinator-feed #get rss feed
grep link /tmp/mailinator-feed | grep showmail | sed -e 's/<[^>][^>]*>//g' -e '/^ *$/d'| sed -e 's:&amp;:\&:g' > /tmp/mailinator-links #pick out email links and replace ampersand html entity
cd /home/user/mailinator-emails/ #mail goes here
#download emails
for url in $(cut -f 1 /tmp/mailinator-links); do
    url=`echo -n "${url}" | tr -d '\r'`
    wget -nc "${url}"
done
#clean up temp files
rm /tmp/mailinator-feed
rm /tmp/mailinator-links

Your mails will build up with messy filenames, but the point is you can read them at your leisure.

Thanks for the help everyone!

lma 2010-12-03 15:39

Re: Need advanced shell scripting help
 
Aha, I didn't know about mailinator. Looks useful, thanks!

There's something about unnecessary forks, temp files and long pipelines that bugs me, so here's a shorter version :-)
Code:

#!/bin/sh
cd /home/user/mailinator-emails && \
wget -qO - http://www.mailinator.com/rss.jsp?email=YOURMAILBOXNAMEGOESHERE | \
sed -ne 's/&amp;/\&/g' -e 's/^.*\(http:.*showmail.jsp.*\)<.*$/\1/p' | \
wget -nc -qi -


GameboyRMH 2010-12-03 15:42

Re: Need advanced shell scripting help
 
Quote:

Originally Posted by lma (Post 888469)
Aha, I didn't know about mailinator. Looks useful, thanks!

There's something about unnecessary forks, temp files and long pipelines that bugs me, so here's a shorter version :-)
Code:

#!/bin/sh
cd /home/user/mailinator-emails && \
wget -qO - http://www.mailinator.com/rss.jsp?email=YOURMAILBOXNAMEGOESHERE | \
sed -ne 's/&amp;/\&/g' -e 's/^.*\(http:.*showmail.jsp.*\)<.*$/\1/p' | \
wget -nc -qi -


Wow, does that really replicate all the functionality!? :eek:

Edit: Well I sat down and looked through it for a while and I finally understand how you did that...mostly :)


| Prev |   1   2 |
All times are GMT. The time now is 20:23.

vBulletin® Version 3.8.8