bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does a Bash shell script write prompts followed by reads and do


From: Bob Proulx
Subject: Re: Why does a Bash shell script write prompts followed by reads and do it right?
Date: Tue, 1 Sep 2015 14:25:33 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Robert Parker wrote:
> Yet when I attempt the same in a C program, the system always writes 2
> prompts, then waits for a read.

This isn't a C list.  But if you don't show us the code then no one
can give good help.

If you write, read, write and then it *must* try the read before the
second write.  If you are seeing the second write then it means that
the read returned after the first write.  What you say, writes two
prompts and then read doesn't make sense.

> 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.

This sounds like you simply have some basic problem issue.  You will
need to figure that out first.  If you write(), if you fputs(), and
you are not seeing the output then start there.  Don't move on to
anything else until you understand that part of the problem.

Your problem is really one for discussion on a C programming list.

> I have downloaded the source code for Bash.
> Would someone please let me know where to look to learn to make my code
> work like yours?

That is the wrong direction to go.  It is like saying, I have this
problem building a small bike shed.  I couldn't figure it out.
Therefore I downloaded the plans to the Eiffel Tower in order to
compare the two.  They are not really comparable.  Trying to do so is
just a distraction from solving your real problem.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]