On Wed, 2020-08-19 at 21:05 -0600, Vince Eccles wrote: > Dear sirs, > > I worked all day on debugging some important coding in FORTRAN. It was > tested and working. I decided it was time to tar up the new code and send > it to a backup machine. > > I intended to type: > > tar -zcf src.tar.gz ./various_*/*.f90 *.f90 > > which would have places all the fortran codes in a compressed tar file that > I would transfer to a new machine. > > However, I typed: > > tar -zcf ./various_/*.f90 *.f90 > > and the tar blasted all of my fortran files. I had a backup from two days > ago, but the lost effort was horrific. > > There needs to be a test to make sure stupid things don't happen. >
How is it supposed to know that someone's doing something stupid? Pattern expansion is done by shell, not tar. If you want to be safer, don't use '-f' and instead redirect stdout. tar -zc ./various_/*.f90 *.f90 > src.tar.gz -- Best regards, Michał Górny
signature.asc
Description: This is a digitally signed message part