堕落不振功业废,勤耕不辍日月新

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

C/C++ hailen 20℃

安装brew

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

使用brew安装coreutils

brew install coreutils

设置系统新的命令软连接

sudo ln -s /usr/local/bin/gsha256sum /usr/local/bin/sha256sum
sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
sudo ln -s /usr/local/bin/gdate /usr/local/bin/date

测试

[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命令的问题

转载请注明:我是IT » 解决MacOS系统中date命令没有毫秒和sha512sum、sha256sum命令的问题

喜欢 (0)or分享 (0)