This is a discussion on How to know if read is pending on pipe within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi, I have shell scripts executing several programs. Both the script and the programs may use stdin and stdout ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I have shell scripts executing several programs. Both the script and the programs may use stdin and stdout to interface with the operator. Now, I want another program to get the script's stdout and eventually write to its stdin. Basically, this seems to be a case for using the pipe mechanism. The problem is, that I do not want to write into the script's stdin when there is no read pending. I cannot predict when and if the script wants an input, either. So, I need a possibility to test if if there is a read pending at the other end of the pipe before I write into it. Maybe it is a silly question, but how can I do this? Regards -- Helmut Leininger Bull AG / Vienna Open Systems Support Email: h.leininger@bull.at This opinion is mine and not necessarily that of my employer. No guarantees whatsoever. |
| ||||
| "Helmut Leininger" <h.leininger@bull.at> wrote in message news:bjha6j$ieg4h$1@ID-54033.news.uni-berlin.de... > Hi, > > I have shell scripts executing several programs. Both the script and the > programs may use stdin and stdout to interface with the operator. > > Now, I want another program to get the script's stdout and eventually > write to its stdin. > > Basically, this seems to be a case for using the pipe mechanism. The > problem is, that I do not want to write into the script's stdin when > there is no read pending. I cannot predict when and if the script wants > an input, either. > > So, I need a possibility to test if if there is a read pending at the > other end of the pipe before I write into it. Maybe it is a silly > question, but how can I do this? > AFIK, there is no way to tell if there is a read pending at the other end of the pipe. For the case you described, I use GNU program called expect. Nenad |