Skip to content

Commit 27e1578

Browse files
committed
Add Set Environment Variables When Creating Session as a tmux til
1 parent 5c26d33 commit 27e1578

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1177 TILs and counting..._
13+
_1178 TILs and counting..._
1414

1515
---
1616

@@ -1064,6 +1064,7 @@ _1177 TILs and counting..._
10641064
- [Remove The Delay On The Escape Key](tmux/remove-the-delay-on-the-escape-key.md)
10651065
- [Rename The Current Session](tmux/rename-the-current-session.md)
10661066
- [Reset An Option Back To Its Default Value](tmux/reset-an-option-back-to-its-default-value.md)
1067+
- [Set Environment Variables When Creating Session](tmux/set-environment-variables-when-creating-session.md)
10671068
- [Set Session Specific Environment Variables](tmux/set-session-specific-environment-variables.md)
10681069
- [Show The Current Value For An Option](tmux/show-the-current-value-for-an-option.md)
10691070
- [Swap Split Panes](tmux/swap-split-panes.md)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Set Environment Variables When Creating Session
2+
3+
In [Set Session-Specific Environment
4+
Variables](set-session-specific-environment-variables.md), I showed how env
5+
vars that are scoped to a tmux session can be set in an existing session.
6+
7+
It is also possible to set any number of environment variables when creating a
8+
session. This is particularly handy if you are scripting the setup of various
9+
tmux environments.
10+
11+
A base command to start a tmux session might look like this:
12+
13+
```bash
14+
$ tmux new -s my-project
15+
```
16+
17+
To set environment variables on that session, use one or more `-e` flags
18+
followed by the name and value.
19+
20+
```bash
21+
$ tmux new -s my-project -e EDITOR=code -e PG_VERSION=13.4
22+
```
23+
24+
See `man tmux` for more details.

0 commit comments

Comments
 (0)