Incidencia #39386

'typeset' and family accept invalid identifiers

Abrir Fecha: 2019-07-10 04:51 Última actualización: 2023-09-14 01:19

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Hito:
(Ninguno)
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Ninguno
Fichero:
Ninguno
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 (3/3 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
Comentario

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.

2023-09-14 01:19 Updated by: magicant
  • Estado Update from Open to Cerrado
Comentario

Attachment File List

No attachments

Editar

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