Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Testing if there is data on stdin?
- X-seq: zsh-users 14409
- From: Sebastian Stark <seb-zsh@xxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: Testing if there is data on stdin?
- Date: Fri, 18 Sep 2009 11:07:19 +0200
- Cc: Lloyd Zusman <ljz@xxxxxxxxxx>, zsh-users@xxxxxxxxxx
- In-reply-to: <237967ef0909171647k21d15c6bwe934c4fe16029c68@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <m2ocp9ma6k.fsf@xxxxxxxxxx> <237967ef0909171647k21d15c6bwe934c4fe16029c68@xxxxxxxxxxxxxx>
On 18.09.2009, at 01:47, Mikael Magnusson wrote:
2009/9/18 Lloyd Zusman <ljz@xxxxxxxxxx>:
Is there a way in zsh to test whether there is at least one byte of
data
waiting to be read from stdin without actually reading that data?
You can either use
zmodload zsh/zselect
zselect -t0 0
or
read -t0
I tried both and noticed a difference:
% print foo | { cat }
foo
% print foo | { read -t0; cat }
% print foo | { zmodload zsh/zselect; zselect -t0 0; cat }
foo
Can anyone explain the difference?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author