0

我想搜索存储库文件以查看我的目录中是否有文件。为此,我循环希望包含我正在寻找的文件的目录,并检查该文件是否在我的 repository.txt 中。如果它在那里,我更改一个布尔值,然后在比较存储库中的所有文件后检查该布尔值的值。

for file in *
 do
    inThere=false        
    cut -d, -f1 $repo | while read line
      do
        echo "comparing "$line" == "$file" "
        if [ "$line" == "$file" ]; then
          inThere=true
          echo "I got tripped!!" #inThere is true
          echo "in there is $inThere"
        fi
    done
          echo "in there is $inThere" #inThere is false        
  done 

有没有办法可以保持不断变化的布尔值,或者有另一种更聪明的方法吗?请让我知道,如果你有任何问题。

4