Espector
Espector

Reputation: 451

Jenkins - Remove unwanted console output lines

I am new with Jenkins and would like to know:

1st) What would be the better practice to run a shell script? Paste the entire script in "Execute shell on remote script"? Or call the sh /root/script.sh script?

2nd) When I launch a script in "Run shell script on remote" it returns me all lines of script in console output:

SCRIPT:

#!/bin/bash                                                                                  
set +x
ONE=1
echo $ONE

CONSOLE OUTPUT:

#!/bin/bash                                                                                  
set +x
ONE=1
echo $ONE
1
[SSH] exit-status: 0
Finished: SUCCESS

In the shell local console command set + x usually works.

Upvotes: 0

Views: 2607

Answers (1)

Sven van de Scheur
Sven van de Scheur

Reputation: 1903

1st) What would be the better practice to run a shell script? Paste the entire script in "Execute shell on remote script"? Or call the sh /root/script.sh script?

Definitely a separate file, you'll be able to put that into version control system like GIT and easily manage changes to the file.

2nd) When I launch a script in "Run shell script on remote" it returns me all lines of script in console output:

Not sure about this one, but try changing !/bin/bash into #!/bin/bash. Perhaps the file isn't seen as actual script?

Upvotes: 2

Related Questions