Try this link http://nodejs.org/api/process.html#process_process_env
Then you can make a small program in nodeJS:
console.log(process.env)
And run it
$ node myProgram.js { TERM_PROGRAM: 'iTerm.app', TERM: 'xterm', SHELL: '/bin/bash', CLICOLOR: '1', TMPDIR: '/var/folders/ff/59np25p96x95hpgbtsv3r6zr0000gn/T/', Apple_PubSub_Socket_Render: '/tmp/launch-LIiu0r/Render', OLDPWD: '/Users/hermanjunge', USER: 'hermanjunge', COMMAND_MODE: 'unix2003', SSH_AUTH_SOCK: '/tmp/launch-XOMy7j/Listeners', __CF_USER_TEXT_ENCODING: '0x1F5:0:0', Apple_Ubiquity_Message: '/tmp/launch-jiZQH0/Apple_Ubiquity_Message', LSCOLORS: 'ExFxCxDxBxegedabagacad', PATH: '/Users/hermanjunge/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/mysql/bin', PWD: '/tmp', ITERM_PROFILE: 'hermanjunge', SHLVL: '1', COLORFGBG: '7;0', HOME: '/Users/hermanjunge', ITERM_SESSION_ID: 'w1t4p0', LOGNAME: 'hermanjunge', LC_CTYPE: 'UTF-8', DISPLAY: '/tmp/launch-HCtQeC/org.macosforge.xquartz:0', _: '/usr/local/bin/node' }
Then we learned that we can get elements from the environment in which we run our application. For example, for example:
console.log(process.env.PWD);
What returns
/tmp
And so on...
Herman Junge Feb 25 '13 at 1:59 2013-02-25 01:59
source share