Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有
$ date +"%c"
命令
显示日期和时间,但我只想显示完整的非军事时间,例如:04:52:06 PM
我试过了
date +"%T"
但是,这会返回军事日期,而不是标准。
尝试使用所有选项一起“从头开始”制作它。您可以拥有任意数量的格式。
]$ date +"%I:%M:%S %p" 05:26:22 PM
您的系统可能会接受date +%r这是一个“别名”"%I:%M:%S %p"
date +%r
"%I:%M:%S %p"
我会以这种方式显示它:
date +"%I:%M:%S %p"