delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/28/11:09:23

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.20040929010527.027f4eb0@mail.ros.com.au>
X-Sender: errol AT mail DOT ros DOT com DOT au (Unverified)
Date: Wed, 29 Sep 2004 01:08:42 +1000
To: cygwin mailing-list <cygwin AT cygwin DOT com>
From: Errol Smith <errol AT ros DOT com DOT au>
Subject: RE: "which" command does not expand "~" in path
Mime-Version: 1.0
X-IsSubscribed: yes

At 09:23 PM 26/09/2004, "Hannu E K Nevalainen" wrote:
>FWIW; 'man bash' has a section on Tilde Expansion - I take it as; bash does
>this expansion for you, not which.exe -> use $HOME when not typing at the
>prompt.

  This is all fine & good, but it doesn't change the fact that the 
cygwin-supplied "which" does NOT work with the cygwin-supplied 
".bash_profile" (when you use a personal ~/bin directory.).
  Here is a simple patch which fixes half the problem (the ".bash_profile" 
placing a raw ~ in the path):

--- /etc/skel/.bash_profile     2004-05-15 21:40:04.000000000 +1000
+++ .bash_profile       2004-09-29 00:21:50.000000000 +1000
@@ -10,16 +10,16 @@

  # Set PATH so it includes user's private bin if it exists
  # if [ -d ~/bin ] ; then
-#   PATH="~/bin:${PATH}"
+#   PATH="${HOME}/bin:${PATH}"
  # fi

  # Set MANPATH so it includes users' private man if it exists
  # if [ -d ~/man ]; then
-#   MANPATH="~/man:${MANPATH}"
+#   MANPATH="${HOME}/man:${MANPATH}"
  # fi

  # Set INFOPATH so it includes users' private info if it exists
  # if [ -d ~/info ]; then
-#   INFOPATH="~/info:${INFOPATH}"
+#   INFOPATH="${HOME}/info:${INFOPATH}"
  # fi

<end patch>

This won't help anyone who expects the cygwin "which" command to be the 
same as the GNU version regarding the tilde character in paths (OK, so 
maybe that would be rare), but it will stop people running into it using 
cygwin's defaults. (I fixed the MAN & INFO paths for consistency).

Regards, Errol

btw, does anyone know why those private paths are commented out by default? 
(security?)


--
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