From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-users@zsh.org
Subject: Re: infinite loop that is possible to quit
Date: Tue, 1 Dec 2020 17:17:32 +0000 [thread overview]
Message-ID: <20201201171732.GD24476@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <875z5m9twt.fsf@zoho.eu>
Emanuel Berg wrote on Tue, Dec 01, 2020 at 02:50:10 +0100:
> How do I do an infinite loop that runs something, but it will
> still be possible to quit the whole thing?
>
> The best thing I've come up with is
>
> while true; do
> # run program
> sleep 1
> done
>
> Then do, say, q to exit the program, and C-c during the sleep
> period to quit the loop!
>
> Is this good or bad?
I'd spell it like this:
while run program && sleep 1; do done
Or use the Linux version of watch(1) (not to be confused with the FreeBSD tool
of the same name).
prev parent reply other threads:[~2020-12-01 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 1:50 Emanuel Berg
2020-12-01 7:36 ` Alex Satrapa
2020-12-01 9:53 ` Lewis Butler
2020-12-01 17:17 ` Daniel Shahaf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201201171732.GD24476@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).