Home  >  Article  >  Backend Development  >  怒了!文件明明存在,却提示找不到,这是什么鬼?

怒了!文件明明存在,却提示找不到,这是什么鬼?

WBOY
WBOYOriginal
2016-06-06 20:33:153137browse

怒了!文件明明存在,却提示找不到,这是什么鬼?

文件明明存在,却提示不存在。完整的路径也尝试过了。郁闷中。。。

回复内容:

怒了!文件明明存在,却提示找不到,这是什么鬼?

文件明明存在,却提示不存在。完整的路径也尝试过了。郁闷中。。。

phalcon的安装脚本是bash,首行是#!/bin/bash[LF],这表示直接执行(或sudo执行)时去查找/bin/bash这个解释器。

如果由于git克隆等原因,文件的换行符意外的改成了[CR][LF]的Windows风格……
那么在脚本执行的时候,sudo仍然只会去掉Unix换行符[LF],然后试图去查找/bin/bash[CR]这个文件当作解释器,当然是不可能存在的。

请用此命令检查文件的第一行是否以CR(0x0D) LF(0x0A)结尾:
cat install | head -n 1 | od -t x1

(如果这个原因猜错了就请另找故障点)

其实你看看install文件的第一行你就知道了
#!/path/to/somewhere
这个文件不存在对不?

cat -A install

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn