Advertisement
davidfindley19

Error Code Email

Aug 28th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #This is script is meant to be an add on to another one I'm using. Based on the return code output it will mail me the #message.
  4.  
  5. read -p "What is the file name? " variable
  6. rc = $?
  7.  
  8. ls -al $variable
  9. if [[ $rc != 0 ]]; then
  10.     mail -s "$variable script did not complete" email address -- -f email address \
  11.     << EOF Your script has failed with error code $rc << EOF;
  12. elif [[ $rc = 0 ]]; then
  13.     mail -s "Your script completed" email address -- -f email address \
  14.     << EOF Your script completed with error code $rc. << EOF;
  15. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement