使用shell / bash脚本在不同的子目录中查找公用文件

时间:2018-07-09 07:46:12

标签: bash shell sh

我需要在子目录中查找文件,并将该文件与源文件夹进行比较。但是由于 /,使用diff命令同时检查多个目录时出现错误。 r =“ /”

for i in QDC RTF

k = find product/$i/ -type d -printf '%d\n' -name ".git" -prune -o -type f -print | sort -rn | head -1
array =()
对于((j = 0; j
diff -rqs product/Release/Ticket/ product/$i/${array} | grep "Files"
array =“ $ array $ r”
完成
完成
$ sh -x build.sh

++ find product/RTF/ -type d -printf '%d\n' -name .git -prune -o -type f -print ``++ sort -rn ++头-1
+ k = 5
+ array =()
+((j = 0))
+((j + grep文件
+ diff -rqs product/Release/Ticket/ product/RTF/ + array =' /'
+((++ j))
+((j + grep文件
+ diff -rqs product/Release/Ticket/ product/RTF/dev/ product/RTF/v1r7/ diff: extra operand 'product/RTF/v1r7/' diff:尝试使用“ diff --help”以获取更多信息。
+ array ='
/ /'
+((++ j))
+((j + grep文件
+ diff -rqs product/Release/Ticket/ product/RTF/dev/build/ product/RTF/v1r7/dev/ ``product/RTF/v1r7/dist/ diff: extra operand 'product/RTF/v1r7/dev/' diff:尝试使用“ diff --help”以获取更多信息。
+ array ='
/ / /'
+((++ j))
+((j + grep文件
+ diff -rqs product/Release/Ticket/ product/RTF/v1r7/dev/build/ product/RTF/v1r7/dist/delta/ product/RTF/v1r7/dist/sabre/ product/RTF/v1r7/dist/trp/ diff: extra operand 'product/RTF/v1r7/dist/delta/'

0 个答案:

没有答案