You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
changed the title [-]Need support for environment variables (was: "cd $HOME returns error: Expected string, got Primitive(Nothing)")[/-][+]Need support for environment variables[/+]on Aug 26, 2019
At the moment there is no support for environment variables, but we definitely need them.
Normal variables will have the syntax $<IDENT>, so we need something else for environment variables. The most straight-forward approach would be something like PowerShell's namespaced variables ($env:HOME). Do you have any other thoughts?
To me $env:HOME sounds better than conventional $HOME approach. I personally prefer $env.HOME though but $env:HOME is not a big deal to me. Here are some other considerations I can come up with:
How export command would look like?
How to per-command override? like HOME=/home/john any_command?
external commands get their arguments as strings -- eventually external commands will have interpolation for stuff like this, but right now they're just passed right through
Activity
[-]cd $HOME returns error: Expected string, got Primitive(Nothing)[/-][+]Need support for environment variables (was: "cd $HOME returns error: Expected string, got Primitive(Nothing)")[/+][-]Need support for environment variables (was: "cd $HOME returns error: Expected string, got Primitive(Nothing)")[/-][+]Need support for environment variables[/+]wycats commentedon Aug 26, 2019
At the moment there is no support for environment variables, but we definitely need them.
Normal variables will have the syntax
$<IDENT>, so we need something else for environment variables. The most straight-forward approach would be something like PowerShell's namespaced variables ($env:HOME). Do you have any other thoughts?kbumsik commentedon Aug 26, 2019
Oh I see, but then how
echo $HOMEstill works?To me
$env:HOMEsounds better than conventional$HOMEapproach. I personally prefer$env.HOME thoughbut$env:HOMEis not a big deal to me. Here are some other considerations I can come up with:exportcommand would look like?HOME=/home/john any_command?wycats commentedon Aug 26, 2019
I think it probably works by accident:
echois an external command$HOMEfor youwycats commentedon Aug 26, 2019
Yes, I think this syntax should "just work". I miss it dearly in PowerShell.
wycats commentedon Aug 26, 2019
I'm marking this as a bug since a shell without environment variable support isn't much of a shell.
andrasio commentedon Nov 3, 2019
@kbumsik For the moment since our latest release you could do
or
echo $nu:env | get HOMEThe table that
envgives is also in the var$nu:envInspecting the environment you can do with the
envcommand.andrasio commentedon Nov 3, 2019
@kbumsik
~was also fixed. Thank you!!! Please reopen or open a new issue if you see something not working as expected.robyoung commentedon Jul 19, 2020
@andrasio your suggested sollutions don't seem to work for me.
andrasio commentedon Jul 19, 2020
Nu has changed a lot :)
> echo $nu.path> echo $nu.config> echo $nufeat(random): add random-integer and random-uuid (nushell#440)
feat(random): add random-integer and random-uuid (#440)
Update windows_terminal_default_shell.sh (nushell#440)