Skip to content

command return and \return can't suppress function/alias lookup and certain special properties in OSH, because return is a keyword #2228

Open
@9ao9ai9ar

Description

@9ao9ai9ar

So I played around with command -V in OSH and noticed that among the special built-in utilities, break, continue, exit and return are actually shell keywords. This means that the following code won't work:

command return
\exit # Unless a function named `exit` is defined, but then it won't be right.

command without options can suppress alias substitution, shell function lookup, as well as special properties of the special built-in utilities (though this last functionality is not respected in some shells): https://pubs.opengroup.org/onlinepubs/9799919799/utilities/command.html.

exit may be aliased (even in OSH, though I don't think it's possible to invoke the alias instead of the keyword), but neither methods of suppressing alias substitution can be used on it.

Do you plan to implement this "quirk and bug" of bash and other POSIX-compatible shells?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions