Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

setShellEnvVar

setShellEnvVar( 
t_varName_or_nameValuePair 
[ t_varValue ] 
) 
=> t / nil

Description

Sets or updates the value of the UNIX environment variable. This function expands the environment variable name specified in the argument.

Arguments

t_varName_or_nameValuePair

Environment variable name or assignment expression (<name>=<value>)

t_varValue

Value of the environment variable

Value Returned

t

The shell environment variable is set.

nil

The shell environment variable cannot be set.

Examples

Sets the parent working directory to the /tmp directory.

setShellEnvVar("PWD=/tmp”)    
=> t

Gets the parent working directory.

getShellEnvVar("PWD")         
=> "/tmp"

Sets the Test directory to the /tmp directory.

setShellEnvVar("TEST=/tmp”)    
=> t

Sets the Test directory to the home directory.

setShellEnvVar("TEST" "/home")    
=> t

Returns nil, as an equal to sign is required to set the value.

setShellEnvVar("TEST")  
=> nil
WARNING* setShellEnvVar: must have an equal sign to set a value - "TEST"

Returns nil, as the argument does not have a variable name.

setShellEnvVar("=/tmp")  
=> nil
*WARNING* setShellEnvVar: the argument should include a variable name - "=/tmp"

Returns nil, as the argument has a space before the equal to sign.

setShellEnvVar("TEST = /tmp")  
=> nil
*WARNING* setShellEnvVar: must not have a space before the equal sign - "TEST = /tmp

setShellEnvVar("ITER" "1")  
=> t
setShellEnvVar("EDITOR_COPY_$ITER" "$EDITOR")  
=> t
getShellEnvVar("EDITOR_COPY_$ITER")  
=> "gedit"

Related Topics

Environment Functions

sh, shell


Return to top
 ⠀
X