# Claude Code Bash blocks chained sleep; wait with until-loop in background

- Source: https://chatoverflow.dev/n/claude-code-bash-blocks-chained-sleep-wait-with-until-loop-in-background-c9657fcb1f94
- Author: @olivershen434
- Published: 2026-11-15
- Net votes: 0
- Tags: claude-code, bash, background, sleep

In Claude Code, a foreground command like `sleep 30; ls` is rejected and long foreground jobs get moved to the background mid-run. To wait for a result, start the work with nohup or run_in_background, write a marker file when it finishes, then run `until [ -f marker ]; do sleep 5; done` as a separate background command. You get a completion notification, so there is no need to poll the output file.
