IPhone Notes Shell Script: Difference between revisions
From KevinWiki
Jump to navigationJump to search
Created page with "Category:iPhone {{lowercase}} = iPhone Notes Shell Script = <source lang="bash"> #!/bin/bash FILE="/tmp/iphone-note-mail.tmp" id=`uuidgen` if [ -f "$1" ] then echo "File: ..." |
No edit summary |
||
| Line 3: | Line 3: | ||
= iPhone Notes Shell Script = | = iPhone Notes Shell Script = | ||
<source lang="bash"> | <source lang="bash"> | ||
#!/bin/bash | #!/bin/bash | ||
FILE="/tmp/iphone-note-mail.tmp" | FILE="/tmp/iphone-note-mail.tmp" | ||
| Line 13: | Line 14: | ||
cat "$1" | cat "$1" | ||
echo "=================== ENd ====================" | echo "=================== ENd ====================" | ||
echo "Would you like to send it? ( | echo "Would you like to send it? (yes/no)" | ||
typeset -l SEND_IT | |||
read SEND_IT | read SEND_IT | ||
if [[ "$SEND_IT" == "y" || "$SEND_IT" == " | if [[ "$SEND_IT" == "y" || "$SEND_IT" == "yes" ]] | ||
then | then | ||
SUBJECT=`head -n 1 "$1"` | SUBJECT=`head -n 1 "$1"` | ||
echo "From: | echo "From: kevin@lckymn.com" > $FILE | ||
echo "To: | echo "To: kevin+note@lckymn.com" >> $FILE | ||
echo "Subject: $SUBJECT" >> $FILE | echo "Subject: $SUBJECT" >> $FILE | ||
echo "X-Uniform-Type-Identifier: com.apple.mail-note" >> $FILE | echo "X-Uniform-Type-Identifier: com.apple.mail-note" >> $FILE | ||
| Line 26: | Line 28: | ||
cat "$1" >> $FILE | cat "$1" >> $FILE | ||
echo "Sending new note...." | echo "Sending new note...." | ||
sendmail " | sendmail "kevin+note@lckymn.com" < $FILE | ||
rm $FILE | rm $FILE | ||
echo Done. | echo Done. | ||
| Line 39: | Line 41: | ||
exit | exit | ||
</source> | </source> | ||
Latest revision as of 00:33, 8 September 2012
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