Deutsch   English   Français   Italiano  
<vn2j42$2pm15$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:49:21 +0100
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <vn2j42$2pm15$1@dont-email.me>
References: <vm5dei$2c7to$1@dont-email.me> <vmvp3d$2671i$1@dont-email.me>
 <vn04r2$ma8$1@reader2.panix.com> <vn0cno$29vrs$1@dont-email.me>
 <vn117q$faa$2@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Jan 2025 12:49:25 +0100 (CET)
Injection-Info: dont-email.me; posting-host="bcd705229b41a491320eaeccf6d49695";
	logging-data="2938917"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+nZOxUvQWA/WtG2di0UCyp"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:FzRlTJTrPUDvKlLwuU9/m9+R4hE=
In-Reply-To: <vn117q$faa$2@reader2.panix.com>
X-Enigmail-Draft-Status: N1110
Bytes: 3199

On 24.01.2025 22:38, Dan Cross wrote:
> In article <vn0cno$29vrs$1@dont-email.me>,
> Janis Papanagnou  <janis_papanagnou+ng@hotmail.com> wrote:
>> 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?)
> 
> Because you might want to put whatever you assign to `PATH`
> in quotes, for instance if their are spaces in one of the
> component pathnames (people run `bash` on windows and all
> kinds of weird places) and the behavior differs.  $HOME is
> pleasantly boring by comparison.

Sure. That's why you can write, say,

PROJECT_PATH="Yet another space odyssey"
PATH=~/bin:"My Windows Bin":$PROJECT_PATH:'/tmp/$LITERAL':.

(The standard way. Clean unambiguous quoting. No issues.)

> 
>> [snip]
>> 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_.
> 
> What if the expression refers to a file name with a space in
> it?  Of course, one can escape the whitespace characters in
> filenames, but that gets tedious.

The (standard-)rules are simple and clean; see my sample above.

To say it explicitly; values in variables are *not* subject to
another word-splitting in assignments [in standard shells].

Janis