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

(eval):10: parse error near `^M' #12416

Closed
iris-qq opened this issue May 13, 2024 · 3 comments
Closed

(eval):10: parse error near `^M' #12416

iris-qq opened this issue May 13, 2024 · 3 comments
Labels
Platform: Windows Issue or PR for Windows Resolution: not our issue Issue or pull request not related to Oh My Zsh

Comments

@iris-qq
Copy link

iris-qq commented May 13, 2024

Describe the bug

企业微信截图_17155882991030
windows11+git bash+ ohmyszah+conda

企业微信截图_17155882121555
conda generate code into .zshrc
企业微信截图_17155882526898

Steps to reproduce

conda init zsh

conda activate test

Expected behavior

you can step into a env from conda

Screenshots and recordings

help

OS / Linux distribution

windows11

Zsh version

5.9

Terminal emulator

Terminal preview

If using WSL on Windows, which version of WSL

None

Additional context

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if [ -f '/d/Softwares/anaconda3/Scripts/conda.exe' ]; then
    eval "$('/d/Softwares/anaconda3/Scripts/conda.exe' 'shell.zsh' 'hook')"
fi
# <<< conda initialize <<<
@carlosala
Copy link
Member

You shouldn't source zshrc, just do exec zsh or omz reload if you want to restart your shell.
That seems a situation to report to conda, it seems like oh-my-zsh is not affecting here.

@carlosala carlosala closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@iris-qq
Copy link
Author

iris-qq commented May 13, 2024

yes, I had report this to conda, omz reload not effect

➜  ~ omz reload
(eval):10: parse error near `^M'
➜  ~

@mcornella
Copy link
Member

The issue here is that the .zshrc file has Windows line breaks (CRLF) instead of Unix line breaks (LF). The ^M character in the error corresponds to the CR (Carriage Return) character (equivalent to \r).

To prevent this, first change the .zshrc file to Unix line breaks with command dos2unix .zshrc, and any modifications you make to it make sure to save with LF line breaks.

@mcornella mcornella added Platform: Windows Issue or PR for Windows Resolution: not our issue Issue or pull request not related to Oh My Zsh labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Windows Issue or PR for Windows Resolution: not our issue Issue or pull request not related to Oh My Zsh
Projects
Archived in project
Development

No branches or pull requests

3 participants