bash – Jenkins在控制台输出页面中显示echo命令

我在Jenkins的execute
shell中有以下代码.我的要求是在每一行中显示servername参数以显示在控制台输出中.我使用了echo并得到了服务器名称,它们将在控制台中显示出来.

Code:
echo ${Server} PS_EXE="/cygdrive/powershell.exe"
echo ${Server} "wget user=$User pwd= $pwd http://artifactory/dev-package.zip"
echo ${Server} "sleep 20s"

所有行都包含echo服务器以显示服务器名称

Output:
+echo SD998.domain.com PS_EXE="/cygdrive/powershell.exe"
SD998.domain.com PS_EXE="/cygdrive/powershell.exe"
+echo SD999.domain.com "wget user=$User pwd= $pwd http://artifactory/dev-package.zip"
SD999.domain.com "wget user=$User pwd= $pwd http://artifactory/dev-package.zip"

echo语句将显示在控制台输出中,然后显示输出.我需要从Console输出中删除与echo相关的语句.请帮我实现这个目标.

最佳答案 如果您在linux slave中执行任务,请尝试:

#!/bin/bash
echo ${Server} PS_EXE="/cygdrive/powershell.exe"
echo ${Server} "wget user=$User pwd= $pwd http://artifactory/dev-package.zip"
echo ${Server} "sleep 20s"

如果您在Windows slave中执行,请尝试执行windows命令:

@echo %Server% PS_EXE="/cygdrive/powershell.exe"
@echo %Server% "wget user=%User% pwd= %pwd% http://artifactory/dev-package.zip"
@echo %Server% "sleep 20s"
点赞