Deutsch   English   Français   Italiano  
<ccr96l-eot.ln1@ID-313840.user.individual.net>

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

Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Geoff Clare <geoff@clare.See-My-Signature.invalid>
Newsgroups: comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Thu, 23 Jan 2025 13:04:44 +0000
Lines: 37
Message-ID: <ccr96l-eot.ln1@ID-313840.user.individual.net>
References: <vm5dei$2c7to$1@dont-email.me> <vm5qc7$ft9$1@reader2.panix.com>
	<vml04v$2ugq2$1@dont-email.me> <vml2ho$30d8f$1@dont-email.me>
	<871pwwwtee.fsf@axel-reichert.de>
	<1a876l-53v.ln1@ID-313840.user.individual.net>
	<20250122120930.74@kylheku.com>
Reply-To: netnews@gclare.org.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net /oOZLu4WQaGCBcswE3vSOAOcWcPwmNNWBt0J8mtvB8UfqzVeLF
X-Orig-Path: ID-313840.user.individual.net!not-for-mail
Cancel-Lock: sha1:Pq/S6jn+93m5ZBf1VzdGHEj2N98= sha256:mWilPvjZqdGkYZrkCx6Ji/sDhHiKu4ma1wd9xJZvVSk=
User-Agent: Pan/0.154 (Izium; 517acf4)
Bytes: 2489

Kaz Kylheku wrote:

> On 2025-01-22, Geoff Clare <geoff@clare.See-My-Signature.invalid> wrote:
>> Axel Reichert wrote:
>>
>>> tilde expansion is not, AFAIK, included in POSIX
>>
>> Incorrect.  See XCU 2.6.1 Tilde Expansion, which includes the following:
>>
>>     In an assignment (see XBD Section 4.26), multiple tilde-prefixes
>>     can be used: one at the beginning of the word (that is, following
>>     the <equals-sign> of the assignment), or one following any unquoted
>>     <colon>, or both.
>>
>> The reason this is there is for things like PATH=~/bin:~/sbin:/bin:...
> 
> But surely that must be expanded before PATH is assigned.

Yes, of course.

> PATH is processed by the "p" exec functions like execlp. I don't
> think these perform tilde expansion!

Correct.

> So the reason for using tilde in PATH assignments is the same reason
> as using them in any other shell programming situation; to save
> keystrokes over typing $HOME.

Yes.  Perhaps I trimmed too much.  The post I was replying to said
"$HOME/bin [..] is better than ~/bin, because tilde expansion is not,
AFAIK, included in POSIX" and $HOME is also, of course, expanded before
PATH is assigned.  So there is no reason to prefer $HOME/bin over ~/bin
since (when used in an assignment) they are equivalent in POSIX.

-- 
Geoff Clare <netnews@gclare.org.uk>