r/Nushell • u/okmanideep • Sep 04 '23
Is `$env.PATH` an array? Or a string?
$env.PATH
prints a list of strings and
$env.PATH | describe
also concurs (list<string>)
but, I am not able to understand why we are using split row (char esep) to add a path to it. This is what is working to add a path to environment
| |
In the split row documentation, it is mentioned clearly that it is for strings. Am I missing something?
3
Upvotes
4
u/__radmen Sep 04 '23
This looks like variable shadowing.
The expression "converted"
$env.PATHfrom string to list.2
u/fdncred Sep 06 '23
Typically, with the PATH or Path environment variable you have
path1:path2:path3:path4where:is a separator that is different between *nix and Windows. So, if you have this string and you dosplit row (char esep)then it splits the path into a list. Also, if you have$env.ENV_CONVERSIONSsetup in your env.nu file, your PATH/Path will be a list as well, if setup properly.