Append date to filename in linux

后端 未结 5 1430
感情败类
感情败类 2020-12-02 14:38

I want add the date next to a filename (\"somefile.txt\"). For example: somefile_25-11-2009.txt or somefile_25Nov2009.txt or anything to that effect

Maybe a script w

5条回答
  •  星月不相逢
    2020-12-02 14:53

    You can use backticks.

    $ echo myfilename-"`date +"%d-%m-%Y"`"
    

    Yields:

    myfilename-25-11-2009
    

提交回复
热议问题