我正在尝试在Ubuntu 15上安装oh-my-zsh。运行安装脚本后
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
我有以下从未出现的错误
/home/li-xinyang/.zshrc:3: command not found: ^M
/home/li-xinyang/.zshrc:9: command not found: ^M
/home/li-xinyang/.zshrc:12: command not found: ^M
/home/li-xinyang/.zshrc:16: command not found: ^M
/home/li-xinyang/.zshrc:19: command not found: ^M
/home/li-xinyang/.zshrc:22: command not found: ^M
/home/li-xinyang/.zshrc:25: command not found: ^M
/home/li-xinyang/.zshrc:28: command not found: ^M
/home/li-xinyang/.zshrc:31: command not found: ^M
/home/li-xinyang/.zshrc:34: command not found: ^M
/home/li-xinyang/.zshrc:39: command not found: ^M
/home/li-xinyang/.zshrc:44: command not found: ^M
/home/li-xinyang/.zshrc:47: command not found: ^M
/home/li-xinyang/.zshrc:52: command not found: ^M
/home/li-xinyang/.zshrc:53: command not found: ^M
/home/li-xinyang/.zshrc:55: command not found: ^M
/home/li-xinyang/.zshrc:58: command not found: ^M
/home/li-xinyang/.zshrc:source:59: no such file or directory: /home/li-xinyang/.oh-my-zsh/oh-my-zsh.sh^M
/home/li-xinyang/.zshrc:60: command not found: ^M
/home/li-xinyang/.zshrc:63: command not found: ^M
/home/li-xinyang/.zshrc:70: command not found: ^M
/home/li-xinyang/.zshrc:73: command not found: ^M
/home/li-xinyang/.zshrc:76: command not found: ^M
如何删除^M
?
答案 0 :(得分:5)
在我的Mac上运行dos2unix,用于Oh-My-Zsh安装的所有文件。总之,它就像下面这样。我一直在重新运行source~ / .zshrc来检查安装是否正常,没有任何错误,直到我转换了所有文件,包括二进制文件。
brew install dos2unix
cd /Users/<your user>/.oh-my-zsh
find . -name “ *.sh” | xargs dos2unix -f
find . -name “ *.zsh” | xargs dos2unix -f
dos2unix -f themes/robbyrussel.zsh-theme
cd
dos2unix -f .zshrc
source ~/.zshrc
答案 1 :(得分:3)
解决方案是将autocrlf=true
设置为autocrlf=false
,使用以下命令
git config --global core.autocrlf true
^M
是回车符(CR),Windows样式的文本行结束make。
答案 2 :(得分:0)
我遇到了同样的问题,而autocrlf = true没有解决问题。 我通过注释掉了〜/ .zshrc中的git插件后删除了&amp;替换了有问题^ M的文件,它已被解决。看来哦-my-zsh上的git插件发生了冲突。
#plugins=(git)
答案 3 :(得分:0)
我可以通过在低频模式下保存文件~/.zshrc
来解决Ubuntu中的此错误。