iPhone Notes Shell Script

From KevinWiki

Jump to: navigation, search


iPhone Notes Shell Script

#!/bin/bash
FILE="/tmp/iphone-note-mail.tmp"
id=`uuidgen`
 
if [ -f "$1" ]
then
  echo "File: $1"
  echo "=================== Contents ==================="
  cat "$1"
  echo "===================   ENd   ===================="
  echo "Would you like to send it? (yes/no)"
  typeset -l SEND_IT
  read SEND_IT
  if [[ "$SEND_IT" == "y" || "$SEND_IT" == "yes" ]]
    then
    SUBJECT=`head -n 1 "$1"`
    echo "From: kevin@lckymn.com" > $FILE
    echo "To: kevin+note@lckymn.com" >> $FILE
    echo "Subject: $SUBJECT" >> $FILE
    echo "X-Uniform-Type-Identifier: com.apple.mail-note" >> $FILE
    echo "X-Universally-Unique-Identifier: $id" >> $FILE
    echo "" >> $FILE
    cat "$1" >> $FILE
    echo "Sending new note...."
    sendmail "kevin+note@lckymn.com" < $FILE
    rm $FILE
    echo Done.
  else
    echo "Sending note cancelled."
  fi
  echo ""
exit
fi
 
echo "The file ($1) does not exist!" 
 
exit
Personal tools