i am trying to write a script to delete those files who's last modification falls into a time interval... my script is..
echo "enter time interval(HH:MM - HH:MM):"
read t1
t1=$( echo "$t1" | awk -F: '{ print ($1 * 3600) + ($2 * 60)}')
read t2
t2=$( echo "$t2" | awk -F: '{ print ($1 * 3600) + ($2 * 60)}')
ls -l |awk '{ print $8" "$9 }' > r
while read line
do
t=$(echo $line | awk '{print $1}' | awk -F: '{ print ($1 * 3600) + ($2 * 60)}')
f=$(echo $line | awk '{print $2}')
if [ $t -ge $t1 ]
then
if [ $t -le $t2 ]
then
count=0
while read line1
do
if [ $count -le 10 ]
then
echo "$line1"
count=`expr $count + 1`
fi
done < $f
echo "do you want to delete this file "
read yn
case $yn in
'Yes' ) rm "$f";;
'No' ) exit;;
esac
fi
fi
done <r
but read command (after "echo "do you want to delete this file "" ) is not working..... please help..