Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow path element equal to delimiter character on append/prepend-path #522

@xdelaruelle

Description

@xdelaruelle

Some environment variables may start or end with a colon character (path entry delimiter). Such value has a special meaning (like falling back to the default paths for MANPATH).

It is desired to add colon character to such variable whether it is currently unset or already hold some path elements.

Adding delimiter character as path element currently raises an error on append-path and prepend-path. And if variable is unset, adding an empty string will not produce a path variable with a colon character.

At the moment, best solution to add a colon character to a path-like variable is following code:

if {[info exists env(VAR)]} {
    append-path VAR :
} else {
    setenv VAR :
}

It would be interesting to be able to add colon character with one command whatever the state of the environment variable:

append-path VAR :

Such feature is for instance wanted to generate simpler modulefile code on package manager tool like EasyBuild (easybuilders/easybuild-framework#4442).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions