Skip to content

path/PATH-style aliasing doesn't work through the environment when defined outside of initial.es #127

@jpco

Description

@jpco

Repro:

; cat ./pair-test.es
#!/usr/local/bin/es

# Set up the foo/FOO pair in the manner of path/PATH.

set-foo = @ {local (set-FOO = ()) FOO = <={%flatten : $*}; result $*}
set-FOO = @ {local (set-foo = ()) foo = <={%fsplit  : $*}; result $*}

noexport = $noexport foo

# Test the foo/FOO pair.

foo = 'one two' three
var foo; var FOO

# Test passing it down the environment.

es -c 'echo in subshell; var foo; var FOO'
; ./pair-test.es 
foo = 'one two' three
FOO = 'one two:three'
in subshell
foo = 
FOO = 'one two:three'

I think this is discussed somewhere in the mailing list... aha, here: http://wryun.github.io/es-shell/mail-archive/msg00837.html

The fact that foo is in noexport is to imitate path, which is due to this: http://wryun.github.io/es-shell/mail-archive/msg00763.html

It's not immediately clear to me why the path/PATH and home/HOME pairs in initial.es work fine but a novel pair doesn't.

Incidentally, for these kinds of pairs, it also doesn't make sense for noexport to be noexport itself, because it will "forget" that foo is noexport in a child shell and then in a grandchild shell, foo will be imported from the environment which can cause the problems motivating path to be noexport.

Motivation: exploring cdpath/CDPATH for #123 as well as ls-colors/LS_COLORS for my own use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions