Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 836 Bytes

getenv.markdown

File metadata and controls

31 lines (21 loc) · 836 Bytes
layout title published tags
default
getenv
true
reference
system functions
functions
getenv

[%CFEngine_function_prototype(variable, maxlength)%]

Description: Return the environment variable variable, truncated at maxlength characters

Returns an empty string if the environment variable is not defined. maxlength is used to avoid unexpectedly large return values, which could lead to security issues. Choose a reasonable value based on the environment variable you are querying.

[%CFEngine_function_attributes(variable, maxlength)%]

Example:

[%CFEngine_include_snippet(getenv.cf, #+begin_src cfengine3, .*end_src)%]

Output:

[%CFEngine_include_snippet(getenv.cf, #+begin_src\s+example_output\s*, .*end_src)%]

Notes:

History: This function was introduced in CFEngine version 3.0.4 (2010)