Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: A peep into the future.

Vincent Lefevre writes:

> >     if you say "foo > Important_file", zsh checks to see if there
> >     is anything on the stdout of foo, if not (say foo is
> >     non-existent), zsh leaves the Imp_file as it is.
> Not a good idea. Sometimes I use this to clear a (temporary) file.
> You can set NO_CLOBBER. But sometimes it is not sufficient, e.g.
> one use >| then one types a wrong file name. So I'd prefer to have
> an automatical backup, e.g. "Important_file" is renamed to
> "Important_file.bak".

What, just add ".bak"?  It's a good idea, in principle, and I'm
surprised it's not been done.  But if it's to be done, then it ought to
follow the same conventions as some (but not all, alas) of the GNU
utilities, I think, in particular the file utilities.  Two or three
environment variables define the behaviour, which allows you to use
either simple backups or numbered backups, and if you use numbered
backups you can select how many to keep.
Bruce Stephens                  | email: B.Stephens@xxxxxxxxxxx
Utrecht University              | telephone: +31 30 2534630
Department of Mathematics       | telefax:   +31 30 2518394
P.O. Box 80010, 3508 TA Utrecht |
The Netherlands                 |

Messages sorted by: Reverse Date, Date, Thread, Author