This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"which" with path $HOME/bin vs ~/bin


I recently switched my path from containing "$HOME/bin" to "~/bin" (by updating to a more recent skeleton of .bash_profile and removing stuff from my own .bashrc).
Now a bash script of mine that uses "which <executable>" to see if a program exists started failing on programs contained in my ~/bin directory.
If I rename those programs by removing the ".exe" eg "pngcrush.exe" to "pngcrush" then "which pngcrush" starts working, but the programs themselves become unreliable (as you would expect? - I believe cygwin programs must be named *.exe?). So it seems "which" is now looking for <program> rather than <program.exe> in my ~/bin directory.
I think this is a bug in "which" as if I remove the "which" check from my script, the script works and the programs in ~/bin are run as expected with the ~/bin variation of PATH.

My workaround was to change .bash_profile:
PATH="~/bin:${PATH}"
to:
PATH="$HOME/bin:${PATH}"
which is what I was using before (this wont work if $HOME is not defined I guess).

Is this a bug in "which"? (is it a bug?

Regards, Errol


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]