I have video file "test.mp4" which I am downloading using wget. It's more than 100MB+. I want to keep checking the file size and execute certain commands on it after it increments every +2MB or some custom limits. Presently I am trying with nested ifs and while loops:
while true;
do
if [[ $(find /home/user/test.mp4 -type f -size +200k 2>/dev/null);
then
##### executre some commands
while true;
do
if [[ $(find /home/user/test.mp4 -type f -size +2000k 2>/dev/null) ]];
then
##### executre some commands
while true;
do
if [[ $(find /home/user/test.mp4 -type f -size +4000k 2>/dev/null) ]];
then
##### executre some commands
while true;
do
if [[ $(find /home/user/test.mp4 -type f -size +6000k 2>/dev/null) ]];
then
##### executre some commands
##### I have to write while loops like this for ever -----------
break;
fi
done;
break;
fi
done;
break;
fi
done;
break;
fi
done;
But I have to manually do. Is there a way it keeps checking and I can tell some limit and after that it can execute a command?