Skip to content

Instantly share code, notes, and snippets.

@penghou620
Created October 30, 2013 07:58
Show Gist options
  • Save penghou620/7228720 to your computer and use it in GitHub Desktop.
Save penghou620/7228720 to your computer and use it in GitHub Desktop.
1 #!/bin/bash
2 ip=$(ifconfig eth0 | grep inet | awk '{print $2}' | cut -d':' -f2)
3 echo "To: dustsnow@126.com\nFrom: dustsnow@gmail.com\nSubject: IP Address\n" > msg.txt
4 echo ${ip} >> msg.txt
5
6 ssmtp dustsnow@126.com < msg.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment