Closed penkovski closed 3 years ago
The >
output redirection is the responsibility of the shell (e.g. bash) and not age itself. I don't think it's possible for age to detect what is the file after >
and prevent such user mistakes as in your example.
Agree. I just saw that there's an option to specify output name, so if it's used in that way the file won't be destroyed.
age -d -o test.txt.age test.txt.age
Thank you for answering, I'm closing it.
Environment
What were you trying to do
Decrypt a file with passphrase but mistakenly enter the output filename to be the same as the encrypted filename. See below:
What happened
age prints an error, but the encrypted file is destroyed (has size of 0 bytes).
I would suggest in case the user has accidentally made such a mistake (i.e. autocomplete) to have the option to try again with different output name. Currently, the encrypted file is destroyed after the first attempt.