Re: Assignment-like word shouldn't be subjected to tilde expansion in PO
From:
Chet Ramey
Subject:
Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode
Date:
Fri, 31 Jul 2020 10:03:22 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0
On 7/30/20 10:43 AM, Robert Elz wrote:
> Date: Mon, 20 Jul 2020 10:11:59 -0400
> From: Chet Ramey <chet.ramey@case.edu>
> Message-ID: <a62804af-8c7f-5191-362b-ef5f4d7b3db8@case.edu>
>
> Sorry, didn't reply to this at the time...
>
> | You can make a case for the bash/ksh tilde expansion: the word
> | expansion is ${PARAM:=WORD}, and the WORD is subject to tilde expansion
> | according to the enumerated list in 2.6.2.
>
> Sure. but ...
>
> | Since the first character of WORD is a tilde, if you say the
> | tilde-prefix stops at the `:',
>
> but that's true (in posix) only in an assignment. Either it is an
> assignment, or it is not.
It's not an assignment. Not according to the POSIX definition of a variable
assignment.
The terminating the tilde prefix at `:' is a bash extension. POSIX allows
it because the behavior is undefined if the tilde prefix doesn't form a
valid login name. Call it a bug if you like, but it's been there since at
least bash-1.10.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/