场景: 查询某数据交换平台下,是否存放各个上游系统下发的文件。
vim checkfile.sh
#!/bin/bash
filename="1.txt" # 1.txt中为要存在的文件,1.txt要与脚本在同一目录
cat "$filename" | while read -r line;
do
echo $line
num=`ls -l /home/db/dxpworkspace/*/* |grep $line|wc -l` #目录可换
echo $num
if [$num =0];
echo $line 'Error'
fi;
done