How can I accomplish the following?
date '+%d' | md5sum | tar -czf $_.tar.gz file
I would like the filename.tar.gz to be that of the md5sum output.
How can I accomplish the following?
date '+%d' | md5sum | tar -czf $_.tar.gz file
I would like the filename.tar.gz to be that of the md5sum output.
tar -czf `date '+%d' | md5sum | sed -e 's/ -//'`.tar.gz file
Better suited to serverfault.com.
This is not an answer to your question.
Why do you need to MD5 hash the date? Why not use the date itself? Usually you hash something, when you don't want the reverse operation to happen. In your case: you want to prevent that someone can find the date from the hash. But there aren't to many possible dates and it can easily be found by brute force. Even the creation timestamp of the file can give you hints in what range to look for the date. All in all I can't see a reason to use a cryptographic hash instead of the original date.