zoukankan      html  css  js  c++  java
  • 记一次安装zsh插件编码^M异常操作

    安装插件异常

    ❯ source ~/.zshrc
    /root/.zinit/bin/zinit.zsh:3: command not found: ^M
    /root/.zinit/bin/zinit.zsh:7: command not found: ^M
    /root/.zinit/bin/zinit.zsh:typeset:8: not valid in this context: ZINIT_RUN^M
    /root/.zshrc:168: command not found: zinit
    

    搞了好久,都不知道什么原因造成的

    但是肯定不是插件问题,因为我在另外一台电脑安装成功了。

    查看具体文件的编码

    ❯ file ~/.zinit/bin/zinit.zsh
    /root/.zinit/bin/zinit.zsh: UTF-8 Unicode text, with very long lines, with crlf line terminators
                                                                        �  � with root@hongda � at 18:10:02 
    ❯ file ~/.zshrc
    /root/.zshrc: UTF-8 Unicode text
    

    查看编码也是utf-8的,但是带上crlf

    通过od命令转换8进制字码

    文件转换成8进制字码呈现出来

    这里的换行符为

    这个时候就想应该是通过git下载插件的时候换行符自动转换造成的。

    修改git的换行符设置

    ❯ git config --list |grep autocrlf
    core.autocrlf=true
    

    禁用自动转换

    git config core.autocrlf false
    git config --global core.autocrlf false
    

    再次通过git下载插件,查看字码

    可以看见只有 的换行符

    执行source命令也ok

  • 相关阅读:
    框架代码 2
    框架代码 2
    个人资料  代码
    个人资料  代码
    XHTML表单
    框架代码 1
    计算机科学与技术学习反思录(转载)
    写在Blog点击数超过50000之后...
    小笨霖英语笔记本(6)水电
    SUN服务器及Solaris Serial Console常见设置问题
  • 原文地址:https://www.cnblogs.com/hongdada/p/14043871.html
Copyright © 2011-2022 走看看