source ~/.bashrc
I first verified Jenkins was running BASH, with echo $SHELL
and echo $BASH
(note I'm explicitly putting #!/bin/bash
atop the textarea in Jenkins, I'm not sure if that's a requirement to get BASH). source
ing /etc/profile
as others suggested was not working.
Looking at /etc/profile
I found
if [ "$PS1" ]; then
...
and inspecting "$PS1" found it null. I tried spoofing $PS1
to no avail like so
export PS1=1
bash -c 'echo $PATH'
however this did not produce the desired result (add the rest of the $PATH
I expect to see). But if I tell bash to be interactive
export PS1=1
bash -ci 'echo $PATH'
the $PATH
was altered as I expected.
I was trying to figure out how to properly spoof an interactive shell to get /etc/bash.bashrc
to load, however it turns out all I needed was down in ~/.bashrc
, so simply source
ing it solved the problem.