0

I am able to run the TCL scripts on the linux server from the Non-interactive shell created by JSch library used in the java program from windows environment. The problem is I have some scripts which needs to pass certain parameters during the execution of the script based on the intermediate output of the script and after the parameters are entered, the script execution continues from there onwards. But as it is non interactive shell, I am not able to pass this parameters during execution. Is there any way where I can make it work ? I thought of an option where, I will pass the parameters as command line argument, but wanted to know any other way.

Peeyushpd
  • 69
  • 13

1 Answers1

0

When you say "parameters", do you mean anything that a user would have entered in an interactive session as an input to prompts presented by the script?

If yes, there are two possibilities:

  • If the script does not expect the session to be interactive, and just reads its input from its standard input stream (using gets for instance), then just feed this input to the standard input of the tclsh process which interprets your script.
  • If the script does expect the session to be interactive (and refuses to just accept the data from its input stream), you will have to allocate a pseudo-TTY for the target process.

    I'm not familiar with JSch, but this appears to be a question (and an answer) dealing with the making JSch allocate a PTY.

Community
  • 1
  • 1
kostix
  • 51,517
  • 14
  • 93
  • 176
  • Yes, parameters means what user would enter in an interactive shell. As the script expects the session to be interactive I will try exploring the option of pseudo TTY using JSch. Thanks. :) Will post the results soon. – Peeyushpd Apr 15 '13 at 12:14