get_env(3f) - [M_io:QUERY] a function returning the value of an environment variable (LICENSE:PD)
Syntax
Description
Options
Returns
Example
See Also
Author
License
function get_env(NAME,DEFAULT) result(VALUE)
character(len=*),intent(in) :: NAME character(len=*),intent(in),optional :: DEFAULT character(len=:),allocatable :: VALUE
Get the value of an environment variable or optionally return a default value if the returned value would be a blank string.This is a duplicate of system_getenv(3m_system) used to avoid some interdependencies.
NAME name of environment variable DEFAULT value to return if environment variable is not set or set to an empty string
VALUE the value of the environment variable or the default
Sample program:
program demo_get_env use M_io, only : get_env character(len=:),allocatable :: HOME HOME=get_env(HOME,UNKNOWN) write(*,(a))HOME,get_env(PATH) write(*,(a))get_env(HOME),get_env(PATH) end program demo_get_env
get_environment_variable(3fortran), system_getenv(3m_system), set_environment_variable(3m_system), system_putenv(3m_system), system_clearenv(3m_system), system_initenv(3m_system), system_readenv(3m_system), system_unsetenv(3m_system)
John S. Urban
Public Domain
Nemo Release 3.1 | get_env (3) | July 22, 2023 |