Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Bash while-loop

  • while
while true; do (date; sleep 1); done
#!/usr/bin/env bash

while [[ -f /tmp/run ]]
do
  echo "Running"
  sleep 2
done

echo done