
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
> 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.
Just for the archives, the script needed some more work as Bash really
hates line-breaks; if you don't want it to turn them into spaces you
need to surround it with double quotes, both when creating a variable
and when using it.
svn_status=`svn status | egrep -iv 'path/to/ignore.me.file'`
needs to become:
svn_status="$(svn status | egrep -iv 'path/to/ignore.me.file')"
And
echo $svn_status | mail -c $cc -s $subject $to
needs to become:
echo "$svn_status" | mail -c $cc -s $subject $to
I've put the updated script below.
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 [ -n "$svn_status" ]
then
echo "$svn_status" | mail -c $cc -s $subject $to
fi
Home |
Main Index |
Thread Index