[CentOS] explain strange behavior

Fri Aug 19 18:20:40 UTC 2016
John R Pierce <pierce at hogranch.com>

On 8/19/2016 11:12 AM, Dan Hyatt wrote:
> In my bin directory, most of the binaries are linked to it. It is in 
> my path. I have googled this and cannot find anything close.
>
> I am running bash on centos6.8
>
> When I run   "which command" most of the files in this custom bin 
> directory show up.
>
> When I run "which file.jar" it cannot see it, but I can *ls* the file  
> (soft link)
>
> as which only works on executables (according to man page), I created 
> a dan.jar empty file and did a which on dan.tar and found it.
>
>
> can anyone explain what is happening and how I can soft link the jar 
> files to my bin directory so which can see them? 

`which` will only show files that have chmod +x  set and are in the path.

jar files aren't directly executable by the shell, you have to run java 
-jar name.jar to execute them, so there's no point in having them in the 
path or +x.


-- 
john r pierce, recycling bits in santa cruz