Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含多行文件的文件。我还有一个目录,其中包含所有文件,现在我想通过 shell 脚本查找文件中列出的文件是否存在于目录中。
迭代和测试
cat filelist.lst | while read filename do if [ -f directory/$filename ] then echo File $filename exists # build up a list exists="$exists directory/$filename" fi done