This is the mail archive of the
cygwin
mailing list for the Cygwin project.
"which" command does not expand "~" in path
- From: Errol Smith <errol at ros dot com dot au>
- To: cygwin at cygwin dot com
- Date: Sun, 26 Sep 2004 01:42:17 +1000
- Subject: "which" command does not expand "~" in path
- References: <1094385246.5803.ezmlm@cygwin.com>
If your PATH contains the tilde character (eg. "~/bin:.......") the
cygwin version of "which" seems to fail to expand the "~" and will then not
locate any commands in ~/bin (or any other directory on the path containing
"~" presumably).
I'm 99% sure it's cygwin's version of "which" causing the issue, because
I compiled the GNU version and it works as expected (2.16 works out of the
box with ./configure & make).
(incidentally, the cygwin which.exe is about 5k and the gnu one is about
80k!)
Testcase:
Uncomment the following section in ~/.bash_profile (from
/etc/skel/.bash_profile)
....
Set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH="~/bin:${PATH}"
fi
....
Create a ~/bin then copy a command of some kind into it for testing (say
"testprogram.exe"), then logout & log in again:
> which testprogram
testprogram: Command not found.
> whichgnu testprogram
/cygdrive/d/home/bin/testprogram
(whichgnu being the gnu version of "which" in this case)
I hope that was a simple enough example. I have reported this before (see
http://www.cygwin.com/ml/cygwin/2004-05/msg00546.html ), but I'm trying
harder this time :)
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/