62,614
社区成员
发帖
与我相关
我的任务
分享
String[] cmds = {"/bin/sh", "-c" , "sssss.sh"};
#!/bin/sh
dsVal=`/info/IBM/InformationServer/Server/DSEngine/bin/dsjob -user xx -password xx
-server TESTDS:31539 -jobinfo dstage1 SQ_CWWJ__T_CWWJ_GLFY_SY`
echo $dsVal
echo "hello world!"
exit 0
可以从流中换取到“hello world” 但是得不到dsVal的变量的值
InputStream is = process.getInputStream ( ) ;
byte[] buffer = new byte[1024] ;
while ( is.read(buffer) != -1 ) {
result = new String (buffer) ;
}
is.close ( ) ;
#!/bin/sh
dsVal=`/info/IBM/InformationServer/Server/DSEngine/bin/dsjob -user xx -password xx
-server TESTDS:31539 -jobinfo dstage1 SQ_CWWJ__T_CWWJ_GLFY_SY`
echo dsVal
exit 0
Process pid = null;
pid = Runtime.getRuntime().exec(shellCommand);