- while ! mkdir "${meta}.lock"; do
- sleep 1
- ps -o pid \
- | grep -q "$(cat "${meta}.lock/pid")" \
- || break
- done
- printf '%i\n' >"${meta}.lock/pid"
-
- grep -vF " $fn" "$meta" >"${meta}.lock/mtmp"
- read length width height tags comment x <<-EOF
- $(grep -F " $fn" "$meta")
+ if LOCK "$meta"; then
+ grep -vF " $fn" "$meta" >"${meta}.tmp"
+ read length width height tags comment x <<-EOF
+ $(grep -F " $fn" "$meta")