delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/25/11:42:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <6.1.2.0.1.20040926005459.02810cb0@mail.ros.com.au>
X-Sender: errol AT mail DOT ros DOT com DOT au (Unverified)
Date: Sun, 26 Sep 2004 01:42:17 +1000
To: cygwin AT cygwin DOT com
From: Errol Smith <errol AT ros DOT com DOT au>
Subject: "which" command does not expand "~" in path
In-Reply-To: <1094385246.5803.ezmlm@cygwin.com>
References: <1094385246 DOT 5803 DOT ezmlm AT cygwin DOT com>
Mime-Version: 1.0

  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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019