Timeouting eine while-Schleife in Linux-shell-Skript

Diese funktioniert (Endlosschleife):

$ while TRUE; do printf ".";done

.............................................................................

Ich versuche timeout diese while loop mit der timeout Befehl.
All diese arbeiten nicht:

$ timeout 5 while TRUE; do printf ".";done
$ timeout 5 "while TRUE; do printf ".";done"
$ timeout 5 "while TRUE; do printf \".\";done"
$ timeout 5 $(while TRUE; do printf ".";done)
$ timeout 5 $('while TRUE; do printf ".";done')

Was ist der richtige Weg (wenn es existiert)?

Schreibe einen Kommentar