Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Newsgroups: gnu.bash.bug Subject: Re: Why does a Bash shell script write prompts followed by reads and do it right? Date: Wed, 02 Sep 2015 20:27:06 +0200 Lines: 14 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1441218435 5485 208.118.235.17 (2 Sep 2015 18:27:15 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org, Robert Parker Envelope-to: bug-bash@gnu.org In-Reply-To: X-Mailer: Evolution 3.16.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 199.195.249.9 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11468 Robert Parker wrote: > Yet when I attempt the same in a C program, the system always writes > 2 prompts, then waits for a read. > Does not matter if I write(1, "..."); read(0, number, buffer); or use > fputs("...", stdout); fgets(..... > The result is the same. > And I have tried using readline without any better result. I completely agree with Bob. It looks like your C program were doing a loop (which your shell script doesn't!) and there's a wrong condition somewhere. But you need to show the code that is failing (provide a minimal program that exhibits the failure).