Advertisement
due204

andres_elenano

Feb 2nd, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.31 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. CORREO="Tu_correo"
  4. PASS="Tu_pass"
  5.  
  6. DATOS=$( curl -u "$CORREO":"$PASS" --silent "https://mail.google.com/mail/feed/atom" )
  7.  
  8. CANTIDAD=$( echo $DATOS |  grep -oPm1 "(?<=<email>)[^<]+" | wc -l )
  9.  
  10. items=( )
  11. for i in `seq 1 $CANTIDAD`
  12. do
  13.     NOMBRE=$(   echo $DATOS |  grep -oPm1 "(?<=<name>)[^<]+" | head -$i | tail -1 )
  14.     AUTOR=$(    echo $DATOS |  grep -oPm1 "(?<=<email>)[^<]+" | head -$i | tail -1 )
  15.     ASUNTO=$(   echo $DATOS |  grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | head -$i | tail -1 )
  16.     RESUMEN=$(  echo $DATOS |  grep -oPm1 "(?<=<summary>)[^<]+" | head -$i | tail -1 )
  17.     ID=$(       echo $DATOS |  grep -oP "(?<=message_id=)[^&]+" | head -$i | tail -1 )
  18.     FECHA=$(    echo $DATOS |  grep -oPm1 "(?<=<issued>)[^T]+" | awk -F '-' '{print $3"-"$2"-"$1}' | head -$i | tail -1 )
  19.     HORA=$(     echo $DATOS |  grep -oPm1 "(?<=<issued>)[^Z]+" | awk -F 'T' '{print $2}' | head -$i | tail -1 )
  20.  
  21.  
  22.  
  23. items+=( "$NOMBRE" "$AUTOR" "$ASUNTO" "$RESUMEN" "$ID" "$FECHA" "$HORA" )
  24. done
  25.  
  26. yad --text="\n\tUsted tiene <b>$CANTIDAD</b> correos nuevos.\n" \
  27.     --no-buttons --list \
  28.     --width="1200" --height="520" --title="Correos nuevos: "$CANTIDAD"" \
  29.     --column="Nombre" --column="Autor" \
  30.     --column="Asunto" --column="Resumen" \
  31.     --column="ID" --column="Fecha" \
  32.     --column="Hora" "${items[@]}"
  33. # Final del camino...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement