Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
From: Robert Schmidt <rschm@broadpark.no>
Subject: Re: "which" command does not expand "~" in path
Date: Sat, 25 Sep 2004 23:26:18 +0200
Lines: 25
Message-ID: <cj4np8$b17$1@sea.gmane.org>
References: <1094385246.5803.ezmlm@cygwin.com> <6.1.2.0.1.20040926005459.02810cb0@mail.ros.com.au> <cj4diq$1du$1@sea.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: 40.80-203-44.nextgentel.com
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
In-Reply-To: <cj4diq$1du$1@sea.gmane.org>
X-IsSubscribed: yes

Sven Köhler wrote:
>> Set PATH so it includes user's private bin if it exists
>> if [ -d ~/bin ] ; then
>>   PATH="~/bin:${PATH}"
>> fi
> 
> 
> Hmm, i'm not 100% percent sure, but is this supposed to work in general? 
> I don't think that all programs that use the PATH varible are supposed 
> to interpret ~ correctly.
> 
> Instead, the shell usually substitutes ~ or ~user.
> Look at this the output of these commands:
>     echo ~
>     echo "~"

This is probably common knowledge, but I learned last night that sh 
never expands ~.  Under sh, the two lines above yield the same output, 
simply ~.

So my conclusion was to never rely on ~ in scripts or variables.
(Unless something is broken in my setup?)

Cheers,
Rob


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

