Well, I'm new to Linux and I have a problem with a simple bash script.
I have a program that adds a log file while it is running. Over time, this log file becomes huge. I would like to create a startup script that will rename and move the log file before each run, effectively creating separate log files for each run of the program. Here is what I have so far:
pastebin
DATE=$(date +"%Y%m%d%H%M") mv server.log logs/$DATE.log echo program
At startup, I see the following:
: command not found program
When I connect to the log directory and run dir, I see the following:
201111211437\r.log\r
What's happening? I assume there is some kind of syntax issue that I am missing, but I cannot figure out how to do this.
UPDATE: thanks to the comment below, I found that the problem is that I edit the .sh file in Notepad ++ on Windows and then send via ftp to the server, where I run the file through ssh. After running dos2unix in the file, it works.
A new question: how can I save the file correctly in the first place, in order to avoid the need to perform this correction every time I send the file again?
linux bash
Cat5InTheCradle Nov 22 2018-11-11T01
source share