1

Is there a way to have Ed create backups of the file currently loaded into the buffer. On occasion I have inadvertently overwritten my file and found it's not recoverable. I.e. making a backup file with a tilde appended to the original file name (e.g., myfile.txt~), which would contain the previous version of the file.

1
  • 1
    Answer seems to be "No". But one backup is not much safer than no backup if the name is fixed. I keep an audit trail for every significant edit, which I can examine with diff to find when I introduced a feature (or a bug). I can see tarConfig.V16, but I believe I had a .V83 on one project, due to a prevaricating client. Commented Jul 18 at 6:58

1 Answer 1

1

The ed editor does not provide a backup facility (or any way to configure it, at all). Writing the editing buffer back to disk with the w command overwrites the original file.

It is up to you to edit a copy of your original data or save the text with a new filename, either by saving using w some-filename or using f some-filename followed by w.

Some modern filesystems provide snapshotting facilities that would let you retrieve the overwritten data, or you could fetch it from a recent backup, if you overwrote it in error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .