Article 50FYD shell script to check availability of a file for 1 hour , after one hour if file not there , it will echo "Time Out"

shell script to check availability of a file for 1 hour , after one hour if file not there , it will echo "Time Out"

by
subir
from LinuxQuestions.org on (#50FYD)
i wrote this code. but the problem is after every 300s it prints "Time over", when $fname present is got out from the loop. I want "time over" after 1hr if file not arrived, but after 300s it starts to print "time over"

#!/bin/bash
echo "enter file name"
read fname
START=`date +%s`
while [ $(( $(date +%s) - 3600 )) -lt $START ]; do
if [ -e $fname ]
then
echo "$fname present"
break
sleep 300
else
echo "Time Over"
fi
donelatest?d=yIl2AUoC8zA latest?i=KZ8FR-W3dBE:fbIvUEgHb7M:F7zBnMy latest?i=KZ8FR-W3dBE:fbIvUEgHb7M:V_sGLiP latest?d=qj6IDK7rITs latest?i=KZ8FR-W3dBE:fbIvUEgHb7M:gIN9vFwKZ8FR-W3dBE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments