Deutsch   English   Français   Italiano  
<vn2ier$2phv1$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Sat, 25 Jan 2025 12:38:03 +0100
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <vn2ier$2phv1$1@dont-email.me>
References: <vm5dei$2c7to$1@dont-email.me> <vmthmu$3bb88$1@news.xmission.com>
 <vmtrqk$92b$1@reader2.panix.com> <vmu94j$1q2lp$1@dont-email.me>
 <vn05ji$r20$1@reader2.panix.com> <vn0bpf$29qe6$1@dont-email.me>
 <871pwr6fe9.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Jan 2025 12:38:04 +0100 (CET)
Injection-Info: dont-email.me; posting-host="e33be612a4f5f9ff7a06e2cb1629c3f8";
	logging-data="2934753"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1++iQOFMOkiHM8sIXtgu8K7"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:VWZypk68ceUAI22rSRub6x8vFMY=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <871pwr6fe9.fsf@nosuchdomain.example.com>
Bytes: 2858

On 24.01.2025 23:00, Keith Thompson wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>> On 24.01.2025 14:46, Dan Cross wrote:
> [...]
> 
> /usr/bin/which is limited in what it can do.  It follows POSIX-specified
> behavior for $PATH; it doesn't recognize any shell-specific rules. [...]

Sure.

> [...]
>> The settings  PATH=~/bin  and  PATH="~/bin"  respectively shall
>> result in the same behavior across shells when searching for
>> programs; in the first case looking into "/home/someuser/bin/"
>> and in the second case looking into "./~/bin/" (i.e. a path
>> component with a local directory named "~").
> 
> What do you mean by "shall result?

I mean that a shell should behave consistently. (I think Bash does
not in the given case.)

> All shells that conform to POSIX behave as you describe.  bash doesn't
> conform to POSIX unless you ask it to.  Neither do csh, tcsh, and fish.

We were speaking about shell programming, so [seriously] I don't
consider Csh and Tcsh as sensible sample shells for the discussion.
(Thinking about it, I wonder whether Bash inherited tilde-handling
from Csh, maybe; that would at least explain something.)

(I don't know Fish, so I cannot comment on that.)

> [...]

> BTW, it hadn't occurred to me that you can have a relative path in a
> component of $PATH, but it does seem to work.  I won't be taking
> advantage of this information.

Yes. Some prefer to add '.' to PATH. (Though I have no intention
to discuss that habit.)

Janis