Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: infinite loop that is possible to quit
- X-seq: zsh-users 26206
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: infinite loop that is possible to quit
- Date: Tue, 1 Dec 2020 17:17:32 +0000
- Archived-at: <https://zsh.org/users/26206>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-12/20201201171732.GD24476%40tarpaulin.shahaf.local2>
- Authentication-results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; s=fm2; bh=Xo3HAErmfrNrAu 4h61B8qjCOQ5Fh+jixpgejyb8ZhdY=; b=d9lzRsXm3nv4I22kftGfH47mnda5Sv 7HUYtyBFBLm19sXrHWhd5lxtqjRZJxBEZjv0JyWlKIjFi5T6VOBqJLXLl4zf1s+0 bO42nUaBATzfepPo4HzTObSdsaq2GRPprmV4Jwa/PUCSWx5PpcvtdUA0RBqK0B8i dHdo7qXwcQNk23H/LxX964qlTSdmPWMG9WNJfsDTa76KuAEXtmJ0o5W4/T9MJY4+ PDi3OoE7P62pTFOmpeSFyTssYHH93RqUFRS1FvjTwIQ65hzRnkotCkL/yr5pRNgP ksSHhyUxnijJbWqX59/IeG3XIz75wA2GsoixsFV0wm11JUVw4yICuSug==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Xo3HAE rmfrNrAu4h61B8qjCOQ5Fh+jixpgejyb8ZhdY=; b=XaYS+ua7O3iJj71v8WMWJZ +WwQ1h5a455kwzMjfPRXg+LdnclHvIFramv/fpP0PHDRnDxJA92DharZXKlJU8H2 SG3Mvs54gkIt/spCGPke5bufrJCbdtmIxDm+6u5+pGs5f3n2erwZogZjlezOYCya CaPCpCsnwZ5phc4ixfZGGhmcZE11mgY0PODOYm1p4wNUQruAx0yJkxwcbMXuJkFu 0Jba7Wt8Pd0e1WluMT65fxQYtFePzMhz74z7JrNwkWNKIk7OBcXcHykQSAQRgjDJ 7dMhdawxbkkdOSQcDMMlhIvx8rhhXGpHHUzfgB/pM7d9+Mg03LaPHWKTRzdq7aEQ ==
- In-reply-to: <875z5m9twt.fsf@zoho.eu>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:zsh-users-request@zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-users>
- References: <875z5m9twt.fsf@zoho.eu>
- Sender: zsh-users-request@xxxxxxx
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).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author