From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Han Boetes <hboetes@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: zsh watch function
Date: Sat, 16 May 2020 20:59:26 +0000 [thread overview]
Message-ID: <20200516205926.45d04fc5@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAOzo9e4phyeSNmPAY_hk3YChrivB_7y76b_PS+CXaMyATO2f-w@mail.gmail.com>
Han Boetes wrote on Sat, 16 May 2020 16:31 +0200:
> And then I saw the padding light, here an improved version:
>
> watch () {
> IN=2
The code isn't WARN_CREATE_GLOBAL-clean.
> CM="$*"
> LEFT="$(printf 'Every %.1f: %s' $IN $CM)"
⋮
> printf "$LEFT%${PAD}s\n" "$HN $(date)"
$LEFT may contain unescaped percent signs from the input.
> eval "$CM"
> sleep $IN
> clear
> done
> }
For context to others, note that watch(1) on FreeBSD does something
entirely different to what watch(1) does on Linux.
next prev parent reply other threads:[~2020-05-16 21:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-16 12:20 Han Boetes
2020-05-16 14:31 ` Han Boetes
2020-05-16 20:59 ` Daniel Shahaf [this message]
2020-05-16 23:10 ` Han Boetes
2020-05-16 14:36 ` Roman Perepelitsa
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=20200516205926.45d04fc5@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=hboetes@gmail.com \
--cc=zsh-workers@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).