Enviromnent variables
3 posts
• Page 1 of 1
Enviromnent variables
How can one read system environment variable in a portable way?
For example in Python I can write
in Common Lisp (at least in CCL or LW) I can call
In Dyalog I was not able to find anything in documentation. I currently used
but it doesn't look portable :\
For example in Python I can write
- Code: Select all
import os
os.getenv('HOME')
in Common Lisp (at least in CCL or LW) I can call
- Code: Select all
(getenv 'HOME')
In Dyalog I was not able to find anything in documentation. I currently used
- Code: Select all
⎕SH 'echo $HOME'
but it doesn't look portable :\
- alexeyv
- Posts: 56
- Joined: Tue Nov 17, 2015 4:18 pm
Re: Enviromnent variables
Try this:
It isn't EXACTLY the same, in that - under Windows - it will also look on the command line for a switch called HOME, then in the environment, and finally in the Windows Registry, but for writing portable applications it tends to be what you want.
- Code: Select all
⎕←2 ⎕NQ '.' 'GetEnvironment' 'HOME'
It isn't EXACTLY the same, in that - under Windows - it will also look on the command line for a switch called HOME, then in the environment, and finally in the Windows Registry, but for writing portable applications it tends to be what you want.
-
Morten|Dyalog - Posts: 453
- Joined: Tue Sep 09, 2008 3:52 pm
Re: Enviromnent variables
Thanks! This works (I'm trying on OSX).
I think something like ⎕ENV could be more intuitive though.
I think something like ⎕ENV could be more intuitive though.
- alexeyv
- Posts: 56
- Joined: Tue Nov 17, 2015 4:18 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group