如何以纪元格式设置文件的 mtime?

eil*_*eil 15 shell timestamps touch

我知道如何以纪元格式获取文件的 mtime:

stat --format=%Y <file>
Run Code Online (Sandbox Code Playgroud)

但我一直无法弄清楚如何以纪元格式设置文件的 mtime。touch(1) 手册页似乎只接受“时间戳”值(使用月、天、小时、分钟等的或多或少的固定格式)或“大多数自由格式的人类可读日期字符串”。

我应该研究其他实用程序吗?

谢谢。

Hau*_*ing 14

至少在 GNU 世界中:

touch --date=@1403970787 file
Run Code Online (Sandbox Code Playgroud)

喜欢与date.