I use to create a tempfile
, delete it and recreate it as a directory:
temp=`tempfile`
rm -f $temp
# <breakpoint>
mkdir $temp
The problem is, when it runs to the <breakpoint>, there happens to be another program wants to do the same thing, which mkdir-ed a temp dir with the same name, will cause the failure of this program.