Re: read built-in command has a problem in shell function

2021-10-11 Thread Greg Wooledge
On Mon, Oct 11, 2021 at 03:28:18PM +0900, Hyunho Cho wrote: > If i want to know whether there are input available from stdin > then i use "read -t 0" command like this > > if read -t 0; then# first check input available > while read line; do ... done > ... > fi What are you actually trying to

Re: read built-in command has a problem in shell function

2021-10-11 Thread Alex fxmbsw7 Ratchev
yea if date didnt have time to do, in one sync case it did, sleep 0.001 wasnt enuff, i didnt test much more sorry, thanks On Mon, Oct 11, 2021, 13:37 Robert Elz wrote: > Date:Mon, 11 Oct 2021 10:26:12 +0200 > From:Alex fxmbsw7 Ratchev > Message-ID: < > caalkerhta-kb

Re: read built-in command has a problem in shell function

2021-10-11 Thread Robert Elz
Date:Mon, 11 Oct 2021 10:26:12 +0200 From:Alex fxmbsw7 Ratchev Message-ID: | i still have hopes it syncs, arent pipes file fifos or something it makes no difference, you cannot sync something which has not yet been written, and in the examples it us very likely

Re: read built-in command has a problem in shell function

2021-10-11 Thread Alex fxmbsw7 Ratchev
a sleep .001 was by far no enuff i still have hopes it syncs, arent pipes file fifos or something i understand it can also be not doing anything but timings there yes On Mon, Oct 11, 2021, 10:17 Andreas Schwab wrote: > On Okt 11 2021, Alex fxmbsw7 Ratchev wrote: > > > a sync in hope it syncs pip

Re: read built-in command has a problem in shell function

2021-10-11 Thread Andreas Schwab
On Okt 11 2021, Alex fxmbsw7 Ratchev wrote: > a sync in hope it syncs pipes It doesn't. It just alters the timing. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: read built-in command has a problem in shell function

2021-10-11 Thread Alex fxmbsw7 Ratchev
a sync in hope it syncs pipes makes the date | f work, but not for <( date ) f() { sync; read -t 0 ; printf $?\\n ; } ; date | f ; f <( date ) ; read -t 0 <( date ) ; printf $?\\n 0 1 1 On Mon, Oct 11, 2021, 09:42 Andreas Schwab wrote: > On Okt 11 2021, Hyunho Cho wrote: > > > this command wor

Re: read built-in command has a problem in shell function

2021-10-11 Thread Andreas Schwab
On Okt 11 2021, Hyunho Cho wrote: > this command works well in *shell script file* > but in shell function does not work well This has nothing to do with shell functions. It is a simple race condition. > sh$ echo 111 | myfunc# OK > yes > > sh$ cat foo.c | myfunc# NOT WORK! > > s