Hacker News new | ask | show | jobs
by chasil 805 days ago
Instead of saying:

  while true
You can instead say:

  while :
There is actually a /bin/true, which could involve the fork of a new process for each iteration of the loop. The form that I have shown you is guaranteed not to fork.
1 comments

Thank you sir!
You might find it interesting to know exactly what is (and is not) in the POSIX shell. The description of the colon : operator is there.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...

Most of the familiar userland utilities are at that website, accessible as a (somewhat crude) Apache index:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/

Any POSIX-compliant system is required to implement the functionality described there.