Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: detect pipe



On Thu, Jan 28, 2021 at 7:45 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2021-01-28 7:05 a.m., Ray Andrews wrote:
>
> Delays of some sort are part of this almost for sure.
> Something changes in the OS I think.

Speaking of that, what OS are you using?

> #alias g='tabs -4; noglob _g'

That is guaranteed NOT to work.  With that alias in place, your pipe
is feeding into the "tabs" command, and then the _g function is run
with the regular shell standard input in place.  Aliases are
command-text-level replacements, so  given the above,

% echo something | g other

is the same as

% echo something | tabs -4; _g other

which (in case not already obvious) is just like

% echo something | tabs -4
% _g other

The only way that would ever report stdin as a pipe would be if it
appeared in a compound command context, something like one of

% echo something | { g other }
% echo something | ( g other }
% echo something | if g other; then ... fi
etc.




Messages sorted by: Reverse Date, Date, Thread, Author