Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 753
user115079 Avatar asked May 04 '12 18:05

user115079


1 Answers

Setting the "line ending sequence" in VSCode / atom from CRLF TO LF and saving worked for me

like image 100
Marc Sloth Eastman Avatar answered Oct 13 '22 01:10

Marc Sloth Eastman