diff options
Diffstat (limited to 'update-all.in')
-rw-r--r-- | update-all.in | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/update-all.in b/update-all.in index 352fd9f..bb87ece 100644 --- a/update-all.in +++ b/update-all.in @@ -57,8 +57,28 @@ if [ -z "${DISPLAY}" ]; then ) fi -while kill -0 "${pids[@]}"; do - sleep 1 +while [ -n "${pids[*]}" ]; do + if [ -z "${DISPLAY}" ]; then + for pid in "${pids[@]}"; do + if ! kill -0 "${pid}" >/dev/null 2>&1; then + continue + fi + npids+=("${pid}") + screen -r "${pid}" + done + pids=("${npids[@]}") + else + sleep 1 + fi + pids=( + $( + for pid in "${pids[@]}"; do + if kill -0 "${pid}" >/dev/null 2>&1; then + printf '%s\n' "${pid}" + fi + done + ) + ) done ls "${tmp_dir}" \ |