From: Jim <linux.tech.guy@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: zsh <zsh-users@zsh.org>
Subject: Re: strange interaction between read command and pipe to less from function
Date: Sun, 26 Mar 2023 12:04:38 -0500 [thread overview]
Message-ID: <CA+rB6G+p9e3c+_oWcihqCWNcWirQyuXFjAWozasRhaZwct6FSA@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMrR2fYk2A0wicn5Fq+LcJdsF=aQ2_t--voFyMeWOK=Vog@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]
Me again,
On Sun, Mar 26, 2023 at 10:49 AM Roman Perepelitsa <
roman.perepelitsa@gmail.com> wrote:
> On Sun, Mar 26, 2023 at 5:28 PM Jim <linux.tech.guy@gmail.com> wrote:
> >
> > cvt_256_colors_2_rgb_hex_fmt | less
>
> In this command both cvt_256_colors_2_rgb_hex_fmt and less are going
> to read and write to the same TTY. This won't do anything useful.
>
> Perhaps you don't realize that your `read` command reads and writes to
> the TTY? What do you expect from running it simultaneously with less?
>
> Roman.
>
Now I'm totally confused. A bit by your answer and the word
'simultaneously'
as I thought the function would run first then less. That set aside I dug
back
into a previous function I was working on that used the same read statement.
And yet that function when piped through less, less worked as expected. Both
functions did 'basically' the same thing with a somewhat different output.
The
one main difference was I had done a few checks before the read command
which included this:
V=$(ps -o args= $(ps -o ppid= $$))
So I added it before the read. Now 'less' responds as expected. I hope you
are not as confused as I am. Especially as the command is run before the
read and not after. Also removed the sleep command.
????
Again thanks for your help,
Jim
[-- Attachment #2: Type: text/html, Size: 1975 bytes --]
next prev parent reply other threads:[~2023-03-26 17:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 14:33 Jim
2023-03-26 14:55 ` Roman Perepelitsa
2023-03-26 15:28 ` Jim
2023-03-26 15:49 ` Roman Perepelitsa
2023-03-26 17:04 ` Jim [this message]
2023-03-26 17:23 ` Roman Perepelitsa
2023-03-26 23:50 ` Lawrence Velázquez
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=CA+rB6G+p9e3c+_oWcihqCWNcWirQyuXFjAWozasRhaZwct6FSA@mail.gmail.com \
--to=linux.tech.guy@gmail.com \
--cc=linuxtechguy@gmail.com \
--cc=roman.perepelitsa@gmail.com \
--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).