# LibTmux.get_environment

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/configuration.jl#L330
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-get_environment/

```
get_environment(
    connection::LibTmux.ControlConnection,
    scope,
    name::AbstractString;
    inherit,
    kwargs...
)

get_environment(server::LibTmux.Server, scope, name::AbstractString; inherit, kwargs...)
```

## Methods

### `get_environment` (overload 1)

```julia
get_environment(
    connection::LibTmux.ControlConnection,
    scope,
    name::AbstractString;
    inherit,
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/control_options.jl#L413).

Refuse an environment read that cannot preserve `EnvironmentValue` metadata under the admitted control grammar. tmux 3.2a through the researched 3.7 dialect print literal environment newlines; format lookup cannot distinguish absent, hidden and removal entries or their local/global origin. Use an explicit `Server` read when that best-effort transport is acceptable. This method never falls back or returns an empty value as invented metadata.

```julia
get_environment(connection::ControlConnection, scope, name; inherit=false, kwargs...)
```

### `get_environment(server::LibTmux.Server, scope, name::AbstractString; inherit, kwargs...)`

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/configuration.jl#L343).

Read a global (`:global`) or session (`SessionRef`) environment entry. Return `nothing` when absent, or `EnvironmentValue(value, hidden, inherited)`. `value=nothing` is a removal marker for new processes; `value=""` is empty. Hidden entries are returned with `hidden=true`. `inherit=true` falls back to global only for an absent session entry, never for a removal marker. This explicit multi-command observation is not an atomic child-process environment. Values retain literal control bytes, quotes and backslashes; tmux's shell-style reply is decoded as data, never executed. Variable names use `[A-Za-z_][A-Za-z0-9_]*`.

```julia
get_environment(server, scope, name; inherit=false, kwargs...)
```

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `get_environment(connection, scope, name, inherit, kwargs)`)
- `scope` (`Any`)
- `name` (`AbstractString`)
- `inherit` (`Bool`)
  Default: `false`.
- `kwargs`
- `server` (`LibTmux.Server`) (for `get_environment(server, scope, name, inherit, kwargs)`)
