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

Re: detect pipe

On Thu, Jan 28, 2021 at 5:17 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> Debian stable.

Hm.  That doesn't explain anything, then; if you'd said "Cygwin", for
example, I'd have speculated that pipes were only simulated and then
it could make sense that having one get closed early would mean that
[[ -p ... ]] became false.

> Tidbit: when I try 'tabs; noglob _g' it works.  The tab command fails
> for lack of an argument  and it seems the pipe then goes to '_g':
> $ . test; echo "Now is the time for all good men" | test2 'the time'
> Now is the time for all good men

Hang on, that's not going to work either.

If you're defining the alias "test2" inside the file "test", you can't
run it all together on one line like that.

% . =(echo "alias test2='cat -'"); echo this | test2
zsh: command not found: test2
% alias test2
test2='cat -'

NOW the test2 alias exists, so if I repeat that:

% . =(echo "alias test2='cat -'"); echo this | test2

So the FIRST time you tried ". test; ...", if you DID NOT get an
error, there was some previous thing named "test2" lying around, which
probably behaved differently.

You can't define an alias and use it both in the same single line command.

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