Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson 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: <20250123134647.436@kylheku.com> <87v7u5m9m5.fsf@nosuchdomain.example.com> 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 writes: > On 24.01.2025 14:33, Dan Cross wrote: >> In article , >> Janis Papanagnou 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 */