The suggested shebang works as expected, see the below details:

Execute shell step based on #!/bin/sh -e

#!/bin/sh -e
echo hi
echo world

Console Output:

[example] $ /bin/sh -e /tmp/hudson8709802188364684962.sh
hi
world


Execute shell step based the default shebang

echo bye
echo world

Console Output:

[example] $ /bin/sh -xe /tmp/hudson8136234464915657626.sh
+ echo bye
bye
+ echo world
world


If the above shebang doesn't fit your requirements, you might consider to 
use the approach suggested by Teichner Peter 

Cheers

On Monday, 24 October 2016 21:11:29 UTC+1, Bhushan Kittur wrote:
>
> Thanks for the response.
>
> Tried with "#!/bin/sh -e". Still everything gets logged to console. 
>
>
>  
>
> Sent from Outlook <http://aka.ms/weboutlook>
>
>
> ------------------------------
> *From:* jenkins...@googlegroups.com <javascript:> <
> jenkins...@googlegroups.com <javascript:>> on behalf of Victor Martinez <
> victormar...@gmail.com <javascript:>>
> *Sent:* Monday, October 24, 2016 9:48 PM
> *To:* Jenkins Users
> *Cc:* peter.t...@nagra.com <javascript:>
> *Subject:* Re: disable/hide logging of shell script content to console log 
>  
> Jenkins uses the shebang, by default 
>
> #!/bin/sh -xe
>
> -x will prompt those verbose details, if you'd like to reset that you can 
> set the default shebang in your shell build step with something like
>
> #!/bin/sh -e
>
> # add whatever you'd like to do
>
> Cheers
>
>
> On Monday, 24 October 2016 16:35:03 UTC+1, Teichner Peter wrote: 
>>
>> You can hide your output away from the script by redirecting the output 
>> to /dev/null but I think this the most you can do – the commands that you 
>> write will still be displayed.
>>
>>  
>>
>> *From:* jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] *On 
>> Behalf Of *Bhushan Kittur
>> *Sent:* 24 October 2016 16:31
>> *To:* jenkins...@googlegroups.com
>> *Subject:* disable/hide logging of shell script content to console log
>>
>>  
>>
>> Hello Everyone,
>>
>>  
>>
>> I am using "Execute shell script on remote host using SSH" under Build 
>> section of the Job config with lines of shell script placed there.
>>
>> And see all lines from the shell script are logged into Jenkins console 
>> log during job's execution. 
>>
>> Ex:
>>
>> tarted by user anonymous <http://localhost:8080/jenkins/user/null>
>>
>> [EnvInject] - Loading node environment variables.
>>
>> Building in workspace ...
>>
>> [EnvInject] - Executing scripts and injecting environment variables after 
>> the SCM step.
>>
>>  
>>
>> executing script:
>>
>> *target_env="dev"*
>>
>> *var1=${target_env}*
>>
>> *key="test123"*
>>
>> *branchName=dev_feature1*
>>
>> *startDeploy()*
>>
>>  
>>
>> *case "$var1" in*
>>
>>  
>>
>> *dev ) *
>>
>>  
>>
>> *.*
>>
>> *.*
>>
>> *.*
>>
>> *esac*
>>
>>  
>>
>>  So is there a way to disable/hide shell script contents from logging 
>> into Jenkins console output of the job.
>>
>>  
>>
>> Sent from Outlook <http://aka.ms/weboutlook>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/HK2PR03MB1857371344C566364709E32FA8A90%40HK2PR03MB1857.apcprd03.prod.outlook.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/HK2PR03MB1857371344C566364709E32FA8A90%40HK2PR03MB1857.apcprd03.prod.outlook.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/4eece697-0b72-46a5-aff6-405433d0947b%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/4eece697-0b72-46a5-aff6-405433d0947b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9379e921-dc59-43bc-b456-af3992bac7db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to