-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 19/10/2006, at 12:09 PM, Penedo wrote:

On 19/10/06, Matthew Hannigan <[EMAIL PROTECTED]> wrote:
...
>     egrep .....  >>  $TMP

This is sorta off topic, but setting umask is not enough.
Someone else could have a file of the same name as $TMP
Indeed, or a symbolic link under the same name, or a pipe, or ....

Normally I do a sanity check first:

if [ -e $TMP ]; then
    rm -f $TMP
else
    touch $TMP
fi

Or something similar.

What I tend to do is make a directory and put files in
there.  You're guaranteed that mkdir will return error
if it exists already.

True - good idea :)

And/or just use the shell's pid in the temporary file name, e.g.
TMP=/tmp/mail-address.tmp.$$

There is also mktemp(1) for this, so maybe:
TMP=`mktemp /tmp/mail-addresses.XXXXXXXXXX`

Never used mktemp... I'll have to have a look at it.

Cheers,

James
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFNvu5wBHpdJO7b9ERAl7AAJoColJVNjxpOBHcsMjsB6P2yXCTPACfe/KX
zX+rVSU74z0oBoDTJ+NZBu0=
=NqeI
-----END PGP SIGNATURE-----
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to