假设我有
shasum=$(sha1sum <file>)如何将该值与另一个文件中sha1sum进行比较:
if [[ $shasum == `cat <other-file>` ]]; then
echo "values are the same"
fi这不可能是对的有人知道吗?
发布于 2019-05-02 03:38:06
如果我没理解错的话,你必须对文件进行比较,比如test1.txt和test2.txt,并且你想要比较thoose文件的sha1和。
您需要获取这两个thoose文件的sha1sum:
shasum1=$(sha1sum test1.txt)
shasum2=$(sha1sum test2.txt)然后比较THooSE值:
if [ "$shasum1" = "$shasum2" ]; then
echo "Files are the same!"
else
echo "Files are different!"
fi但是,您不应该再使用SHA1。
https://stackoverflow.com/questions/55940183
复制相似问题