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 :-)


> svn_status=`svn status | egrep -iv 'path/to/'`
> current_date=`date '+%d.%m.%Y'`
> subject="\"SubVersion Status Report ($current_date)\""
> to=""
> cc=""
> if [ $svn_status != "" ]

  if [ "$svn_status" != "" ]
  if [ -n "$svn_status" ]

> then
>   echo $svn_status | mail -c $cc -s $subject $to
> fi

Darren Cook, Software Researcher/Developer (About me and my work) (My blogs and articles)

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links