通过MD5值,来判断自己down的文件与服务器上的文件是否一致。也可以比较两个文件是否相同。
1.在mac上运行:
此进输入brew就可以运行了。
2.运行:
brew install md5sha1sum
3.通过运行 md5sum xxxxx.yy的方式,就可以看到此文件的md5值。
mac下获取文件的md5与sha1值
MD5Str = 'echo -n $str|md5sum'
echo -n 'admin' | md5sum
輸出21232f297a57a5a743894a0e4a801fc3
shell脚本获取当前时间戳
current=date "+%Y-%m-%d %H:%M:%S"
timeStamp=date -d "$current" +%s
将current转换为时间戳,精确到毫秒
currentTimeStamp=
currentTimeStamp
执行.sh文件
chmod 777 1.sh
./updateapp.sh
current=date +%s
echo $current
str="abc"
echo
{str}|md5sum|cut -d ' ' -f1
linux在shell中执行命令并将结果赋值给变量
经过验证如下:
date=$(command)