0

I have to execute a unix interactive command that launches another ksh interactive shell, so I can then execute other commands.

expect or tcl/tk is not available, and it seems that I cannot play with redirects (as first interactive command launches other child that I cannot redirect (or don't know how to) outputs.

Example (not automatted)

$ /bin/someComand
username: xpto
password: xpty

someCommand is now executing other voodooshell:

voodooshell$ /bin/anotherCommand
This is the output you want..
bye
.

The 1st part is simple:

$ /bin/someCommand<<E
xpto
xpto

E

Trying something like this does not work

$ /bin/someCommand<<E
xpto
xpto


E<(otherPrettyCommands<<A
who
quit
A )

So i though..... c program with popen !? :-) well, that's fine to solve the 1st problem again, but how can I get the child process of the 1st problem and redirect commands to it before it quits ? :-(

How would you solve this ?

1 Answers1

0

If you want to capture just the output (and not to inject input) maybe you can run an equivalent of Linux's

strace -ff -p pid

and then attempt to parse the output of the strace.

For HP-UX I believe that the equivalent of strace is truss or tusc. tusc can be downloaded at http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-8.1/

(But I've never used tusc or truss in HP-UX, so I don't really know if this is feasable).