Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/environments/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Environment variables are available when using [`mise x|exec`](/cli/exec.html),

```shell
mise set MY_VAR=123
mise exec -- echo $MY_VAR
mise exec -- bash -c 'echo $MY_VAR'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While using bash -c correctly prevents the current shell from expanding the variable prematurely, mise exec provides a built-in -c (or --command) flag specifically for this purpose. Using it is more idiomatic and avoids hardcoding bash as the execution shell.

Suggested change
mise exec -- bash -c 'echo $MY_VAR'
mise exec -c 'echo $MY_VAR'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, I did not know this option.

# 123
```

Expand Down
Loading