why would Jenkins get a different result from shell scripts(redhat 7) alone? I have shell scripts that run fine if I execute them from a terminal, however when I run the scripts from Jenkins they get different results Jenkins 2.263.4


There are a lot of reasons that could happen, but the most common is because of Jenkins not using a "login shell" by default whereas your default local shell is a login shell. This means that it sources your .profile, .bash_profile, or other login scripts are executed locally, but not when launching remotely.

There's a few different ways to make a login shell, but if you were using bash try this at the top of your script:

#!/bin/bash -l

Alternatively, if you're missing an environment variable that would cause different behavior as well. Run printenv on your local shell, then run that as part of a Jenkins shell command, and compare to see if there's a variable that isn't getting defined.