Rm -rf file.txt~ included in the first step?

I need to shred and delete a file after a certain time. Therefore I use

shred -z /path/to/file.txt | rm -rf /path/to/file.txt

It works well, but typing
in that very directory

ls -shi

I still see the so called backup-copy lets say file.txt~
When running bleachbit it will disappear thoroughly. So how can I include in my two commands to erase even the backup-copy?
It is a non-interactive script, using debian wheezy. Any hints? Thanks in advance, still using twice that chain of the commands, but there should be a better solution, maybe.

Look at the man page for shred on your system. If a backup file is being created by the filesystem you're using, shred will waste time creating a copy of your file and shredding it; but the backup copy will not have been shredded when you delete the shredded copy and the backup copy.

You might as well just rm /path/to/file.txt even though it won't have been shredded. If you were using a filesystem that didn't make a backup copy, it would be better to just use:

shred -zu /path/to/file.txt

which would shred, zero, and then delete the file in one step.

The -r option to rm is meaningless unless at least one of the pathnames you give it as an operand is a directory.

1 Like

Allright,

shred -zu

works fine, sorry my fault, I missed that option in the manpage. Thanks a lot.

OK
After you run shred -zu pathname , do you end up with a file named pathname~ ?