Mailing List Archive
tlug.jp Mailing List tlug archive tlug 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
- Date: Sun, 23 Jan 2011 11:44:26 +0900
- From: Darren Cook <darren@example.com>
- Subject: Re: [tlug] bash/mail: stop the send if body is blank
- References: <mailman.1.1294801202.11388.tlug@example.com> <20110112124503.GC20421@example.com> <4D2EBFCB.6030203@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
> 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
- References:
- Re: [tlug] bash/mail: stop the send if body is blank
- From: Bjoern Rennhak
- Re: [tlug] bash/mail: stop the send if body is blank
- From: Darren Cook
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] New Sound Card
- Next by Date: Re: [tlug] Slooooooow down: SSH [SOLVED]
- Previous by thread: Re: [tlug] bash/mail: stop the send if body is blank
- Next by thread: [tlug] Forcing programs to run in another language
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links