【发布时间】:2020-12-18 16:34:03
【问题描述】:
我在 bw 脚本中使用 sshexec 来检查远程服务器上是否存在文件,但输出属性似乎有一个额外的新行。
尝试添加 'sed -r '/^\s*$/d',但这似乎也无济于事。
<sshexec trust="true"
host="${Deploy.remote_hostname}"
username="${Deploy.username}"
verbose="true"
password="${Deploy.password}"
command="test -f ${Deploy.remote_propfile_loc}${Deploy.application_name}_${Deploy.application_version}_@{currentappspace}_@{currentappnode}.substvar && echo 'true'||echo 'false' | sed -r '/^\s*$/d';"
failonerror="true"
outputproperty="file.exists"/>
<echo>this is file "${file.exists}" "Deploy.true"</echo>
cmd : test -f /home/tibco/jenkins/BW_DEV_Login/concatName.application_1.0_AS1_AS1_AN1.substvar && echo 'true'||echo 'false' | sed -r '/^\s*$/d';
true
Disconnecting from dewaserv7377.smartgrid.local port 22
Caught an exception, leaving main loop due to Socket closed
this is file "true
" "Deploy.true"
【问题讨论】:
-
echo 默认情况下(通常我认为)附加一个换行符。您也许可以使用“-n”将其关闭,或使用 printf 代替 echo。