current=`date "+%Y-%m-%d %H:%M:%S"`
timeStamp=`date -d "$current" +%s`
#将current转换为时间戳,精确到毫秒
currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
echo $currentTimeStamp
常用shell(1):shell获取系统当前时间戳
https://blog.csdn.net/c1481118216/article/details/77132270
本文介绍了一种使用Shell脚本获取当前时间戳的方法,并详细展示了如何将当前时间转换为精确到毫秒的时间戳格式。
585

被折叠的 条评论
为什么被折叠?



