Looping in linux

[Closed]
Report
-
Posts
40805
Registration date
Wednesday August 27, 2003
Status
Moderator
Last seen
August 10, 2020
-
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

1 reply

Posts
40805
Registration date
Wednesday August 27, 2003
Status
Moderator
Last seen
August 10, 2020
17
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.