[Toolserver-l] Job scheduling and mail receiving
River Tarnell
r.tarnell at IEEE.ORG
Wed Feb 9 20:41:27 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In article <4D529B28.7030703 at vyznev.net>,
Ilmari Karonen <nospam at vyznev.net> wrote:
> On 02/09/2011 03:22 AM, River Tarnell wrote:
> > Or, if you only wanted to receive output on failure:
> >
> > #! /bin/ksh
> > f=$(mktemp)
> > trap "rm -f $f" 0
> > /path/to/mytool>$f 2>&1 ||<$f mailx -s "Tool output" $LOGNAME
> Just out of curiosity... is there a particular reason for the -f switch
> to rm here, or are you just trying to be extra sure the tempfile gets
> deleted?
Because:
* Without -f, rm behaves differently depending on whether the script is
run from an interactive terminal or not, so I always use -f to get
consistent behaviour; and
* It doesn't matter if the file was already deleted, so I don't want an
error message if rm fails.
- river.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (NetBSD)
iEYEARECAAYFAk1S++cACgkQIXd7fCuc5vLkOwCfUbDGfLxRJioXM2mVfX3dCqka
pXsAn29jjiirj4GmFAWQ5+PaIA92jrG5
=Ufaq
-----END PGP SIGNATURE-----
More information about the Toolserver-l
mailing list