Looping in linux

Closed
karthik - 13 Jan 2009 à 01:24
jipicy Posts 40842 Registration date Wednesday 27 August 2003 Status Moderator Last seen 10 August 2020 - 13 Jan 2009 à 06:02
Hello,
I am seeing an issue while creating the loop in linux. The script needs to verify the file in one location. if it's present then the process should be wait, if it's not present in the location, the process can start.. Could you please let me know about this issue? My observations are given below,

I tried, this

if [ -f $FILE ]; then
sleep 100
fi
echo "process"

From my obervation, want to wait till to delete the file by my process.

Thanks
-Karthik
Related:

1 response

jipicy Posts 40842 Registration date Wednesday 27 August 2003 Status Moderator Last seen 10 August 2020 17
13 Jan 2009 à 06:02
Hi,

Try this:

while true
do
if [ -f "$FILE" ]
then
echo "$FILE is still alive"
sleep 100
continue
else break
fi
done
echo "$FILE is dead, process..."

;-))

--
$ man woman
Il n'y a pas de page de manuel pour woman.