Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 3:30 PM, Pierre Gaston wrote: > > > > On Fri, Oct 4, 2013 at 3:29 PM, Pierre Gaston wrote: > >> >> >> >> On Fri, Oct 4, 2013 at 3:08 PM, Kunszt Árpád < >> arpad.kun...@syrius-software.hu> wrote: >> >>> On 2013. October 4. 14:51:00 Pierre Gaston wrote: >>> > On Fri, Oct 4, 20

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 3:29 PM, Pierre Gaston wrote: > > > > On Fri, Oct 4, 2013 at 3:08 PM, Kunszt Árpád < > arpad.kun...@syrius-software.hu> wrote: > >> On 2013. October 4. 14:51:00 Pierre Gaston wrote: >> > On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpád >> ... >> > >> > >> > There is a race condi

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 3:08 PM, Kunszt Árpád < arpad.kun...@syrius-software.hu> wrote: > On 2013. October 4. 14:51:00 Pierre Gaston wrote: > > On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpád > ... > > > > > > There is a race condition, you cannot know if echo will run before read. > > I see, and it's

Re: read -t 0 anomaly

2013-10-04 Thread Kunszt Árpád
On 2013. October 4. 14:51:00 Pierre Gaston wrote: > On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpád ... > > > There is a race condition, you cannot know if echo will run before read. I see, and it's logical. But this stills confuses me. arpad@terminus ~ $ for(( i=0; i<10; i++ )); do echo -n "" |

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpád < arpad.kun...@syrius-software.hu> wrote: > I tried to use "read -t 0" to check if there is any data on the STDIN or > not. > > The man page said: > > If timeout is 0, read returns success if input is available on the > specified file descriptor, failur

read -t 0 anomaly

2013-10-04 Thread Kunszt Árpád
I tried to use "read -t 0" to check if there is any data on the STDIN or not. The man page said: If timeout is 0, read returns success if input is available on the specified file descriptor, failure otherwise. Maybe I made a mistake but I tested and I got variable results: arpad@terminus ~ $ f