I am currently testing a perl script, running in cshell (company default if you were wondering) that will be used by a Jenkins job. As part of that script, I am doing a sanity check that gradle exists in the path.
I am adding the gradle directory to the path, then I save a local version of the path as seen below:
$ENV{PATH} .= ":/vobs/common/gradle-X.X/bin";
my $myPATH = $ENV{ "PATH" };
Then I do the sanity check with the which command inside a system command as depicted below:
system ("/bin/env PATH=$myPath which gradle" );
The error returned states that I added the path correctly, but for some reason it cannot find gradle within it as seen below:
which: no gradle in (<standard directories>:/vobs/common/gradle-X.X/bin)
Note: Another main reason I mentioned cshell is that these two questions don't apply to my issue because they are bash related:
Why 'whereis' and 'which' don't show me location of command?
How do I clear Bash's cache of paths to executables?
Why does "which" miss commands despite knowing that the /bin directory exists in the path?
Your script might not have enough permissions to access /vobs/common/gradle-X.X/bin
.