I like to take all notes in one .txt file and would like to write a bash script which adds the date on midnight to the end of the file automatically with a cronjob.
So the file should look something like this:
Monday 19/09/22
my really long notes
Tuesday 20/09/22
my other long notes
Thursday 21/09/22
Adding the date is not a problem but writing to a file that is open and not saved.
So my question is: How can I save an open file from the command line?
Thanks in advance.