Mojo function
setenv
setenv(name: String, value: String, overwrite: Bool = 1) -> Bool
Changes or adds an environment variable.
Constraints:
The function only works on macOS or Linux and returns False otherwise.
Args:
- name (
String
): The name of the environment variable. - value (
String
): The value of the environment variable. - overwrite (
Bool
): If an environment variable with the given name already exists, its value is not changed unlessoverwrite
is True.
Returns:
False if the name is empty or contains an =
character. In any other case, True is returned.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
😔 What went wrong?