1

I've installed zsh and Oh my zsh to customize my terminal and after trying to use conda raised CommandNotFound.

I actually added to .zshrc a line with source ~/.bashrc, as instructed here, and now conda is working again, but everytime I start the terminal or tmux I get the following message:

/home/eduardo/.bashrc:16: command not found: shopt
/home/eduardo/.bashrc:24: command not found: shopt
/home/eduardo/.bashrc:111: command not found: shopt
/usr/share/bash-completion/bash_completion:45: command not found: shopt
/usr/share/bash-completion/bash_completion:53: command not found: complete
/usr/share/bash-completion/bash_completion:56: command not found: complete
/usr/share/bash-completion/bash_completion:59: command not found: complete
/usr/share/bash-completion/bash_completion:62: command not found: complete
/usr/share/bash-completion/bash_completion:65: command not found: complete
/usr/share/bash-completion/bash_completion:68: command not found: complete
/usr/share/bash-completion/bash_completion:71: command not found: complete
/usr/share/bash-completion/bash_completion:74: command not found: complete
/usr/share/bash-completion/bash_completion:77: command not found: complete
/usr/share/bash-completion/bash_completion:80: command not found: complete
/usr/share/bash-completion/bash_completion:1596: parse error near `|'

Is there a way to suppress this? Or maybe a better way to include conda command

Eduardo Pacheco
  • 274
  • 1
  • 6
  • 3
    bash and zsh are two different shells; they aren't compatible with each other (indeed, the whole thing that makes zsh special is that it gives up POSIX compatibility in places where its authors think POSIX mandates doing something awful, so in all the places where zsh's authors disagree with the POSIX spec, it's incompatible with every POSIX-compliant shell). You can't expect to source your bashrc from zsh, or your zshrc from bash; the answer instructing you to do so was wrong on its face. – Charles Duffy Feb 24 '23 at 23:49
  • 3
    Instead, open up your `.bashrc`, find the conda-specific lines, and copy _only_ those lines to your `.zshrc`. – Charles Duffy Feb 24 '23 at 23:50
  • (...and if those lines are sourcing a file with a `.bash` or `.sh` extension and there's a file with a `.zsh` extension in the same place, amend them to source the `.zsh` file instead) – Charles Duffy Feb 25 '23 at 00:04
  • @CharlesDuffy Thanks!!! That solved everything. I knew that they were different shells, but I didn't realize that conda was being initialized in .bashrc and that I could copy it directly to .zshrc – Eduardo Pacheco Feb 25 '23 at 00:10
  • @EduardoPacheco There's not a single reference to `source ~/.bashrc` in the entire thread you linked to, and the two that talked about sourcing `~/.bash_profile` had 0 upvotes - are these the ones you based your *work* on because? Because they're short? – tink Feb 25 '23 at 01:00
  • Thanks @CharlesDuffy, your answer helped me add my anaconda path after switching to Oh My Zsh - great explanation too! – meenaparam Jun 08 '23 at 09:14

0 Answers0