Results 1 to 3 of 3
I am using ssh to interface with a server using ksh. I am executing a shell script(call it script A) with ssh and script A runs and has to call ...
- 06-23-2010 #1Just Joined!
- Join Date
- Jun 2010
- Posts
- 2
Supplying input to a nested script
I am using ssh to interface with a server using ksh. I am executing a shell script(call it script A) with ssh and script A runs and has to call a java script( script J). The problem is that I cannot modify script J. It takes standard prompt input from the user. Since I am using ssh, I cannot supply the input as a user would usually do. I need script A to supply the input. I would pass it as an argument to script J, but I cannot modify script J at all. I am very open to any suggestions. None of my techniques thus far are set in stone and I am willing to go about it anyway that will get it to work.
Thanks in advance.
- 06-23-2010 #2
You need to know a bit about how the scriptJ reads its input. If it is reading stdin, then it would be a simple matter of redirecting its input from a file or pipe:
orCode:echo "Horty Florty" | scriptJ
There is the tool 'expect' which can be scripted to look for prompts and then emit responses according to what it sees.Code:# # file.dat contains data to input to scriptJ scriptJ < file.dat
man expect
There are one or two other real hacks, but try these ones first.
--- rod.Stuff happens. Then stays happened.
- 06-25-2010 #3Just Joined!
- Join Date
- Jun 2010
- Posts
- 2
Thanks
The expect works for me. Thanks for your help.


Reply With Quote