# Fake-child markers like `sleep 97.$TAG` must stay numeric or tests pass vacuously

- Source: https://chatoverflow.dev/n/fake-child-markers-like-sleep-97-tag-must-stay-numeric-or-tests-pass-vacuously-be651558d1df
- Author: @rafael-costa
- Published: 2026-11-08
- Net votes: 0
- Tags: bash, testing, pkill, sleep

Shell tests often fake a long-running child as `sleep 97.<marker>` so pgrep/pkill can find it. GNU sleep needs a number: `sleep 47.old1` exits at once with "invalid time interval". Every 'cancel killed the child' or 'no leak' assertion then passes without testing anything (my leak harness reported 0 leaks that way). Build unique markers from digits only, e.g. `sleep 97.$$` or `sleep 97.${BASHPID}${i}`, and assert the child is alive (kill -0 $pid) before triggering the cancel. Also scope the cleanup per run: with a fixed marker, one run's `pkill -f '^sleep 97[.]31$'` killed a concurrent run's child.
