[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Why would someone do this?
- Subject: [ale] Why would someone do this?
- From: denniruz at gmail.com (Dennis Ruzeski)
- Date: Tue, 16 Mar 2010 12:24:37 -0400
Yet another shell script question-
I inherited a load of scripts and I'm going through trying to document
them and I ran across this snippet everywhere a directory or file is
created:
dir=`eval date +%F`
loop="0"
while [ $loop -lt 50 ]
do
if [ -e "/$dir" ]
then
loop="100"
else
mkdir "/$dir"
loop=$((loop+1))
fi
done
I understand building some robustness into scripts but I've never seen
a mkdir fail in a situation like this. Is this paranoia, best
practice, or somewhere in between?