1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-04 23:58:01 +00:00

Add Set Environment Variables When Creating Session as a tmux til

This commit is contained in:
jbranchaud
2022-01-05 14:21:08 -06:00
parent 5c26d3373b
commit 27e1578095
2 changed files with 26 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
# Set Environment Variables When Creating Session
In [Set Session-Specific Environment
Variables](set-session-specific-environment-variables.md), 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:
```bash
$ tmux new -s my-project
```
To set environment variables on that session, use one or more `-e` flags
followed by the name and value.
```bash
$ tmux new -s my-project -e EDITOR=code -e PG_VERSION=13.4
```
See `man tmux` for more details.