
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
> This is not the shortest solution, but in Bash scripts you rather
> want readability/maintainability instead of cleverness anyway.
Thanks Bjoern. Good point, and as it was already a script (rather than a
one-liner) I've broken it up a bit as you suggest. I just made one fix,
as noted below. Without the double quotes it treated the svn output as
multiple parameters, not a single string.
> 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.
Not in this case; the point of this script is to tell me when users who
are not svn-aware have changed the web site. (I already use post-commit
to tell me what the svn users are changing :-)
Darren
> 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 != "" ]
if [ "$svn_status" != "" ]
or:
if [ -n "$svn_status" ]
> then
> echo $svn_status | mail -c $cc -s $subject $to
> fi
--
Darren Cook, Software Researcher/Developer
http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)
Home |
Main Index |
Thread Index