当前位置: 技术问答>linux和unix
java调用sh脚本遇到export命令会卡住,sh不能调用子sh
来源: 互联网 发布时间:2017-02-11
本文导语: 本帖最后由 qxl9842 于 2012-03-24 19:31:10 编辑 大家好,我遇到一个郁闷问题,紧急求助 环境:sunM3000 Solaris10系统 JDK1.5 根目录下创建/work文件夹,下包含test.sh test2.sh 脚本如下: test.sh ## cd /work touch aa.log export aa=123456 ./test2...
环境:sunM3000 Solaris10系统 JDK1.5
根目录下创建/work文件夹,下包含test.sh test2.sh
脚本如下:
test.sh
##
cd /work
touch aa.log
export aa=123456
./test2.sh
touch bb.log
----------------------
test2.sh
##
cd /work
touch cc.log
----------------------
直接使用ssh调用test.sh,可执行,看到aa.log和bb.log(注意:没有cc.log)
[color=#FF0000]问题1:为什么直接执行没调用test2.sh
问题2[/color]:使用java标准调用test.sh(Runtime.getRuntime().exec({"bin/sh","-c","./work/test.sh"})),只能看到aa.log创建,卡在export命令上了
问题3:如果注释掉代码"#export aa=123456",会输出aa.log和bb.log,但test2.sh里面的代码未被执行
请各位大侠帮忙,在线等!!!
|
/bin/bash
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。