Re: [JSch-users] How to pass enviornment variables in JSCH
Status: Alpha
Brought to you by:
ymnk
From: Inderbir P. <ind...@or...> - 2006-09-12 08:27:22
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Also it would be very great if some information is available regarding the following API's since i am a bit confused.<br> <br> (ChannelExec)channel.setInputStream()<br> (ChannelExec)chanel.setOutputStream()<br> (ChannelExec)channel.setErrStream()<br> as per my understanding once i set the error stream all errors coming on the channel would go in that stream<br> is it correct?<br> <br> Similarly for the getter of the same class<br> (ChannelExec)channel.getInputStream()<br> <br> What i want to achieve is that execute a remote command and i should be able to write the input to that command<br> through the channel and the enviornment; finally recieve the output and the error stream, exit code.<br> <br> I saw the sample program of Exec in the examples but i am bit confused why we are reading the output of channel<br> from the stream which is got using channel.getInputStream().<br> <br> -- Inder<br> <br> Inderbir Pall wrote: <blockquote cite="mid...@or..." type="cite">Wont the mentioned solution work only for BASH shell i mean where we set env variables using <br> export FOO=foo <br> while for csh it would be setenv FOO foo <br> does jsch takes care of this depending on which remote shell is being used to execute the <br> command Remote or else i will have to build up some logic in my app to handle such a scenario. <br> <br> -- Inder <br> <br> Atsuhiko Yamanaka wrote: <br> <blockquote type="cite">Hi, <br> <br> +-From: Inderbir Pall <a class="moz-txt-link-rfc2396E" href="mailto:ind...@or..."><ind...@or...></a> -- <br> |_Date: Tue, 12 Sep 2006 10:04:02 +0530 ___________ <br> | <br> |I want to execute a remote program using JSCH, by opening the channel in |exec mode <br> |but if my program requires some enviornment variables; is there some way of <br> |achieving this in JSCH. <br> <br> It depends on your login shell, but is it enought to set variables like the following? <br> channel.setCommand("FOO=foo BAR=bar command"); <br> <br> Sincerely, <br> -- <br> Atsuhiko Yamanaka <br> JCraft,Inc. <br> 1-14-20 HONCHO AOBA-KU, <br> SENDAI, MIYAGI 980-0014 Japan. <br> Tel +81-22-723-2150 <br> +1-415-578-3454 <br> Fax +81-22-224-8773 <br> Skype <a class="moz-txt-link-freetext" href="callto://jcraft/">callto://jcraft/</a> <br> </blockquote> <pre wrap="">------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo <a class="moz-txt-link-freetext" href="http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642">http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642</a></pre> <pre wrap=""> <hr size="4" width="90%"> _______________________________________________ JSch-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:JSc...@li...">JSc...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/jsch-users">https://lists.sourceforge.net/lists/listinfo/jsch-users</a> </pre> </blockquote> </body> </html> |