Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

ksh93: can't unalias in a subshell #108

@McDutchie

Description

@McDutchie

The unalias command has no effect when executed in a subshell so it's not possible to temporarily work with the alias disabled by using a subshell.

$ ksh -c 'alias test=test; (unalias test; alias test); alias test'
test=test
test=test

Presumably this is similar to #73, as in, it's another issue related to ksh93's non-forking implementation of subshells. Then again there is an important difference: even aliases set within the subshell can't be unaliased within the same subshell:

$ ksh -c '(alias test=test; unalias test; alias test); alias test'
test=test
test: alias not found

Workaround: Using a background job forces the subshell to be forked into a new process and then the unalias works.

$ ksh -c 'alias test=test; (unalias test; alias test) & wait; alias test'
test: alias not found
test=test

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions