diff --git a/README.md b/README.md index 177dc2f..d03c990 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1177 TILs and counting..._ +_1178 TILs and counting..._ --- @@ -1064,6 +1064,7 @@ _1177 TILs and counting..._ - [Remove The Delay On The Escape Key](tmux/remove-the-delay-on-the-escape-key.md) - [Rename The Current Session](tmux/rename-the-current-session.md) - [Reset An Option Back To Its Default Value](tmux/reset-an-option-back-to-its-default-value.md) +- [Set Environment Variables When Creating Session](tmux/set-environment-variables-when-creating-session.md) - [Set Session Specific Environment Variables](tmux/set-session-specific-environment-variables.md) - [Show The Current Value For An Option](tmux/show-the-current-value-for-an-option.md) - [Swap Split Panes](tmux/swap-split-panes.md) diff --git a/tmux/set-environment-variables-when-creating-session.md b/tmux/set-environment-variables-when-creating-session.md new file mode 100644 index 0000000..6d21c12 --- /dev/null +++ b/tmux/set-environment-variables-when-creating-session.md @@ -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.