Search code examples
zshoh-my-zsh

oh-my-zsh Command Not Found: ^M


I am trying to install oh-my-zsh on Ubuntu 15. After running the installation script

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

I have the following error which never occur before

/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

How can I remove ^M?


Solution

  • The solution is to set autocrlf=true to autocrlf=false use the command below,

    git config --global core.autocrlf true
    

    ^M is carriage return (CR), Windows-style text line ending make.