If the parent script runs with fail on error switch: tcsh -e
but a sub script issue a exit code non zero.
Then the parent will fail like a Jenkins pipeline, Bamboo job or else.
This switch allows easy pipeline debug by stopping the script when exit code > 0
/bin/tcsh -fe
source path/to/bin/sourceme
# display each command executed
set echo
# run commands until first exit code > 0
The issue was related to a grep -> exit code
hostname | grep "login"
if ($? == 0) {
The first line generates a exit 1 if the parent machine is not a login. In other word, it fails any pipeline but runs fine on a login machine.
Solution:
if (`hostname -f`== *login*) {
This simple fix should save countless hours to the team.
Note: first I tried $HOSTNAME which is not a reliable environment variable. Only the process hostname is predictable.