Search code examples
linuxbasheditplus

backspace issue on linux file


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() {

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?

EDIT:

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 control --reload-rules sleep 2 echo echo $(date +"%b %e %T") hostname Program[$$]: Program Started | tee -a /var/log/messages echo } stop() {


Solution

  • 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.