It happens often a script I have the needs to append a simple timestamp in the format of YYYYMMDDHHMMSS to a generated file.
It’s very easy to get it to work in pure bash, without perl script and similia. Just use the native date command with his format option. Easy as drinking a glass of water, the command is (for the format above)
$ date +”%Y%m%d%H%M%S”
for the full detail of the format arguments, refer to the man page.
A simple usage in script is