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

Re: detect pipe

On 2021-01-28 2:28 a.m., Vincent Lefevre wrote:

         if [[ -p /dev/fd/0 ]]; then
The semicolon after ]] is invalid. I get an error

zsh: parse error near `then'
No error here.  How can that be?  Virgin shell also reports no error.  This is with Roman's prebuilt core.  Besides, I thought the sem was compulsory, no?
Actually the issue is nbsp characters in the posted code!
?? Mind ... it was copied and pasted from an editor so yeah, an nbsp could be in there.  Rather rude!
   echo "Now is the time for all good men" | noglob test1 'the time'

I was wondering whether the noglob could introduce a small timing
difference where the LHS command would terminate earlier.

I fired up the same test as last night and the results were the same.  I then removed the 'noglob' from the alias and everything worked fine.  I put the 'noglob' back and ... everything remained fine :-|   But this replicates the strangeness of the thing, it seems unpredictable which is why I smell the same issue -- some sort of microsecond delay of some sort such that the results would flicker as they have.  Bart mentions that piping involves simultaneous activity which sounds like a good place for a bad delay.

I'll run it with 'set -x' as Bart suggests once it starts to misbehave again.  I've always had a talent for breaking things. Anyway this is not zsh's problem I think.

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