Skip to content

dereferencing an undefined variable should be an error #4163

@krader1961

Description

@krader1961

It would make fish a safer shell if we made dereferencing an undefined variable an error. This would also be consistent with our failglob behavior. See issue #805 and this comment in the issue discussing whether we should do a major release. The example from that comment:

> set hippopotamus
> ls $typopotamus
fish: $typopotamus is not defined.
ls $typopotamus
   ^

Note that using an index that doesn't exist would still silently substitute nothing. That is, this would still be legal and work like it does today:

> set var a
> echo "var[2]=$var[2]:"
var[2]=:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions