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 authored Nov 3, 2024
1 parent dd6d17d commit 4524bd8
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 4524bd8

Please sign in to comment.