Author Topic: How to write a quick infinite loop in Powershell and Bash on one line  (Read 1475 times)

0 Members and 1 Guest are viewing this topic.

Offline Weird Tolkienish Figure

  • Technical
  • *****
  • Posts: 18,171
In powershell:


while (1) { write-host "hello world"; start-sleep 1}


In Bash:


$ while true; do echo "hello world"; sleep 1; done


Not terribly useful as is, but you can plug any command into those loops and have them perform the action again and again. Useful if you want to check DNS record propagation and you're tired of doing it manually.