Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix Pipe problem

Status
Not open for further replies.

bjdobs

Programmer
Mar 11, 2002
261
CA
My understanding of pipe is that if one creates a text file of commands for example menu commands for an application
then it can be piped to the application to automate it.

app < TextFileWithCmds.txt

assume asp has a 3 level menu where we would want to go to level 3 and enter in a set of info which never changes:

x
m
2
9
arcst
/usr/acct/arcst.txt
q


x

When I enter this data into a file then use the pipe method it appears the app throws this all away and just hangs on the first step.

I also tried cat TextFileWithCmds.txt | app


Am I missing something or is the application just not using standard I/O properly (maybe on purpose)?


 
Hi:

Your comment:

... can be piped to the application to automate it.

is not necessarily correct. app may not be written as a pipe.

Your redirection example should work:

pp < TextFileWithCmds.txt

provided you've set up your data file correctly. You can eliminate the file itself by using the unix &quot;here&quot; document facility:

app << MSG
x
m
2
9
arcst
/usr/acct/arcst.txt
q


x
MSG

If you've never used a here document, app reads input up to the second MSG tag. It's important it be in column 1. If you want to redirect standard output of app:

app << MSG > output.file
.
.
MSG

Regards,

Ed

 
echo &quot;3*77/12&quot; | bc
this is a pipe because 'bc' is able to read stdin, what does your 'app'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top