Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Testing if there is data on stdin?
- X-seq: zsh-users 14405
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: Lloyd Zusman <ljz@xxxxxxxxxx>
- Subject: Re: Testing if there is data on stdin?
- Date: Fri, 18 Sep 2009 11:57:36 +1200 (NZST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <m2ocp9ma6k.fsf@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
- References: <m2ocp9ma6k.fsf@xxxxxxxxxx>
On Thu, 17 Sep 2009, Lloyd Zusman wrote:
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?
I know I can do a [[ -t 0 ]] to see whether stdin is attached to a
terminal, but that doesn't tell me if there is any data waiting to be
read.
=================
this might be what you want:
read -t foo && { data_on_stdin ; echo ${foo} }
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"Arbeit Macht Frei"
(Work Makes You Free)
-- sign over the gates to
Auschwitz concentration camp
Messages sorted by:
Reverse Date,
Date,
Thread,
Author