Jenkins displaying echo command in console output page

I have the below code in execute shell on Jenkins. My requirement is to display servername parameter in each line to display in console output. I have used echo and got the server names and they are getting displayed in console.

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

All lines contain echo server to display the server names

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"

The echo statement is getting displayed in console output and next the output is getting displayed. I need to remove the echo related statements from Console output. Please help me to achieve this.

Upvotes: 4

Views: 13068

Answers (1)

Rubén Pozo
Rubén Pozo

Reputation: 1083

If you are executing the task in a linux slave try with:

#!/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"

If you are executing in a windows slave try executing windows command:

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

Upvotes: 1

Related Questions