0
我试图比较所有文件对之间的差异。但是,为了比较文件对,我需要能够访问for循环中的当前元素之后的元素。这是我目前拥有的代码 -BASH - 将文件名中的下一个元素用于循环
#!/bin/bash
for file in $(find -type f); do
b = $(file+1) -- I know this is not the correct way to access the next element
diff $(file) $(b) >/dev/null
if [ #? -eq 0 ]
echo $(file) and $(b) are the same
else
echo $(file) and $(b) are not the same
fi
done
与访问下一个元素的方式任何援助将不胜感激。
太棒了,完美的作品:)非常感谢。另外关于花括号和圆括号,我意识到在提交后 - 我没有正确复制终端上的文本。再次感谢! – GregHamilton2