The CLI has a massive blind spot in today’s operating systems: it knows nothing useful about events.
Yet events are the primary way anything happens on a computer, whether it’s a user system or a server.
replies(6):
<https://en.wikipedia.org/wiki/Expect>
Much of modern operating systems is events-based and relies on polling for specific actions, devices connecting / disconnecting, etc. Linux device management is based on this, for example. There are numerous scripts which fire as a service is enabled or disabled (networking "ifup" and "ifdown" scripts, for example), or services are started / stopped. Systemd extends these capabilities markedly.
And of course there's a whole slew of conditional processing, beginning with init scripts, [], test, &&, ||, and specific conditional logic within shells, scripting, and programming languages.