Ticket #39386

'typeset' and family accept invalid identifiers

Open Date: 2019-07-10 04:51 Last Update: 2019-07-11 00:52

Reporter:
Owner:
Type:
Status:
Open [Owner assigned]
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

$ readonly a\ b=c
$ readonly a\ b=d
readonly: $a b is read-only
$ echo ${a b}
syntax error: invalid character ` ' in parameter expansion

If that is an invalid expansion, then 'readonly' should not have succeeded either.

$ export a\ b=c
$ env | grep ^a\ b=
a b=c

Allowing identifiers with spaces to be exported also does not seem like a good thing.

Ticket History (2/2 Histories)

2019-07-10 04:51 Updated by: mcdutchie
  • New Ticket "'typeset' and family accept invalid identifiers" created
2019-07-11 00:52 Updated by: magicant
Comment

But GNU's env command supports space-including variable names and POSIX does not seem to disallow such behavior.

$ env 'a b=c' printenv 'a b'
c

I would rather think the shell should support parameter expansion with arbitrary names, if anything should be fixed.

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login