Hide commands executed from concourse console

Hi,

I am using concourse to build and deploy projects to servers, to build project I need to execute some commands that I don’t want to show on concourse console. Is there any way that I can avoid commands from being printed out on concourse console?
For example in below lines of concourse console, the lines 1, 3, 4 that I don’t want to show on console.
1.echo Moving to Library and installing specific jars
2.Moving to Library and installing ilex specific jars
3.cd library
4.chmod +x ./mvnw

yml files
platform: linux

image_resource:
type: docker-image
source:
repository: java
tag: openjdk-8-alpine
inputs:
- name: repo
outputs:
- name: build-output

run:
path: sh

echo "Moving to project" 
cd repo/java

echo "Moving to Library and installing specific jars"
cd library
chmod +x ./mvnw

If I understand correctly you want to hide output from echo, cd, and chmod from printing out in the Concourse UI. Is this right?

Using echo doesn’t make sense if you don’t want to print the message out.

cd and chmod don’t print anything out unless set -x is set in the script.

The simplest way to hide output from a command that does emit stdout or stderr is to redirect it to /dev/null. i.e. noisy-command > /dev/null 2>&1

echo, cd and chmod are the commands and I don’t want to show them on console, and command results I don’t mind if they are visible, like if I place something after echo it is obvious I want it in console output.

AFAIK the commands will only show on the console if the script is run with set -x.

test your script locally outside of concourse, if it’s outputting to the screen, it’s going to output to the screen in concourse

as others have mentioned, the secret probably lies in how you’re directing your shell output

you’ll want to pipe the output to /dev/null or similar, for commands that you wish to hide from the screen

https://workaround.org/linuxtip/pipes

It works for me.

#!/bin/bash -ex
set +x; 
echo "shell tracing is disabled here"; set -x;
echo "but is enabled here"

outputs

set +x; 
shell tracing is disabled here 
+ echo "but is enabled here"
but is enabled here