Skip to content

Instantly share code, notes, and snippets.

@willtonkin
Created April 30, 2013 09:26
Show Gist options
  • Save willtonkin/5487619 to your computer and use it in GitHub Desktop.
Save willtonkin/5487619 to your computer and use it in GitHub Desktop.
E-mail file, copy it with the current date appended to the filename and empty the file contents.
#!/bin/bash
FILE=targetfile.txt
echo "Email body text goes here" | mutt -a "$FILE" -s "Email subject goes here" -- willtonkin1@gmail.com
TIMESTAMP=`date +%Y%m%d`
NEW_FILE=$FILE.$TIMESTAMP
cp $FILE $NEW_FILE
/dev/null > $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment