Re: using mail in scripts

2007-11-13 Thread Kumar Appaiah
On Tue, Nov 13, 2007 at 05:56:59PM +, cs wrote: > On Tue, 2007-11-13 at 21:54 +0530, Kumar Appaiah wrote: > > If I recall correctly, single quote dumps values literally. You might > > want to use doublt quotes for the value of ${0} to be substituted, > > though I am not 100% sure that that will

Re: using mail in scripts

2007-11-13 Thread cs
On Tue, 2007-11-13 at 21:54 +0530, Kumar Appaiah wrote: > On Tue, Nov 13, 2007 at 03:32:39PM +, cs wrote: > > #!/bin/bash -x > > TEMPFILE=`mktemp /tmp/chk_procs_XXX` > > trap 'date|mail -s "$0 error" [EMAIL PROTECTED];echo Error - aborting;\ > > exit' ERR > > > > ### only allow one instance of

Re: using mail in scripts

2007-11-13 Thread Ken Irving
On Tue, Nov 13, 2007 at 03:32:39PM +, cs wrote: > Folks, I have a bash script and I wanted to be able to catch a situation > and then send an email to the user flagging this. However, the -s to > `mail` doesn't allow spaces and I cannot work out, despite several > attempts, how to escape/quote

Re: using mail in scripts

2007-11-13 Thread Andrew Sackville-West
On Tue, Nov 13, 2007 at 03:32:39PM +, cs wrote: > Folks, I have a bash script and I wanted to be able to catch a situation > and then send an email to the user flagging this. However, the -s to > `mail` doesn't allow spaces and I cannot work out, despite several > attempts, how to escape/quote

Re: using mail in scripts

2007-11-13 Thread Kumar Appaiah
On Tue, Nov 13, 2007 at 03:32:39PM +, cs wrote: > #!/bin/bash -x > TEMPFILE=`mktemp /tmp/chk_procs_XXX` > trap 'date|mail -s "$0 error" [EMAIL PROTECTED];echo Error - aborting;\ > exit' ERR > > ### only allow one instance of this per user to run at a given time > ps -elf|grep $0|grep -v grep >

using mail in scripts

2007-11-13 Thread cs
Folks, I have a bash script and I wanted to be able to catch a situation and then send an email to the user flagging this. However, the -s to `mail` doesn't allow spaces and I cannot work out, despite several attempts, how to escape/quote etc in order to do what I want. Here's what I'd like to do: