本文主要是介绍bash脚本2_对比多个不同版本同名文件的异同,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
bash脚本2_对比多个不同版本同名文件的异同
#!/bin/bashFOLDER_A="$1"
FOLDER_B="$2"IGNORE_STRING="loc_timestamp"subfolders=$(ls -d "$FOLDER_A"/*/)for subfolderA in $subfolders; dosubfolder_name=$(basename "$subfolderA")FILE_A="$FOLDER_A/$subfolder_name/fileName.json"FILE_B="$FOLDER_B/$subfolder_name/fileName.json"if [[ ! -f "$FILE_A" ]]; then# echo "File not found in $FOLDER_A/$subfolder_name. Continue."continuefiif [[ ! -f "$FILE_B" ]]; then# echo "File not found in $FOLDER_B/$subfolder_name. Continue."continuefiif diff "$FILE_A" "$FILE_B" >/dev/null; then# echo "Files in $subfolder_name are identical."continueelseecho "Files in $subfolder_name are different."fidiff "$FILE_A" "$FILE_B" > diff_output.txt
doneecho "finished"
这篇关于bash脚本2_对比多个不同版本同名文件的异同的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!