解决MacOS系统中date命令没有毫秒和sha512sum、sha256sum、md5sum等命令的问题

  • A+
所属分类:MAC  常用系统

安装brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

使用brew安装coreutils

brew install coreutils

设置系统新的命令软连接

sudo ln -sv /usr/local/bin/gsha256sum /usr/local/bin/sha256sum
sudo ln -sv /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
sudo ln -sv /usr/local/bin/gdate /usr/local/bin/date
sudo ln -sv /usr/local/bin/gmd5sum /usr/local/bin/md5sum

测试

[lookback@LookBack-MBP ~]$ date +%N
133688000
[lookback@LookBack-MBP ~]$ date +"%s%N"| sha256sum
3743f380dc7963d586ea1d34c62d734ef351e793571a821779a377d9846a1de7  -
[lookback@LookBack-MBP ~]$ date +"%s%N"| sha512sum
11274a196f70de395abe06ce38c32f7f197c523c250481b5b246c474da0d4998057bbf6b07d6c40347b155a42525ff7cf412914407611b35bca4ee7483088d1c  -
[lookback@LookBack-MBP ~]$

解决MacOS系统中date命令没有毫秒和sha512sum、sha256sum、md5sum等命令的问题

lookback

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: