env
Reads an environment variable of the Switchboard Engine.
Details #
env(name) takes exactly one argument and returns the value as text, or null (nothing) when the variable isn't set. Set but empty gives empty text.
It reads the environment of the Engine, the background process that runs your macros. That is not your Terminal's environment: anything you export in a shell is not there. Variables the system gives every app, such as HOME, are normally there.
Because nothing is falsy, || gives a default.
Parameters #
Takes 1 argument.
{{ env(text) }}
Examples #
env("HOME")→
/Users/kyleenv("SWITCHBOARD_MODE") || "normal"→
normalThe second line gives normal unless the Engine has SWITCHBOARD_MODE set.
Gotchas #
Variable names are case-sensitive.