Jenkins displaying echo command in console output page

10,965

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"
Share:
10,965
Manigandan Thanigai Arasu
Author by

Manigandan Thanigai Arasu

Updated on June 04, 2022

Comments

  • Manigandan Thanigai Arasu
    Manigandan Thanigai Arasu almost 2 years

    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.