help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wait until the file is done


From: MN
Subject: Re: wait until the file is done
Date: Sat, 31 Oct 2020 17:13:19 +0100

I thought I would make the function typo-proof.
Is this how it should be done?

waitfor() { 
oldsize=0
if [[ -e "$1" ]]; then         #new lines
    while sleep 30; do
    size=$(wc -c < "$1")
    if ((size > oldsize)); then
        oldsize=$size
        SECONDS=0
        continue
    fi
    if ((SECONDS > 600)); then
        break
    fi
    done
else                           #new lines
    echo 'No such file'        #new lines
fi
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]