Hacking Linux Exposed

About
Authors
Contents
Reviews
Foreword
Purchase

Articles
Books
Sourcecode
Tools
Errata

Home

 


(view this code in a separate window)

#!/bin/sh -
#
# An example of how *NOT* to use temporary files
#

TMPFILE=/tmp/foo.$$
if test -x $TMPFILE; then
            echo "temporary file already exists, possible attack"
            exit 255
fi
 
# Create our temporary file
date > $TMPFILE

     ( actual script goes here )

rm $TMPFILE