Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 781 Bytes

getenv.markdown

File metadata and controls

30 lines (20 loc) · 781 Bytes
layout title published
default
getenv
true

[%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)