# `getenv`

_Get or set an environment variable_


## `getenv`

_Get the value of an environment variable_
```syntax
getenv x     getenv[x]
```

where `x` is a symbol atom naming an environment variable, returns its value.
```q
q)getenv `SHELL
"/bin/bash"
q)getenv `UNKNOWN      / returns empty if variable not defined
""
```


## `setenv`

_Set the value of an environment variable_
```syntax
x setenv y     setenv[x;y]
```

where

-   `x` is a symbol atom
-   `y` is a string

sets the environment variable named by `x`.
```q
q)`RTMP setenv "/home/user/temp"
q)getenv `RTMP
"/home/user/temp"
q)\echo $RTMP
"/home/user/temp"
```


----


[`get`, `set`](get.md)


[Environment](../basics/by-topic.md#environment)
