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

[Bash] Unable to add z alias at shell login #314

Closed
g-ongenae opened this issue Dec 12, 2021 · 9 comments
Closed

[Bash] Unable to add z alias at shell login #314

g-ongenae opened this issue Dec 12, 2021 · 9 comments

Comments

@g-ongenae
Copy link

In my .bash_profile:

# Initialize zoxide aliases
eval "$(zoxide init bash)"

Error:

bash: (Ie)__zoxide_hook: syntax error in expression (error token is "__zoxide_hook")

In my shell:

☸ stg in ~ via 🐍 v2.7.18 
❯ z
bash: z: command not found
☸ stg in ~ via 🐍 v2.7.18 took 3s 
❯ zoxide
zoxide v0.7.9
...
@ajeetdsouza
Copy link
Owner

What's bash --version?

@g-ongenae
Copy link
Author

g-ongenae commented Dec 12, 2021

☸ stg in ~ via 🐍 v2.7.18 
❯ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.

@ajeetdsouza
Copy link
Owner

That's a very old version of bash. Could you try using Homebrew to install the latest version (brew install bash)?

@g-ongenae
Copy link
Author

Yes. Just did it, the error remains.

bash: (Ie)__zoxide_hook: syntax error in expression (error token is "__zoxide_hook")

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

☸ stg in ~ via 🐍 v2.7.18 
❯ bash --version
GNU bash, version 5.1.12(1)-release (x86_64-apple-darwin21.1.0)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

☸ stg in ~ via 🐍 v2.7.18 
❯ 

@ajeetdsouza
Copy link
Owner

I just looked at the error again. That's not a bash error. I believe you're executing eval "$(zoxide init zsh)" somewhere in your bash configuration.

@g-ongenae
Copy link
Author

Oh you're right, I fixed the issue in my shared .bash_profile but I forgot to update the one in the $HOME folder. Now, it works. Thank you for your help and sorry, I should have been able to figure that out before opening this bug.

@ajeetdsouza
Copy link
Owner

Not a problem, and you're welcome! 😄

@DesBw
Copy link

DesBw commented Nov 7, 2024

I am having this issue. I have put the eval "$(zoxide init bash)" in my profile ( home/.bashrc) as well as the shell profile (home/.bashprofile). But, I am getting the same error.

@ajeetdsouza
Copy link
Owner

@DesBw please create a fresh issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants