Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 727 Bytes

set-environment-variables-when-creating-session.md

File metadata and controls

24 lines (17 loc) · 727 Bytes

Set Environment Variables When Creating Session

In Set Session-Specific Environment Variables, I showed how env vars that are scoped to a tmux session can be set in an existing session.

It is also possible to set any number of environment variables when creating a session. This is particularly handy if you are scripting the setup of various tmux environments.

A base command to start a tmux session might look like this:

$ tmux new -s my-project

To set environment variables on that session, use one or more -e flags followed by the name and value.

$ tmux new -s my-project -e EDITOR=code -e PG_VERSION=13.4

See man tmux for more details.