Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] bash/mail: stop the send if body is blank



Hello Darren,

since you depend on the output of svn status why don't you try
something like this (untested, my bash is a bit rusty anyway).

svn_status=`svn status | egrep -iv 'path/to/ignore.me.file'`
current_date=`date '+%d.%m.%Y'`
subject="\"SubVersion Status Report ($current_date)\""
to="blah@example.com"
cc="someone@example.com someone2@example.com"

if [ $svn_status != "" ]
then
  echo $svn_status | mail -c $cc -s $subject $to
fi

This is not the shortest solution, but in Bash scripts you rather
want readability/maintainablitiy instead of cleverness anyway.

In general though, I wonder if you rather don't want svn a
post-commit hook solution which dumps to a regular log file. Then
from that you could diff and send easily by mail via cron.

Btw. I think you are probably interested in reading this [1].

Cheers,
Bjoern

[1] http://tldp.org/LDP/abs/html/


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links