Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goto not working when in WSL and also using zsh #58

Open
ikteru opened this issue Jan 8, 2020 · 3 comments
Open

Goto not working when in WSL and also using zsh #58

ikteru opened this issue Jan 8, 2020 · 3 comments
Labels
help wanted 🙏 Extra attention is needed

Comments

@ikteru
Copy link

ikteru commented Jan 8, 2020

I installed goto recently on WSL. It didn't work from the first try. So I installed it myself in a different directory where I put most of my global scripts.
But when I investigated the goto script, I realized that it checks if you have a .bashrc file but also checks if you have .zshrc.
However, if it finds .bashrc, it adds the the sourcing script to it and ignore .zshrc.
I have tested the script you guys used to decide which file to use and here is the output:

@DESKTOP-C64TQ1G ➜ testingStuff  if [ -f ~/.bashrc ]; then
then> echo ".bashrc exists" 
then> fi
.bashrc exists
@DESKTOP-C64TQ1G ➜ testingStuff  if [ -f ~/.zshrc ]; then
echo ".zshrc exists"
fi
.zshrc exists
@DESKTOP-C64TQ1G ➜ testingStuff  if [ -f ~/.bashrc ]; then
echo "bashrc exists" 
elif [ -f ~/.zshrc ]; then
echo "zshrc exists"
fi
bashrc exists

I think the correct behavior in this case is to add it to .zshrc since IF zsh is used, it usually ignores .bashrc and uses its own .zshrc .

@iridakos
Copy link
Owner

@ikteru Thanks for the detailed feedback. I will check on it and with some help from contributors (since I don't use ZSH) we should proceed to the suggested changes.

@iridakos iridakos added the help wanted 🙏 Extra attention is needed label Jan 28, 2020
@kasperschnack
Copy link

kasperschnack commented Jul 4, 2020

@iridakos

I believe it is mainly the case that .zshrc and .bashrc co-exists as bash is the default shell in many systems and zsh gets added. I think a possible workaround could be to change the if statement in the install script to check whether $SHELL == /bin/bash or $SHELL == /bin/zsh. This would also fix #55 as the cause of the issue is the same :)

@solisoares
Copy link

@kasperschnack

Thought that too, but turns out that the $SHELL variable points to the login shell of the current user, not the shell running for the current user.

In my Linux machine I use zsh as my normal shell but for sudo it is bash, and the install script must be run in sudo mode so $SHELL is always bash when I run the script.

We can parse /etc/passwd for the normal shell but i think it would break on Mac and Windows. What do you think @iridakos ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted 🙏 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants