wsadmin.sh 从标准输入读取多行命令
wsadmin.sh reading multiline commands from stdin
管道 wsadmin
不能 运行 具有流控制的脚本,因为在该模式下换行符分隔命令。
set numbers {1 3 5 7 11 13}
foreach num $numbers {
puts $num
}
输出:
[wasuser@oktest-prod-app-2 ~]$ ${WC_WSADMIN:?} -f test.jacl
WASX7209I: Connected to process "dmgr" on node EmProdDmgrNode using SOAP connector; The type of process is: DeploymentManager
1
3
5
7
11
13
[wasuser@oktest-prod-app-2 ~]$ ${WC_WSADMIN:?} <test.jacl
WASX7209I: Connected to process "dmgr" on node EmProdDmgrNode using SOAP connector; The type of process is: DeploymentManager
WASX7029I: For help, enter: "$Help help"
wsadmin>1 3 5 7 11 13
wsadmin>WASX7015E: Exception running command: "foreach num $numbers {"; exception information:
com.ibm.bsf.BSFException: error while eval'ing Jacl expression:
wsadmin>WASX7015E: Exception running command: "puts $num"; exception information:
com.ibm.bsf.BSFException: error while eval'ing Jacl expression:
can't read "num": no such variable
while executing
"puts $num"
wsadmin>WASX7015E: Exception running command: "}"; exception information:
com.ibm.bsf.BSFException: error while eval'ing Jacl expression:
invalid command name "}"
while executing
"}"
我的脚本已经生成。除了将其存储在临时文件中之外,还有解决方法吗?我知道可以这样做:
foreach num $numbers { puts $num }
但是如果块中必须有多个命令怎么办?
使用分号:
foreach num $numbers { puts $num; puts $num }
但您最好将脚本写入临时文件。
管道 wsadmin
不能 运行 具有流控制的脚本,因为在该模式下换行符分隔命令。
set numbers {1 3 5 7 11 13}
foreach num $numbers {
puts $num
}
输出:
[wasuser@oktest-prod-app-2 ~]$ ${WC_WSADMIN:?} -f test.jacl
WASX7209I: Connected to process "dmgr" on node EmProdDmgrNode using SOAP connector; The type of process is: DeploymentManager
1
3
5
7
11
13
[wasuser@oktest-prod-app-2 ~]$ ${WC_WSADMIN:?} <test.jacl
WASX7209I: Connected to process "dmgr" on node EmProdDmgrNode using SOAP connector; The type of process is: DeploymentManager
WASX7029I: For help, enter: "$Help help"
wsadmin>1 3 5 7 11 13
wsadmin>WASX7015E: Exception running command: "foreach num $numbers {"; exception information:
com.ibm.bsf.BSFException: error while eval'ing Jacl expression:
wsadmin>WASX7015E: Exception running command: "puts $num"; exception information:
com.ibm.bsf.BSFException: error while eval'ing Jacl expression:
can't read "num": no such variable
while executing
"puts $num"
wsadmin>WASX7015E: Exception running command: "}"; exception information:
com.ibm.bsf.BSFException: error while eval'ing Jacl expression:
invalid command name "}"
while executing
"}"
我的脚本已经生成。除了将其存储在临时文件中之外,还有解决方法吗?我知道可以这样做:
foreach num $numbers { puts $num }
但是如果块中必须有多个命令怎么办?
使用分号:
foreach num $numbers { puts $num; puts $num }
但您最好将脚本写入临时文件。