Deutsch   English   Français   Italiano  
<875xm36g8q.fsf@nosuchdomain.example.com>

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: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.unix.shell
Subject: Re: Default PATH setting - reduce to something more sensible?
Date: Fri, 24 Jan 2025 13:42:29 -0800
Organization: None to speak of
Lines: 40
Message-ID: <875xm36g8q.fsf@nosuchdomain.example.com>
References: <vm5dei$2c7to$1@dont-email.me> <20250123134647.436@kylheku.com>
	<87v7u5m9m5.fsf@nosuchdomain.example.com>
	<vmvp3d$2671i$1@dont-email.me> <vn04r2$ma8$1@reader2.panix.com>
	<vn0cno$29vrs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Fri, 24 Jan 2025 22:42:30 +0100 (CET)
Injection-Info: dont-email.me; posting-host="ce3eaee7b38cea081e4acffc0808b70e";
	logging-data="2554599"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/xY508DzMQBXf+OicnO8m0"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:Ej3orfr+WHPQvazZrkjNOP8gjsg=
	sha1:Bj8moIqdWy3u84wFhdOK8iNiZCc=
Bytes: 2928

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 24.01.2025 14:33, Dan Cross wrote:
>> In article <vmvp3d$2671i$1@dont-email.me>,
>> Janis Papanagnou  <janis_papanagnou+ng@hotmail.com> wrote:
>>> On 23.01.2025 23:46, Keith Thompson wrote:
>>>> [snip]
>>>> For this and other reasons, though you *can* have a literal ~ in $PATH
>>>> in bash, it's best to avoid it and use $HOME instead. 
>>>
>>> Or use it correctly, unquoted and unescaped.
>> 
>> Or just don't use it, and then you don't have to worry about it.
>
> But as a Ksh (or any non-Bash shell) user I don't have
> to worry about it. (Why shall I see any issue with it?)
> (But as I very early already said; I anyway don't use
> tilde-expressions in scripts, even as a Ksh user.)
>
> But more importantly; shell programmers shall be well aware
> of what quotes mean in shells! They are not just fancy things
> or accessories that one may or may not use as one likes. They
> have clear semantics and are essential in shell programming.
>
> If you want tilde-expressions expanded _don't quote them_.
> It's not much different from file-globbing; don't escape or
> quote a '*' (or other globbing meta-characters) if you want
> it to become expanded.
>
> The suggestion to "not use" this ~ or that * is misguiding.
> Know the shell concepts! - Or know your shell, at least,
> with all its inconsistencies and/or (where applicable) bugs.

~ is equivalent to $HOME in most contexts.  I suggest that assuming that
~, like $HOME, is expanded in double quotes is a very easy mistake to
make.  And the bash misfeature we're discussing can make it hard to
detect that mistake.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */