Shell – How to pipe the result of ‘date’ command to ‘mv’ command

piperenameshell

I want to rename my file to the current timestamp.I know how to get the current timestamp("date +%s") but how can I pipe it to 'mv' command?

Best Answer

Use something like this (bash):

mv myfile myfile.$(date +%s)

Or alternatively:

mv myfile myfile.`date +%s`

if your shell doesn't do the $(command) thing.

Related Question