Skip to content

Commit

Permalink
Prevent duplicate fnm_multishells in PATH
Browse files Browse the repository at this point in the history
Only eval `fnm env` in non-login shells.
  • Loading branch information
teohhanhui committed Nov 3, 2024
1 parent dd6d17d commit 8ae819f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,32 @@ Check out the following guides for the shell you use:
Add the following to your `.bashrc` profile:

```bash
eval "$(fnm env --use-on-cd --shell bash)"
# fnm
if ! shopt -q login_shell && command -v fnm > /dev/null; then
eval "$(fnm env --use-on-cd --shell bash)"
fi
```

#### Zsh

Add the following to your `.zshrc` profile:

```zsh
eval "$(fnm env --use-on-cd --shell zsh)"
# fnm
if ! [[ -o login ]] && command -v fnm > /dev/null; then
eval "$(fnm env --use-on-cd --shell zsh)"
fi
```

#### Fish shell

Create `~/.config/fish/conf.d/fnm.fish` and add this line to it:
Create `~/.config/fish/conf.d/fnm.fish` and add the following to it:

```fish
fnm env --use-on-cd --shell fish | source
# fnm
if not status --is-login; and command -v fnm > /dev/null
fnm env --use-on-cd --shell fish | source
end
```

#### PowerShell
Expand Down

0 comments on commit 8ae819f

Please sign in to comment.