| Deutsch English Français Italiano |
|
<87v7u5m9m5.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!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: Thu, 23 Jan 2025 14:46:42 -0800
Organization: None to speak of
Lines: 34
Message-ID: <87v7u5m9m5.fsf@nosuchdomain.example.com>
References: <vm5dei$2c7to$1@dont-email.me>
<1a876l-53v.ln1@ID-313840.user.individual.net>
<20250122120930.74@kylheku.com>
<ccr96l-eot.ln1@ID-313840.user.individual.net>
<vmthmu$3bb88$1@news.xmission.com> <20250123134647.436@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 23 Jan 2025 23:46:42 +0100 (CET)
Injection-Info: dont-email.me; posting-host="cfbd9e7c39946649fd7b1a396904b2c2";
logging-data="1916163"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18p5d0yq+XnNcl45fum/e7L"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:vC+GLQmmHch0AfsIGP2+Cg0Eyh0=
sha1:IcOkgR5gL+VOOqitVww7nxs+/ws=
Bytes: 2447
Kaz Kylheku <643-408-1753@kylheku.com> writes:
[...]
> The obvious situation is double quotes. Inside double quotes, parameter
> expansion happens, but not tilde expansion (not to mention pathname
> expansion (globbing) and perhaps some other things).
>
> So this won't work:
>
> PATH="$PATH:~/bin"
>
>> Sorry I don't have details, but it is true nonetheless.
>
> There they are.
[...]
In fact it probably will *partially* work. As I mentioned elsethread,
bash expands a leading ~ (or even ~username) in an element of $PATH when
executing a command.
But if you run a program from the command line that invokes another
program (say, a C program that calls system()), it won't treat that
element of $PATH the same way.
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. A literal '$HOME'
won't work at all, but that's less likely to be a problem if your at all
aware of how double quotes work in the shell.
I suggest that bash's undocumented behavior is less than helpful.
I'll probably submit a bug report.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */