-bash: $'\377\376if': command not found
-bash: $'then\r': command not found
: No such file or directorysu//.bashrc
-bash: /.bash_profile: line 3: syntax error near unexpected token `fi'
-bash: /cygdrive/c/Users/jhsu//.bash_profile: line 3: `fi'
-bash: '\r': command not found
原因:
Windows和Linux文本文件行尾符不同,windows使用的是CR+LF即 “\r\n”,而Linux使用的是LF即"\n",所以即使文件已经添加了可执行文件,该文件也无法被执行。
解决:
dos2unix filename
等待执行完成就可以了
文章描述了由于Windows和Linux文本文件行尾符不同(Windows使用CR+LF,Linux使用LF)所引发的bash命令执行问题,如commandnotfound和语法错误。解决方案是使用dos2unix工具转换文件行尾符,以确保文件在Linux环境下正确执行。

被折叠的 条评论
为什么被折叠?



