The environment command configures a user-defined environment variable.
The undo environment command deletes a user-defined environment variable.
By default, no user-defined environment variable is configured.
Parameter |
Description |
Value |
---|---|---|
variable-name |
Specifies the name of a user-defined environment variable. |
The value is a string of 1 to 31 case-sensitive characters without spaces. It starts with a letter and contains only letters, digits, and underscores (_). |
variable-value |
Specifies the value of a user-defined environment variable. |
The value is a string of 1 to 64 case-sensitive characters without spaces. If the string is enclosed in double quotation marks (""), the string can contain spaces. |
Usage Scenario
An environment variable consists of a name and a value. In a Python script, you can input an environment variable name in the location where a parameter needs to be input to indicate that an environment variable value needs to be referenced. When the system is running a Python script, it replaces an environment variable name with an environment variable value. To change the value, you can directly change it on the device without having to change and install the Python script. You can define and use user-defined environment variables to simplify the configuration and improve flexibility and feasibility of the Python script.
Precautions
If variable-name is specified multiple times, the system will prompt that the configured user-defined environment variable already exists. You can choose whether to overwrite the existing variable value. After overwriting the existing variable value, you need to run the undo script-assistant python command to delete the Python script assistant that uses the environment variable and then run the script-assistant python command to re-configure the Python script assistant.
A maximum of 100 environment variables can be configured on the device.
To check configured user-defined environment variables, run the display ops environment command.