对linux文件退格的问题 [英] backspace issue on linux file
问题描述
我用EditPlus的编写Linux的庆典节目。书面方式后,当我的文件移动到服务器,我得到这些错误类型:
I use EditPlus to write linux bash programs. after writting when i move files to server i get these kind of errors:
sleep: invalid time interval `2\r'
Try `sleep --help' for more information.
/usr/bin/program: line 9: $'\r': command not found
/usr/bin/program: line 10: $'}\r': command not found
/usr/bin/program: line 11: $'\r': command not found
/usr/bin/program: line 12: syntax error near unexpected token `$'{\r''
'usr/bin/program: line 12: `stop() {
我也用DOS2UNIX的来解决这个问题,但没有成功。我想知道,有没有什么办法,我能避免这种问题。它浪费了大量的时间。有没有更好的编辑器或其他方式来解决这个问题?
I have also used dos2unix to fix this issue but no success. I want to know that is there any way that I can avoid this kind of problems. it waste alot of time. is there any better editor or some way to fix this issue?
编辑:
我做些什么来解决这个问题是我六世在linux下一个文件,然后按行从Windows文件复制行到Linux文件,然后它的作品。这些都是我的code线:
What I do to solve this issue is that I vi a file in linux and then copy line by line from windows file to linux file and then it works. these are lines of my code:
line7:udevadm控制--reload规则
睡眠2
回声
回声$(日期+%B%E%T)主机名
程序[$$]:程序开始|三通-a在/ var / log / messages中
回声
}
停止(){
line7:udevadm control --reload-rules
sleep 2
echo
echo $(date +"%b %e %T") hostname
Program[$$]: Program Started | tee -a /var/log/messages
echo
}
stop() {
推荐答案
您需要更改文件preferences:去preferences - >文件并更改创建新文件,以UNIX。此外,您可能希望启用选项加载时检查无效CR / LF,空字符。
You need to change file preferences: go to Preferences -> Files and change "Create new file as " to UNIX. Also, your might want to enable "Check invalid CR/LF, null character when loading" option.
这篇关于对linux文件退格的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!