Home  >  Article  >  Backend Development  >  atom修改行结束符

atom修改行结束符

WBOY
WBOYOriginal
2016-06-06 20:12:492117browse

  • 我在linux上运行shell代码

  • 但是是在windows上书写的,我怀疑是行结束符的问题,导致运行报错。我已经确认没有语法错误了。

  • 但是不知道怎么在atom中修改,找不到相关的配置项。

这是报错信息与代码

<code>-bash: ./shell.sh: /bin/bash^M: bad interpreter: No such file or directory
</code>
<code>#! /bin/bash
name="haaha"
echo "Hello World !"
echo $name
# 加花括号是为了帮助解释器识别变量的边界
echo ${name}
for var in A B C ; do
   echo "var is $var"
done
</code>

解决方案

我在vim里用

<code>set ff=unix
</code>

改了一下文件格式,暂时只能这样了。

回复内容:

  • 我在linux上运行shell代码

  • 但是是在windows上书写的,我怀疑是行结束符的问题,导致运行报错。我已经确认没有语法错误了。

  • 但是不知道怎么在atom中修改,找不到相关的配置项。

这是报错信息与代码

<code>-bash: ./shell.sh: /bin/bash^M: bad interpreter: No such file or directory
</code>
<code>#! /bin/bash
name="haaha"
echo "Hello World !"
echo $name
# 加花括号是为了帮助解释器识别变量的边界
echo ${name}
for var in A B C ; do
   echo "var is $var"
done
</code>

解决方案

我在vim里用

<code>set ff=unix
</code>

改了一下文件格式,暂时只能这样了。

下回针对程序提问,应该带上你当前程序的版本才对。

如果不考虑低版本问题的话,见下图

atom修改行结束符

为什么要用windows编辑,这么点代码 重新敲一遍不行吗!!!

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