Open JJ opened 9 years ago
That sounds great in theory but I suspect it would be really complex in practice. I'll leave this open so anyone can contribute ideas - PRs welcome also :-)
There's an environment variable called $SHELL that stores the default shell, even if you are running other shell at the moment.
When installing nvm
, I'd expect it to be installed in the current shell, not the default shell.
I'd go for $SHELL, then. At any rate, checking $SHELL instead of just
installing it in whatever .*rc
file you find first might be a better
solution.
@ljharb, if you want just for the current shell, you can use echo $0
. But I'd vote for default shell.
Certainly if we went with the default shell you'd be able to do SHELL=zsh . install.sh
or SHELL=bash . install.sh
to override it, so that's not a horrible idea.
I just switched to zsh so still there's .bashrc and .zshrc present in my ~ . However, it's choosing .bashrc over the one I'm actually using, so I copied it by hand. I know it's a particular problem, but maybe the script could check the current shell and modify whatever file suits it?