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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send commands into a shell window? 1

Status
Not open for further replies.

ppathome

Technical User
May 19, 2005
1
SE
Hi all!

Currently I am working with Solaris 5.8 and would like to do the following from a ksh script:

open up a new terminal window (xterm for example), rlogin in that window to another host, and then run commands in that window.
I know that xterm has the "-e" switch that makes it possible to pass a command as a parameter, like:

xterm -e rlogin host_b -l user_b

This works fine from a script, but after the rlogin, I cannot run any other command from script(because it is already a new shell from unix point of view).
For example I cannot write this into my script:

xterm -e rlogin host_b -l user_b;echo hello world

(in this case echo world will be only executed after I disconnect from host_b...)

Is there a way to "send" a command to that newly opened xterm window so that it executes that command?

Any idea or help will be appreciated. Thanks.

Peter

 
And what about remote shell (rsh, remsh or rcmd) ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
ahhhh,

This is what the Expect was designed for ....

Expect allows you to automate interactive programs. It's in the family of the Tcl/TK program set and is well supported and adopted (check-out the Tcl/Tk forum on tek-tips
It's well worth your time and energy to look into, the learning curve is pretty small! You can get the free binary version from the link below:

 
...I'd like to also mention that Tcl/Tk is also available on your Solaris disks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top