W3cubDocs

/Octave

36.7 Environment Variables

getenv (var)

Return the value of the environment variable var.

For example,

getenv ("PATH")

returns a string containing the value of your path.

See also: setenv, unsetenv.

setenv (var, value)
setenv (var)
putenv (…)

Set the value of the environment variable var to value.

If no value is specified then the variable will be assigned the null string.

See also: unsetenv, getenv.

status = unsetenv (var)

Delete the environment variable var.

Return 0 if the variable was deleted, or did not exist, and -1 if an error occurred.

See also: setenv, getenv.

homedir = get_home_directory ()

Return the current home directory.

On most systems, this is equivalent to getenv ("HOME"). On Windows systems, if the environment variable HOME is not set then it is equivalent to fullfile (getenv ("HOMEDRIVE"), getenv ("HOMEPATH"))

See also: getenv.

© 1996–2018 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/interpreter/Environment-Variables.html