if [[ $# != 1 ]] then echo "Usage: $0 [.tex file]" exit 1 fi PRACA=$1 if ! [[ -f $PRACA ]] then echo "No such file: $PRACA" exit 1 fi threshold=1 while true do if (($(date +"%s")- $(stat --format="%Y" $PRACA) < $threshold)) then echo "updating" pdflatex $PRACA else sleep 0.2 fi done